コード例 #1
0
ファイル: dex_util.cpp プロジェクト: Grainspring/xoc
void DEX_REGION::update_ra_res(IN RA & ra, OUT PRNO2UINT & prno2v)
{
	prno2v.maxreg = ra.get_maxreg();
	prno2v.paramnum = ra.get_paramnum();
	GLTM * gltm = ra.get_gltm();
	IR_BB_LIST * bbl = get_bb_list();
	prno2v.clean();
	for (IR_BB * bb = bbl->get_head(); bb != NULL; bb = bbl->get_next()) {
		LTM * ltm = gltm->map_bb2ltm(bb);
		if (ltm == NULL) { continue; }
		SVECTOR<LT*> * lvec = ltm->get_lt_vec();
		for (INT i = 0; i <= lvec->get_last_idx(); i++) {
			LT * l = lvec->get(i);
			if (l == NULL) { continue; }
			IS_TRUE0(l->has_allocated());
			bool find;
			UINT v = prno2v.get(LT_prno(l), &find);
			if (find) {
				//each prno is corresponding to a unqiue vreg.
				IS_TRUE0(v == LT_phy(l));
			} else {
				prno2v.set(LT_prno(l), LT_phy(l));
			}
		}
	}
	prno2v.dump();
	IS_TRUE0(verify_ra_res(ra, prno2v));
}
コード例 #2
0
ファイル: dex_util.cpp プロジェクト: Grainspring/xoc
//All global prs must be mapped.
bool DEX_REGION::verify_ra_res(RA & ra, PRNO2UINT & prno2v)
{
	GLTM * gltm = ra.get_gltm();
	SVECTOR<GLT*> * gltv = gltm->get_gltvec();
	for (UINT i = 0; i < gltm->get_num_of_glt(); i++) {
		GLT * g = gltv->get(i);
		if (g == NULL) { continue; }
		IS_TRUE0(g->has_allocated());
		if (GLT_bbs(g) == NULL) {
			//parameter may be have no occ.
			continue;
		}
		bool find;
		prno2v.get(GLT_prno(g), &find);
		IS_TRUE0(find);
	}

	IR_BB_LIST * bbl = get_bb_list();
	for (IR_BB * bb = bbl->get_head(); bb != NULL; bb = bbl->get_next()) {
		LTM * ltm = gltm->map_bb2ltm(bb);
		if (ltm == NULL) { continue; }
		SVECTOR<LT*> * lvec = ltm->get_lt_vec();
		for (INT i = 0; i <= lvec->get_last_idx(); i++) {
			LT * l = lvec->get(i);
			if (l == NULL) { continue; }
			IS_TRUE0(l->has_allocated());
			bool find;
			prno2v.get(LT_prno(l), &find);
			IS_TRUE0(find);
		}
	}
	return true;
}
コード例 #3
0
ファイル: dex_region.cpp プロジェクト: clear-wing/xoc
void DexRegion::updateRAresult(IN RA & ra, OUT Prno2Vreg & prno2v)
{
    prno2v.maxreg = ra.get_maxreg();
    prno2v.paramnum = ra.get_paramnum();
    GltMgr * gltm = ra.get_gltm();
    BBList * bbl = getBBList();
    prno2v.clean();
    for (IRBB * bb = bbl->get_head(); bb != NULL; bb = bbl->get_next()) {
        LTMgr * ltm = gltm->map_bb2ltm(bb);
        if (ltm == NULL) { continue; }
        Vector<LT*> * lvec = ltm->get_lt_vec();
        for (INT i = 0; i <= lvec->get_last_idx(); i++) {
            LT * l = lvec->get(i);
            if (l == NULL) { continue; }
            ASSERT0(l->has_allocated());
            bool find;
            UINT v = prno2v.get(LT_prno(l), &find);
            if (find) {
                //each prno is corresponding to a unqiue vreg.
                ASSERT0(v == LT_phy(l));
            } else {
                prno2v.set(LT_prno(l), LT_phy(l));
            }
        }
    }
    //prno2v.dump();
    ASSERT0(verifyRAresult(ra, prno2v));
}
コード例 #4
0
ファイル: dex_region.cpp プロジェクト: clear-wing/xoc
//All global prs must be mapped.
bool DexRegion::verifyRAresult(RA & ra, Prno2Vreg & prno2v)
{
    GltMgr * gltm = ra.get_gltm();
    Vector<GLT*> * gltv = gltm->get_gltvec();
    for (UINT i = 0; i < gltm->get_num_of_glt(); i++) {
        GLT * g = gltv->get(i);
        if (g == NULL) { continue; }
        ASSERT0(g->has_allocated());
        if (GLT_bbs(g) == NULL) {
            //parameter may be have no occ.
            continue;
        }
        bool find;
        prno2v.get(GLT_prno(g), &find);
        ASSERT0(find);
    }

    BBList * bbl = getBBList();
    for (IRBB * bb = bbl->get_head(); bb != NULL; bb = bbl->get_next()) {
        LTMgr * ltm = gltm->map_bb2ltm(bb);
        if (ltm == NULL) { continue; }
        Vector<LT*> * lvec = ltm->get_lt_vec();
        for (INT i = 0; i <= lvec->get_last_idx(); i++) {
            LT * l = lvec->get(i);
            if (l == NULL) { continue; }
            ASSERT0(l->has_allocated());
            bool find;
            prno2v.get(LT_prno(l), &find);
            ASSERT0(find);
        }
    }
    return true;
}
コード例 #5
0
ファイル: egzamin_B2.cpp プロジェクト: newman93/Nauka
int main()
{
	try
	{
		LT obj;
		list<Towar> result;
		Towar t_1("laptop", "elektronika", 2500.50, "1225");
		Towar t_2("netbook", "elektronika", 3300.50, "1225");
		Towar t_3("krzeslo", "meble", 100, "3345");
		Towar t_4("krzem", "pierwiastek", 50.25, "6678");
		Towar t_5("krzesiwo", "przedmiot", 50.25, "3320");
		obj.dodaj(t_1);
		obj.dodaj(t_2);
		obj.dodaj(t_3);
		obj.dodaj(t_4);
		obj.dodaj(t_5);
		obj.pokaz();
		if (obj.usun("3345"))
			cout << "Usunieto" <<  endl;
		else
			cout << "Nie usunieto" << endl;
		obj.pokaz();
		obj.szukaj("krze", result);
		cout << "Result" << endl;
		for (list<Towar>::iterator it = result.begin(); it != result.end(); ++it)
			cout << it->getNazwa() << " " << it->getKategoria() << " " << it->getKod() << " " << it->getCena() << endl;
	}
	catch(...)
	{
		cout << "Wyjatek!" << endl;
	}
	
	return 0;
}