コード例 #1
0
ファイル: mdssainfo.cpp プロジェクト: clear-wing/xoc
//Allocate MDPhi and initialize with the number of operands.
//Each operands has zero version to mdid.
MDPhi * UseDefMgr::allocMDPhi(UINT mdid, UINT num_operands)
{
    ASSERT0(mdid > 0 && num_operands > 0);

    MDPhi * phi = (MDPhi*)smpoolMallocConstSize(sizeof(MDPhi), m_phi_pool);
    phi->init();
    MDDEF_id(phi) = m_def_count++;
    m_def_vec.set(MDDEF_id(phi), phi);
    VMD const* vmd = allocVMD(mdid, 0);
    ASSERT0(vmd);

    MD const* md = m_md_sys->getMD(mdid);
    ASSERT0(md);
    IR * last = NULL;
    for (UINT i = 0; i < num_operands; i++) {
        IR * opnd = m_ru->buildId(md->get_base());
        opnd->setRefMD(md, m_ru);

        MDSSAInfo * mdssainfo = genMDSSAInfo(opnd);

        ASSERT0(m_sbs_mgr);
        mdssainfo->getVOpndSet()->append(vmd, *m_sbs_mgr);

        xcom::add_next(&MDPHI_opnd_list(phi), &last, opnd);

        ID_phi(opnd) = phi;
    }
    return phi;
}