Exemple #1
0
bool
has_note(Operation operation, NoteKey key)
{
    if (operation.is_phi_handle())
	return has_note(*operation.get_phi_handle(), key);
    else
	return has_note(*operation.get_instr_handle(), key);
}
void overmapbuffer::delete_note(int x, int y, int z)
{
    if (has_note(x, y, z)) {
        overmap &om = get_om_global(x, y);
        om.delete_note(x, y, z);
    }
}
Exemple #3
0
void
Il2cfgSuifPass::do_file_block(FileBlock *fb)
{
    claim(has_note(fb, k_target_lib),
	  "expected target_lib annotation on file block");

    focus(fb);

    il2cfg.initialize();
}
Exemple #4
0
void
M2aSuifPass::do_file_block(FileBlock* fb)
{
    debug(2, "Processing file %s", get_name(fb).chars());

    claim(has_note(fb, k_target_lib),
	  "expected target_lib annotation on file block");

    focus(fb);

    m2a.do_file_block(fb);
}
Exemple #5
0
void
Ex5::do_opt_unit(OptUnit *unit)
{
    IdString name = get_name(get_proc_sym(unit));
    printf("Processing procedure \"%s\"\n", name.chars());

    // get the body of the OptUnit
    AnyBody *body = get_body(unit);

    // verify that it is an InstrList
    claim (is_a<InstrList>(body),
           "expected OptUnit's body in InstrList form");
    InstrList *mil = (InstrList *)body;

    for (InstrHandle h = start(mil); h != end(mil); ) {
	InstrHandle cur_h = h++;	// advance before possible instr removal
        Instr *mi = *cur_h;

	if (has_note(mi, k_reserved_reg_load) ||
	    has_note(mi, k_store_reserved_reg))
	    delete remove(mil, cur_h);
    }
}
Exemple #6
0
/*
 * find_branch_id
 *
 * Find the first branch point following `block' and return the HALT id of
 * that branch "event", which must be less than `max_event_id'.
 *
 * The tricky case is when a cycle of CFG blocks contains no branch points.
 * We recognize this situation when we find an impossible edge from one of
 * the blocks reached from `block'.  In that case, we return -1.
 */
int
find_branch_id(CfgNode *block, int max_event_id)
{
    NatSetDense visited;
    bool seen_impossible = false;
    visited.insert(get_number(block));
    do {
	if (ends_in_cbr(block) || ends_in_mbr(block) || ends_in_return(block))
	{
	    // For CBR and EXIT, halt note is right on the CTI.  For MBR,
	    // it's on the k_mbr_target_def instruction, the one that
	    // develops the dispatch address.

	    InstrHandle cti_handle = get_cti_handle(block);
	    claim(cti_handle != end(block));

	    InstrHandle h = cti_handle;
	    for (/* */; !has_note(*h, k_halt) && h != start(block); --h)
	    { }

	    if (HaltLabelNote note = get_note(*h, k_halt))
	    {
		int id = note.get_unique_id();
		claim(0 <= id && id < max_event_id, "Branch id out of range");
		return id;
	    }
	    claim(false, "Unable to determine unique id for branch");
	}
	
	claim(ends_in_ubr(block) || ends_in_call(block) || !ends_in_cti(block));

	CfgNodeHandle sh = succs_start(block);
	CfgNode *succ = *sh;

	for (int i = 0; sh != succs_end(block); ++i, ++sh) {
	    if (is_impossible_succ(block, i))
		seen_impossible = true;
	}
	visited.insert(get_number(block));
	block = succ;
    } while (!visited.contains(get_number(block)));
    claim(seen_impossible);
    return -1;
}