Factor out some constants into the header so producers and consumers of

metadata stay in sync (and are more readable).
This commit is contained in:
Frits van Bommel
2009-05-02 20:42:58 +02:00
parent 2b18460169
commit c831367b24
3 changed files with 30 additions and 14 deletions

View File

@@ -197,7 +197,7 @@ const Type* GarbageCollect2Stack::getTypeFor(Value* typeinfo) {
DOUT << ">> Value: " << *ti_global << "\n";
DOUT << ">> Name: " << ti_global->getNameStr() << "\n");
std::string metaname = "llvm.ldc.typeinfo.";
std::string metaname = TD_PREFIX;
metaname.append(ti_global->getNameStart(), ti_global->getNameEnd());
DEBUG(DOUT << ">> Looking for global named " << metaname << "\n");
@@ -215,13 +215,13 @@ const Type* GarbageCollect2Stack::getTypeFor(Value* typeinfo) {
DEBUG(DOUT << ">> Found metadata node\n");
if (node->getNumOperands() != 2 ||
node->getOperand(0)->stripPointerCasts() != ti_global)
if (node->getNumOperands() != TD_NumFields ||
node->getOperand(TD_Confirm)->stripPointerCasts() != ti_global)
return NULL;
DEBUG(DOUT << ">> Validated metadata node\n");
return node->getOperand(1)->getType();
return node->getOperand(TD_Type)->getType();
}