Exemple #1
0
//
//START IR_EXPR_TAB
//
IR_EXPR_TAB::IR_EXPR_TAB(Region * ru)
{
    m_expr_count = 0;
    m_ru = ru;
    m_dm = ru->get_type_mgr();
    memset(m_level1_hash_tab, 0,
           sizeof(ExpRep*) * IR_EXPR_TAB_LEVEL1_HASH_BUCKET);
    m_pool = smpoolCreate(sizeof(ExpRep*) * 128, MEM_COMM);
    m_sc_pool = smpoolCreate(sizeof(SC<ExpRep*>) * 4, MEM_CONST_SIZE);
    m_ir_expr_lst.set_pool(m_sc_pool);
    m_md_set_mgr = ru->get_mds_mgr();
    m_bs_mgr = ru->get_bs_mgr();
}
Exemple #2
0
PassMgr::PassMgr(Region * ru)
{
    ASSERT0(ru);
    m_pool = smpoolCreate(sizeof(TimeInfo) * 4, MEM_COMM);
    m_ru = ru;
    m_rumgr = ru->get_region_mgr();
    m_tm = ru->get_type_mgr();
    ASSERT0(m_tm);
}
Exemple #3
0
//Malloc memory for tmp used.
void * tlloc(LONG size)
{
    if (size < 0 || size == 0) return NULL;
    if (g_pool_tmp_used == NULL) {
        g_pool_tmp_used = smpoolCreate(8, MEM_COMM);
    }
    void * p = smpoolMalloc(size, g_pool_tmp_used);
    if (p == NULL) return NULL;
    memset(p, 0, size);
    return p;
}
Exemple #4
0
//
//START UseDefMgr
//
UseDefMgr::UseDefMgr(Region * rg) : m_ru(rg)
{
    ASSERT0(m_ru);

    m_md_sys = m_ru->getMDSystem();
    m_sbs_mgr = m_ru->getMiscBitSetMgr();

    //Single List Core need user declared a mempool.
    m_vopnd_sc_pool = smpoolCreate(sizeof(SC<VOpnd*>) * 4, MEM_CONST_SIZE);
    m_phi_pool = smpoolCreate(sizeof(MDPhi) * 2, MEM_CONST_SIZE);
    m_def_pool = smpoolCreate(sizeof(MDDef) * 2, MEM_CONST_SIZE);
    m_defset_pool = smpoolCreate(sizeof(MDDefSet) * 2, MEM_CONST_SIZE);
    m_vconst_pool = smpoolCreate(sizeof(VConst)*2, MEM_CONST_SIZE);
    m_vmd_pool = smpoolCreate(sizeof(VMD)*2, MEM_CONST_SIZE);
    m_philist_pool = smpoolCreate(sizeof(MDPhiList)*2, MEM_CONST_SIZE);
    m_philist_sc_pool = smpoolCreate(sizeof(SC<MDPhi*>) * 4, MEM_CONST_SIZE);
    m_mdssainfo_pool = smpoolCreate(sizeof(MDSSAInfo)*2, MEM_CONST_SIZE);

    m_free_sc_list = NULL;
    m_def_count = 1;
    m_vopnd_count = 1;
}
Exemple #5
0
bool drLinearInit(void){
    if (g_d2d_used_pool == NULL) {
        g_d2d_used_pool = smpoolCreate(DEFAULT_ALLOC_SIZE, MEM_COMM);
    }
    return true;
}
Exemple #6
0
void UseDefMgr::cleanOrDestroy(bool is_reinit)
{
    ASSERT0(m_ru);

    for (INT i = 0; i <= m_vopnd_vec.get_last_idx(); i++) {
        VOpnd * v = m_vopnd_vec.get((UINT)i);
        if (v != NULL && v->is_md()) {
            ((VMD*)v)->destroy();
        }
    }

    for (INT i = 0; i <= m_def_vec.get_last_idx(); i++) {
        MDDef * d = m_def_vec.get((UINT)i);
        if (d != NULL && d->getNextSet() != NULL) {
            d->getNextSet()->clean(*m_sbs_mgr);
        }
    }

    for (INT i = 0; i <= m_mdssainfo_vec.get_last_idx(); i++) {
        MDSSAInfo * info = m_mdssainfo_vec.get((UINT)i);
        if (info != NULL) {
            info->destroy(*m_sbs_mgr);
        }
    }

    destroyMD2VMDVec();

    if (is_reinit) {
        m_map_md2vmd.destroy();
        m_map_md2vmd.init();
        m_philist_vec.clean();
        m_def_vec.clean();
        m_mdssainfo_vec.clean();
        m_vopnd_vec.clean();
        m_def_count = 1;
        m_vopnd_count = 1;
    }

    ASSERT0(m_vopnd_sc_pool);
    smpoolDelete(m_vopnd_sc_pool);

    ASSERT0(m_phi_pool);
    smpoolDelete(m_phi_pool);

    ASSERT0(m_def_pool);
    smpoolDelete(m_def_pool);

    ASSERT0(m_defset_pool);
    smpoolDelete(m_defset_pool);

    ASSERT0(m_vmd_pool);
    smpoolDelete(m_vmd_pool);

    ASSERT0(m_vconst_pool);
    smpoolDelete(m_vconst_pool);

    ASSERT0(m_philist_pool);
    smpoolDelete(m_philist_pool);

    ASSERT0(m_philist_sc_pool);
    smpoolDelete(m_philist_sc_pool);

    ASSERT0(m_mdssainfo_pool);
    smpoolDelete(m_mdssainfo_pool);

    if (is_reinit) {
        m_vopnd_sc_pool = smpoolCreate(sizeof(SC<VOpnd*>) * 4, MEM_CONST_SIZE);
        m_phi_pool = smpoolCreate(sizeof(MDPhi) * 2, MEM_CONST_SIZE);
        m_def_pool = smpoolCreate(sizeof(MDDef) * 2, MEM_CONST_SIZE);
        m_defset_pool = smpoolCreate(sizeof(MDDefSet) * 2, MEM_CONST_SIZE);
        m_vmd_pool = smpoolCreate(sizeof(VMD) * 2, MEM_CONST_SIZE);
        m_vconst_pool = smpoolCreate(sizeof(VConst)*2, MEM_CONST_SIZE);
        m_philist_pool = smpoolCreate(sizeof(MDPhiList)*2, MEM_CONST_SIZE);
        m_philist_sc_pool = smpoolCreate(sizeof(SC<MDPhi*>) * 4, MEM_CONST_SIZE);
        m_mdssainfo_pool = smpoolCreate(sizeof(MDSSAInfo)*4, MEM_CONST_SIZE);
    }
}