PeepHoleOpt::Changed PeepHoleOpt::handleInst_Call(Inst* inst)
{
    assert(inst->getMnemonic() == Mnemonic_CALL);
    CallInst* callInst = (CallInst*)inst;
    unsigned targetOpndIndex = callInst->getTargetOpndIndex();
    Opnd* targetOpnd = callInst->getOpnd(targetOpndIndex);
    Opnd::RuntimeInfo* ri = targetOpnd->getRuntimeInfo();
    Opnd::RuntimeInfo::Kind rt_kind = Opnd::RuntimeInfo::Kind_Null;
    if (ri != NULL) {
        rt_kind = ri->getKind();
    }

    if (Opnd::RuntimeInfo::Kind_InternalHelperAddress == rt_kind) {
        return handleInst_InternalHelperCall(inst, ri);
    }
    return Changed_Nothing;
}
Esempio n. 2
0
//All CALL insts except some special helpers that never cause stacktrace printing
bool InstUtils::instMustHaveBCMapping(Inst* inst) {
    if (!inst->hasKind(Inst::Kind_CallInst)) {
        return false;
    }
    CallInst* callInst = (CallInst*)inst;
    Opnd * targetOpnd=callInst->getOpnd(callInst->getTargetOpndIndex());
    Opnd* immOpnd = OpndUtils::findImmediateSource(targetOpnd);
    Opnd::RuntimeInfo * ri = immOpnd ? immOpnd->getRuntimeInfo() : NULL;
    if(!ri) {
        return true;
    } else if (ri->getKind() == Opnd::RuntimeInfo::Kind_InternalHelperAddress) { 
        return false;
    } else if (ri->getKind() == Opnd::RuntimeInfo::Kind_HelperAddress) { 
        VM_RT_SUPPORT helperId = (VM_RT_SUPPORT)(POINTER_SIZE_INT)ri->getValue(0);
        switch (helperId) {
            case VM_RT_GC_GET_TLS_BASE:
            case VM_RT_GC_SAFE_POINT:
                return false;
            default:
                break;
        }
    }
    return true;
}