Ejemplo n.º 1
0
void CFS_MGR::dump_abs_tree(ABS_NODE * an, UINT indent)
{
	while (an != NULL) {
		switch (ABS_NODE_type(an)) {
		case ABS_BB:
			fprintf(g_tfile, "\n"); dump_indent(indent);
			fprintf(g_tfile, "BB%d", IR_BB_id(ABS_NODE_bb(an)));
			break;
		case ABS_LOOP:
			fprintf(g_tfile, "\n"); dump_indent(indent);
			fprintf(g_tfile, "LOOP: HEAD=BB%d", IR_BB_id(ABS_NODE_loop_head(an)));
			dump_abs_tree(ABS_NODE_loop_body(an), indent + 4);
			break;
		case ABS_IF:
			fprintf(g_tfile, "\n"); dump_indent(indent);
			fprintf(g_tfile, "IF: HEAD=BB%d", IR_BB_id(ABS_NODE_if_head(an)));
			if (ABS_NODE_true_body(an) != NULL) {
				fprintf(g_tfile, "\n"); dump_indent(indent);
				fprintf(g_tfile, "TRUE_BODY:");
				dump_abs_tree(ABS_NODE_true_body(an), indent + 4);
			}
			if (ABS_NODE_false_body(an) != NULL) {
				fprintf(g_tfile, "\n"); dump_indent(indent);
				fprintf(g_tfile, "FALSE_BODY:");
				dump_abs_tree(ABS_NODE_false_body(an), indent + 4);
			}
			break;
		}
		an = ABS_NODE_next(an);
	}
}
Ejemplo n.º 2
0
//'cur_region' covered 'entry'.
ABS_NODE * CFS_MGR::construct_abs_if(
						IN IR_BB * entry,
						IN ABS_NODE * parent,
						IN GRAPH & cur_graph,
						IN OUT BITSET & visited)
{
	ABS_NODE * node = new_abs_node(ABS_IF);
	set_map_bb2abs(entry, node);
	ABS_NODE_parent(node) = parent;
	ABS_NODE_if_head(node) = entry;

	IR_BB * true_body, * false_body;
	IR_CFG * cfg = m_ru->get_cfg();
	cfg->get_if_three_kids(entry, &true_body, &false_body, NULL);
	CFS_INFO * ci = map_ir2cfsinfo(cfg->get_last_xr(entry));
	IS_TRUE0(ci != NULL && CFS_INFO_head(ci) == entry);

	BITSET loc_visited;
	ABS_NODE_true_body(node) = construct_abs_tree(true_body, node, CFS_INFO_true_body(ci), cur_graph, loc_visited);
	visited.bunion(loc_visited);
	loc_visited.clean();
	ABS_NODE_false_body(node) = construct_abs_tree(false_body, node, CFS_INFO_false_body(ci), cur_graph, loc_visited);
	visited.bunion(loc_visited);
	visited.bunion(IR_BB_id(entry));
	return node;
}
Ejemplo n.º 3
0
//'cur_region' covered 'entry'.
AbsNode * CfsMgr::constructAbsIf(
        IN IRBB * entry,
        IN AbsNode * parent,
        IN Graph & cur_graph,
        IN OUT BitSet & visited)
{
    AbsNode * node = new_abs_node(ABS_IF);
    set_map_bb2abs(entry, node);
    ABS_NODE_parent(node) = parent;
    ABS_NODE_if_head(node) = entry;

    IRBB * true_body, * false_body;
    IR_CFG * cfg = m_ru->getCFG();
    cfg->getKidOfIF(entry, &true_body, &false_body, NULL);
    CFS_INFO * ci = map_ir2cfsinfo(cfg->get_last_xr(entry));
    ASSERT0(ci != NULL && CFS_INFO_head(ci) == entry);

    BitSet loc_visited;
    ABS_NODE_true_body(node) = constructAbsTree(true_body, node,
        CFS_INFO_true_body(ci), cur_graph, loc_visited);
    visited.bunion(loc_visited);
    loc_visited.clean();
    ABS_NODE_false_body(node) = constructAbsTree(false_body, node,
        CFS_INFO_false_body(ci), cur_graph, loc_visited);
    visited.bunion(loc_visited);
    visited.bunion(BB_id(entry));
    return node;
}