Exemple #1
0
//Remove given USE from occurence set.
void MDSSAInfo::removeUse(IR const* exp, IN UseDefMgr * usedefmgr)
{
    ASSERT0(exp && exp->is_exp() && usedefmgr);
    SEGIter * iter = NULL;
    for (INT i = getVOpndSet()->get_first(&iter);
         i >= 0; i = getVOpndSet()->get_next(i, &iter)) {
        VMD * vopnd = (VMD*)usedefmgr->getVOpnd(i);
        ASSERT0(vopnd && vopnd->is_md());
        vopnd->getOccSet()->diff(exp->id());
    }
}
Exemple #2
0
//
//START MDSSAInfo
//
//Return true if all definition of vopnd can reach 'exp'.
bool MDSSAInfo::isUseReachable(IN UseDefMgr * usedefmgr, IR const* exp)
{
    ASSERT0(usedefmgr && exp && exp->is_exp());
    SEGIter * iter = NULL;
    for (INT i = getVOpndSet()->get_first(&iter);
         i >= 0; i = getVOpndSet()->get_next(i, &iter)) {
        VMD * vopnd = (VMD*)usedefmgr->getVOpnd(i);
        ASSERT0(vopnd && vopnd->is_md());
        if (!vopnd->getOccSet()->is_contain(exp->id())) {
            return false;
        }
    }
    return true;
}
Exemple #3
0
//Facility function to make it easier to get the VOpnd of operand of PHI.
VMD * MDPhi::getOpndVMD(IR const* opnd, UseDefMgr const* mgr) const
{
    ASSERT(xcom::in_list(getOpndList(), opnd), ("not operand of phi"));
    if (!opnd->is_id() && opnd->isMemoryOpnd()) { return NULL; }

    ASSERT0(mgr && mgr->getMDSSAInfo(opnd) &&
        mgr->getMDSSAInfo(opnd)->getVOpndSet()->get_elem_count() == 1);

    SEGIter * iter;
    VMD * vopnd = (VMD*)mgr->getVOpnd(mgr->getMDSSAInfo(opnd)->
        getVOpndSet()->get_first(&iter));
    ASSERT0(vopnd->is_md());
    return vopnd;
}
Exemple #4
0
//Collect all USE, where USE is IR expression.
void MDSSAInfo::collectUse(
        OUT DefSBitSetCore & set,
        IN UseDefMgr * usedefmgr,
        IN DefMiscBitSetMgr * bsmgr)
{
    ASSERT0(usedefmgr && bsmgr);
    SEGIter * iter = NULL;
    Region * rg = usedefmgr->getRegion();
    for (INT i = getVOpndSet()->get_first(&iter);
         i >= 0; i = getVOpndSet()->get_next(i, &iter)) {
        VMD * vopnd = (VMD*)usedefmgr->getVOpnd(i);
        ASSERT0(vopnd && vopnd->is_md());

        SEGIter * vit = NULL;
        for (INT i2 = vopnd->getOccSet()->get_first(&vit);
            i2 >= 0; i2 = vopnd->getOccSet()->get_next(i2, &vit)) {
            IR * use = rg->getIR(i2);
            ASSERT0(use && (use->isMemoryRef() || use->is_id()));
            set.bunion(use->id(), *bsmgr);
        }
    }
}