Example #1
0
void dumpLabel(LabelInfo const* li)
{
    if (g_tfile == NULL) return;
    if (LABEL_INFO_type(li) == L_ILABEL) {
        fprintf(g_tfile, "\nilabel(" ILABEL_STR_FORMAT ")",
                ILABEL_CONT(li));
    } else if (LABEL_INFO_type(li) == L_CLABEL) {
        fprintf(g_tfile, "\nclabel(" CLABEL_STR_FORMAT ")",
                CLABEL_CONT(li));
    } else if (LABEL_INFO_type(li) == L_PRAGMA) {
        ASSERT0(LABEL_INFO_pragma(li));
        fprintf(g_tfile, "\npragms(%s)",
                SYM_name(LABEL_INFO_pragma(li)));
    } else { UNREACH(); }

    if (LABEL_INFO_b1(li) != 0) {
        fprintf(g_tfile, "(");
    }
    if (LABEL_INFO_is_try_start(li)) {
        fprintf(g_tfile, "try_start ");
    }
    if (LABEL_INFO_is_try_end(li)) {
        fprintf(g_tfile, "try_end ");
    }
    if (LABEL_INFO_is_catch_start(li)) {
        fprintf(g_tfile, "catch_start ");
    }
    if (LABEL_INFO_b1(li) != 0) {
        fprintf(g_tfile, ")");
    }
    fflush(g_tfile);
}
Example #2
0
//Get the value expression that to be propagated.
inline static IR * get_propagated_value(IR * stmt)
{
    switch (IR_code(stmt)) {
    case IR_ST: return ST_rhs(stmt);
    case IR_STPR: return STPR_rhs(stmt);
    case IR_IST: return IST_rhs(stmt);
    case IR_PHI: return PHI_opnd_list(stmt);
    default:;
    }
    UNREACH();
    return NULL;
}
Example #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;
}
Example #4
0
void dumpBBLabel(List<LabelInfo const*> & lablist, FILE * h)
{
    ASSERT0(h);
    C<LabelInfo const*> * ct;
    for (lablist.get_head(&ct); ct != lablist.end(); ct = lablist.get_next(ct)) {
        LabelInfo const* li = ct->val();
        switch (LABEL_INFO_type(li)) {
        case L_CLABEL:
            fprintf(h, CLABEL_STR_FORMAT, CLABEL_CONT(li));
            break;
        case L_ILABEL:
            fprintf(h, ILABEL_STR_FORMAT, ILABEL_CONT(li));
            break;
        case L_PRAGMA:
            ASSERT0(LABEL_INFO_pragma(li));
            fprintf(h, "%s", SYM_name(LABEL_INFO_pragma(li)));
            break;
        default: UNREACH();
        }

        if (LABEL_INFO_is_try_start(li) ||
            LABEL_INFO_is_try_end(li) ||
            LABEL_INFO_is_catch_start(li)) {
            fprintf(g_tfile, "(");
            if (LABEL_INFO_is_try_start(li)) {
                fprintf(g_tfile, "try_start,");
            }
            if (LABEL_INFO_is_try_end(li)) {
                fprintf(g_tfile, "try_end,");
            }
            if (LABEL_INFO_is_catch_start(li)) {
                fprintf(g_tfile, "catch_start");
            }
            fprintf(g_tfile, ")");
        }
        fprintf(g_tfile, " ");
    }
}
Example #5
0
void MDPhi::dump(Region * rg, UseDefMgr * mgr)
{
    ASSERT0(rg);
    ASSERT0(is_phi());
    if (g_tfile == NULL) { return; }

    List<IRBB*> preds;
    IR_CFG * cfg = rg->getCFG();
    ASSERT0(cfg);
    cfg->get_preds(preds, getBB());
    IRBB * pred = preds.get_head();

    ASSERT0(getResult());
    fprintf(g_tfile, "Phi: MD%dV%d <- ",
        getResult()->mdid(), getResult()->version());
    for (IR const* opnd = getOpndList(); opnd != NULL; opnd = opnd->get_next()) {
        if (opnd != getOpndList()) {
            fprintf(g_tfile, ", ");
        }

        switch (opnd->get_code()) {
        case IR_CONST:
            fprintf(g_tfile, "Const");
            break;
        case IR_LDA:
            fprintf(g_tfile, "Lda");
            break;
        case IR_ID:
            {
                VMD * vopnd = getOpndVMD(opnd, mgr);
                fprintf(g_tfile, "MD%dV%d(id:%d)",
                    vopnd->mdid(), vopnd->version(), opnd->id());
            }
            break;
        default: UNREACH();
        }

        ASSERT0(pred);
        fprintf(g_tfile, "(BB%d)", pred->id());
        pred = preds.get_next();
    }

    VMD * res = getResult();
    ASSERT0(res);
    fprintf(g_tfile, "|UsedBy:");
    SEGIter * vit = NULL;
    bool first = true;
    for (INT i2 = res->getOccSet()->get_first(&vit);
        i2 >= 0; i2 = res->getOccSet()->get_next(i2, &vit)) {
        if (first) {
            first = false;
        } else {
            fprintf(g_tfile, ",");
        }

        IR const* use = rg->getIR(i2);
        ASSERT0(use && (use->isMemoryRef() || use->is_id()));
        fprintf(g_tfile, "%s(id:%d)", IRNAME(use), use->id());
    }

    fflush(g_tfile);
}