コード例 #1
0
void El_record_maxreduce_info_in_attr(Hyperblock *hb)
{
    Control_cpr_info *attr;
    int size, i;
    Operand br_pred, ft_pred;
    Hash_set<Operand> cpr_preds(hash_operand), derived_on_preds(hash_operand), derived_off_preds(hash_operand);

    if (dbg(cpr, 3))
	cdbg << "Enter El_record_maxreduce_info_in_attr: " << hb->id() << endl;
    attr = get_control_cpr_info(hb);
    if (attr != NULL)
        El_punt("El_record_maxreduce_info_in_attr: HB %d already has an attr",
			hb->id());

    size = hb_br_preds.size();
    attr = new Control_cpr_info(size);

    // Compute set of all preds used for cpr, cpr_preds
    for (Dlist_iterator<Operand> dl_i(hb_br_preds); dl_i!=0; dl_i++) {
	cpr_preds += (*dl_i);
    }
    for (Dlist_iterator<Operand> dl_i2(hb_ft_preds); dl_i2!=0; dl_i2++) {
	cpr_preds += (*dl_i2);
    }

    for (i=0; i<size; i++) {
	br_pred = hb_br_preds.pop();
	ft_pred = hb_ft_preds.pop();
	if (dbg(cpr, 3))
	    cdbg << "i " << i << " on_trace_pred " << ft_pred
                 << " off_trace_pred " << br_pred << endl;
	attr->set_on_trace_pred(i, ft_pred);
	attr->set_off_trace_pred(i, br_pred);
	El_compute_maxreduce_derived_preds(hb, ft_pred, br_pred, cpr_preds,
						derived_on_preds, derived_off_preds);
	if (derived_on_preds.size() > 0)
	    attr->set_derived_on_trace_pred(i, derived_on_preds);
	if (derived_off_preds.size() > 0)
	    attr->set_derived_off_trace_pred(i, derived_off_preds);
    }

    set_control_cpr_info(hb, attr);
}
コード例 #2
0
/*
 *	FRPize a superblock using the if-converter
 */
void El_frpize_sbs(Procedure *f)
{
    Basicblock *entry_bb;
    Hyperblock *hb;
    List_set<Basicblock*> hb_bbs;
    Hash_set<Hyperblock*> all_hbs;
    bool push_flag, applied;
    Dlist<Region*> rstack;
    Region *rtmp;
    Compound_region *new_hb;

    if (dbg(cpr, 2))
        cdbg << "Enter frpize sbs" << endl;

    // First find all the HBs in f and add them to set all_hbs
    rstack.push(f);
    while (! rstack.is_empty()) {
        rtmp = rstack.pop();
        push_flag = true;
        if (rtmp->is_hb()) {
	    all_hbs += ((Hyperblock *) rtmp);
            push_flag = false;  // Only ops below, so don't waste time!
        }
        else if (rtmp->is_bb()) {
            push_flag = false;  // Only ops below, so don't waste time!
        }
        if (push_flag==true) {
            for (Region_subregions subri(rtmp); subri!=0; subri++) {
                if ((*subri)->is_compound())
                    rstack.push(*subri);
            }
        }
    }

    // Now walk thru hash_set and frpize it
    applied = false;
    for (Hash_set_iterator<Hyperblock*> hseti(all_hbs); hseti!=0; hseti++) {
	hb = *hseti;
	if (dbg(cpr, 2))
	    cdbg << "Processing HB " << hb->id() << endl;
	if (! El_is_frpizable(hb)) {
	    if (dbg(cpr, 2))
		cdbg << "\tHB " << hb->id() << " not frpizable" << endl;
	    continue;
	}
	hb_bbs.clear();
	El_find_bbs_in_hb(hb, &entry_bb, hb_bbs);
	El_remove_region(hb, false);
	El_fprize_this_sb(f, entry_bb, hb_bbs);
	new_hb = entry_bb->parent();
	if (! new_hb->is_hb())
	   El_punt("El_frpize_sbs: HB not correctly inserted");
	// Copy over id/flags/lcode_attrs from hb to new_hb
	new_hb->set_id(hb->id());
	delete new_hb->attributes;
	new_hb->attributes = new Graph_attribute(*(hb->attributes)) ;
	((Region *)new_hb)->copy_flags(hb);
	// 1 of the flags will be the SB flag, so reset that one
	new_hb->reset_flag(EL_REGION_SUPERBLOCK);
	new_hb->set_flag(EL_REGION_HYPERBLOCK_FRP);
	applied = true;
	delete hb;
    }

    if (applied == true)
	f->set_flag(EL_PROC_HYPERBLOCK);
}