Esempio n. 1
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;
}
Esempio n. 2
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;
}
Esempio n. 3
0
//
//START CfsMgr
//
CFS_INFO * CfsMgr::new_cfs_info(IR_TYPE irtype)
{
    CFS_INFO * ci = (CFS_INFO*)xmalloc(sizeof(CFS_INFO));
    CFS_INFO_cfs_type(ci) = irtype;
    switch (irtype) {
    case IR_IF:
        CFS_INFO_true_body(ci) = m_bs_mgr.create();
        CFS_INFO_false_body(ci) = m_bs_mgr.create();
        break;
    case IR_DO_LOOP:
    case IR_WHILE_DO:
    case IR_DO_WHILE:
        CFS_INFO_loop_body(ci) = m_bs_mgr.create();
        break;
    default:
        UNREACH();
    }
    return ci;
}