mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-17 17:29:02 +02:00
[svn r172] moving all IR state previously stored in Dsymbol into IrDsymbol and a Dsymbol->IrDsymbol map
This commit is contained in:
140
gen/typinf.cpp
140
gen/typinf.cpp
@@ -250,21 +250,21 @@ void TypeInfoDeclaration::toObjFile()
|
||||
|
||||
void DtoResolveTypeInfo(TypeInfoDeclaration* tid)
|
||||
{
|
||||
if (tid->llvmResolved) return;
|
||||
tid->llvmResolved = true;
|
||||
if (gIR->irDsymbol[tid].resolved) return;
|
||||
gIR->irDsymbol[tid].resolved = true;
|
||||
|
||||
Logger::println("DtoResolveTypeInfo(%s)", tid->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
tid->irGlobal = new IrGlobal(tid);
|
||||
gIR->irDsymbol[tid].irGlobal = new IrGlobal(tid);
|
||||
|
||||
gIR->declareList.push_back(tid);
|
||||
}
|
||||
|
||||
void DtoDeclareTypeInfo(TypeInfoDeclaration* tid)
|
||||
{
|
||||
if (tid->llvmDeclared) return;
|
||||
tid->llvmDeclared = true;
|
||||
if (gIR->irDsymbol[tid].declared) return;
|
||||
gIR->irDsymbol[tid].declared = true;
|
||||
|
||||
Logger::println("DtoDeclareTypeInfo(%s)", tid->toChars());
|
||||
LOG_SCOPE;
|
||||
@@ -282,19 +282,19 @@ void DtoDeclareTypeInfo(TypeInfoDeclaration* tid)
|
||||
const llvm::Type* t = llvm::OpaqueType::get();
|
||||
llvm::GlobalVariable* g = new llvm::GlobalVariable(t, true, llvm::GlobalValue::ExternalLinkage, NULL, mangled, gIR->module);
|
||||
assert(g);
|
||||
/*if (!tid->irGlobal)
|
||||
tid->irGlobal = new IrGlobal(tid);*/
|
||||
tid->irGlobal->value = g;
|
||||
/*if (!gIR->irDsymbol[tid].irGlobal)
|
||||
gIR->irDsymbol[tid].irGlobal = new IrGlobal(tid);*/
|
||||
gIR->irDsymbol[tid].irGlobal->value = g;
|
||||
mangled.append("__TYPE");
|
||||
gIR->module->addTypeName(mangled, tid->irGlobal->value->getType()->getContainedType(0));
|
||||
Logger::println("Got typeinfo var: %s", tid->irGlobal->value->getName().c_str());
|
||||
tid->llvmInitialized = true;
|
||||
tid->llvmDefined = true;
|
||||
gIR->module->addTypeName(mangled, gIR->irDsymbol[tid].irGlobal->value->getType()->getContainedType(0));
|
||||
Logger::println("Got typeinfo var: %s", gIR->irDsymbol[tid].irGlobal->value->getName().c_str());
|
||||
gIR->irDsymbol[tid].initialized = true;
|
||||
gIR->irDsymbol[tid].defined = true;
|
||||
}
|
||||
else if (!tid->irGlobal->value) {
|
||||
tid->irGlobal->value = found;
|
||||
tid->llvmInitialized = true;
|
||||
tid->llvmDefined = true;
|
||||
else if (!gIR->irDsymbol[tid].irGlobal->value) {
|
||||
gIR->irDsymbol[tid].irGlobal->value = found;
|
||||
gIR->irDsymbol[tid].initialized = true;
|
||||
gIR->irDsymbol[tid].defined = true;
|
||||
}
|
||||
}
|
||||
// custom typedef
|
||||
@@ -306,8 +306,8 @@ void DtoDeclareTypeInfo(TypeInfoDeclaration* tid)
|
||||
|
||||
void DtoConstInitTypeInfo(TypeInfoDeclaration* tid)
|
||||
{
|
||||
if (tid->llvmInitialized) return;
|
||||
tid->llvmInitialized = true;
|
||||
if (gIR->irDsymbol[tid].initialized) return;
|
||||
gIR->irDsymbol[tid].initialized = true;
|
||||
|
||||
Logger::println("DtoConstInitTypeInfo(%s)", tid->toChars());
|
||||
LOG_SCOPE;
|
||||
@@ -317,8 +317,8 @@ void DtoConstInitTypeInfo(TypeInfoDeclaration* tid)
|
||||
|
||||
void DtoDefineTypeInfo(TypeInfoDeclaration* tid)
|
||||
{
|
||||
if (tid->llvmDefined) return;
|
||||
tid->llvmDefined = true;
|
||||
if (gIR->irDsymbol[tid].defined) return;
|
||||
gIR->irDsymbol[tid].defined = true;
|
||||
|
||||
Logger::println("DtoDefineTypeInfo(%s)", tid->toChars());
|
||||
LOG_SCOPE;
|
||||
@@ -356,7 +356,7 @@ void TypeInfoTypedefDeclaration::llvmDeclare()
|
||||
const llvm::StructType* stype = isaStruct(base->type->llvmType->get());
|
||||
|
||||
// create the symbol
|
||||
irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
gIR->irDsymbol[this].irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
}
|
||||
|
||||
void TypeInfoTypedefDeclaration::llvmDefine()
|
||||
@@ -372,7 +372,7 @@ void TypeInfoTypedefDeclaration::llvmDefine()
|
||||
|
||||
// vtbl
|
||||
std::vector<llvm::Constant*> sinits;
|
||||
sinits.push_back(base->irStruct->vtbl);
|
||||
sinits.push_back(gIR->irDsymbol[base].irStruct->vtbl);
|
||||
|
||||
// monitor
|
||||
sinits.push_back(getNullPtr(getPtrToType(llvm::Type::Int8Ty)));
|
||||
@@ -391,9 +391,9 @@ void TypeInfoTypedefDeclaration::llvmDefine()
|
||||
assert(sd->basetype->vtinfo);
|
||||
DtoForceDeclareDsymbol(sd->basetype->vtinfo);
|
||||
|
||||
assert(sd->basetype->vtinfo->irGlobal->value);
|
||||
assert(llvm::isa<llvm::Constant>(sd->basetype->vtinfo->irGlobal->value));
|
||||
llvm::Constant* castbase = llvm::cast<llvm::Constant>(sd->basetype->vtinfo->irGlobal->value);
|
||||
assert(gIR->irDsymbol[sd->basetype->vtinfo].irGlobal->value);
|
||||
assert(llvm::isa<llvm::Constant>(gIR->irDsymbol[sd->basetype->vtinfo].irGlobal->value));
|
||||
llvm::Constant* castbase = llvm::cast<llvm::Constant>(gIR->irDsymbol[sd->basetype->vtinfo].irGlobal->value);
|
||||
castbase = llvm::ConstantExpr::getBitCast(castbase, stype->getElementType(2));
|
||||
sinits.push_back(castbase);
|
||||
|
||||
@@ -421,7 +421,7 @@ void TypeInfoTypedefDeclaration::llvmDefine()
|
||||
|
||||
// create the symbol
|
||||
llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
|
||||
isaGlobalVar(irGlobal->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(gIR->irDsymbol[this].irGlobal->value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
void TypeInfoTypedefDeclaration::toDt(dt_t **pdt)
|
||||
@@ -442,7 +442,7 @@ void TypeInfoEnumDeclaration::llvmDeclare()
|
||||
const llvm::StructType* stype = isaStruct(base->type->llvmType->get());
|
||||
|
||||
// create the symbol
|
||||
irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
gIR->irDsymbol[this].irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
}
|
||||
|
||||
void TypeInfoEnumDeclaration::llvmDefine()
|
||||
@@ -457,7 +457,7 @@ void TypeInfoEnumDeclaration::llvmDefine()
|
||||
|
||||
// vtbl
|
||||
std::vector<llvm::Constant*> sinits;
|
||||
sinits.push_back(base->irStruct->vtbl);
|
||||
sinits.push_back(gIR->irDsymbol[base].irStruct->vtbl);
|
||||
|
||||
// monitor
|
||||
sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(llvm::Type::Int8Ty)));
|
||||
@@ -476,8 +476,8 @@ void TypeInfoEnumDeclaration::llvmDefine()
|
||||
assert(sd->memtype->vtinfo);
|
||||
DtoForceDeclareDsymbol(sd->memtype->vtinfo);
|
||||
|
||||
assert(llvm::isa<llvm::Constant>(sd->memtype->vtinfo->irGlobal->value));
|
||||
llvm::Constant* castbase = llvm::cast<llvm::Constant>(sd->memtype->vtinfo->irGlobal->value);
|
||||
assert(llvm::isa<llvm::Constant>(gIR->irDsymbol[sd->memtype->vtinfo].irGlobal->value));
|
||||
llvm::Constant* castbase = llvm::cast<llvm::Constant>(gIR->irDsymbol[sd->memtype->vtinfo].irGlobal->value);
|
||||
castbase = llvm::ConstantExpr::getBitCast(castbase, stype->getElementType(2));
|
||||
sinits.push_back(castbase);
|
||||
|
||||
@@ -506,7 +506,7 @@ void TypeInfoEnumDeclaration::llvmDefine()
|
||||
|
||||
// create the symbol
|
||||
llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
|
||||
isaGlobalVar(irGlobal->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(gIR->irDsymbol[this].irGlobal->value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
void TypeInfoEnumDeclaration::toDt(dt_t **pdt)
|
||||
@@ -524,7 +524,7 @@ static llvm::Constant* LLVM_D_Declare_TypeInfoBase(TypeInfoDeclaration* tid, Cla
|
||||
const llvm::StructType* stype = isaStruct(base->type->llvmType->get());
|
||||
|
||||
// create the symbol
|
||||
tid->irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,tid->toChars(),gIR->module);
|
||||
gIR->irDsymbol[tid].irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,tid->toChars(),gIR->module);
|
||||
}
|
||||
|
||||
static llvm::Constant* LLVM_D_Define_TypeInfoBase(Type* basetype, TypeInfoDeclaration* tid, ClassDeclaration* cd)
|
||||
@@ -536,7 +536,7 @@ static llvm::Constant* LLVM_D_Define_TypeInfoBase(Type* basetype, TypeInfoDeclar
|
||||
|
||||
// vtbl
|
||||
std::vector<llvm::Constant*> sinits;
|
||||
sinits.push_back(base->irStruct->vtbl);
|
||||
sinits.push_back(gIR->irDsymbol[base].irStruct->vtbl);
|
||||
|
||||
// monitor
|
||||
sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(llvm::Type::Int8Ty)));
|
||||
@@ -546,14 +546,14 @@ static llvm::Constant* LLVM_D_Define_TypeInfoBase(Type* basetype, TypeInfoDeclar
|
||||
basetype->getTypeInfo(NULL);
|
||||
assert(basetype->vtinfo);
|
||||
DtoForceDeclareDsymbol(basetype->vtinfo);
|
||||
assert(llvm::isa<llvm::Constant>(basetype->vtinfo->irGlobal->value));
|
||||
llvm::Constant* castbase = llvm::cast<llvm::Constant>(basetype->vtinfo->irGlobal->value);
|
||||
assert(llvm::isa<llvm::Constant>(gIR->irDsymbol[basetype->vtinfo].irGlobal->value));
|
||||
llvm::Constant* castbase = llvm::cast<llvm::Constant>(gIR->irDsymbol[basetype->vtinfo].irGlobal->value);
|
||||
castbase = llvm::ConstantExpr::getBitCast(castbase, stype->getElementType(2));
|
||||
sinits.push_back(castbase);
|
||||
|
||||
// create the symbol
|
||||
llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
|
||||
isaGlobalVar(tid->irGlobal->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(gIR->irDsymbol[tid].irGlobal->value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
@@ -629,7 +629,7 @@ void TypeInfoStaticArrayDeclaration::llvmDeclare()
|
||||
const llvm::StructType* stype = isaStruct(base->type->llvmType->get());
|
||||
|
||||
// create the symbol
|
||||
irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
gIR->irDsymbol[this].irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
}
|
||||
|
||||
void TypeInfoStaticArrayDeclaration::llvmDefine()
|
||||
@@ -647,7 +647,7 @@ void TypeInfoStaticArrayDeclaration::llvmDefine()
|
||||
// initializer vector
|
||||
std::vector<llvm::Constant*> sinits;
|
||||
// first is always the vtable
|
||||
sinits.push_back(base->irStruct->vtbl);
|
||||
sinits.push_back(gIR->irDsymbol[base].irStruct->vtbl);
|
||||
|
||||
// monitor
|
||||
sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(llvm::Type::Int8Ty)));
|
||||
@@ -660,7 +660,7 @@ void TypeInfoStaticArrayDeclaration::llvmDefine()
|
||||
// get symbol
|
||||
assert(tc->next->vtinfo);
|
||||
DtoForceDeclareDsymbol(tc->next->vtinfo);
|
||||
llvm::Constant* castbase = isaConstant(tc->next->vtinfo->irGlobal->value);
|
||||
llvm::Constant* castbase = isaConstant(gIR->irDsymbol[tc->next->vtinfo].irGlobal->value);
|
||||
castbase = llvm::ConstantExpr::getBitCast(castbase, stype->getElementType(2));
|
||||
sinits.push_back(castbase);
|
||||
|
||||
@@ -669,7 +669,7 @@ void TypeInfoStaticArrayDeclaration::llvmDefine()
|
||||
|
||||
// create the symbol
|
||||
llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
|
||||
isaGlobalVar(irGlobal->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(gIR->irDsymbol[this].irGlobal->value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
void TypeInfoStaticArrayDeclaration::toDt(dt_t **pdt)
|
||||
@@ -692,7 +692,7 @@ void TypeInfoAssociativeArrayDeclaration::llvmDeclare()
|
||||
const llvm::StructType* stype = isaStruct(base->type->llvmType->get());
|
||||
|
||||
// create the symbol
|
||||
irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
gIR->irDsymbol[this].irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
}
|
||||
|
||||
void TypeInfoAssociativeArrayDeclaration::llvmDefine()
|
||||
@@ -710,7 +710,7 @@ void TypeInfoAssociativeArrayDeclaration::llvmDefine()
|
||||
// initializer vector
|
||||
std::vector<llvm::Constant*> sinits;
|
||||
// first is always the vtable
|
||||
sinits.push_back(base->irStruct->vtbl);
|
||||
sinits.push_back(gIR->irDsymbol[base].irStruct->vtbl);
|
||||
|
||||
// monitor
|
||||
sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(llvm::Type::Int8Ty)));
|
||||
@@ -725,7 +725,7 @@ void TypeInfoAssociativeArrayDeclaration::llvmDefine()
|
||||
// get symbol
|
||||
assert(tc->next->vtinfo);
|
||||
DtoForceDeclareDsymbol(tc->next->vtinfo);
|
||||
llvm::Constant* castbase = isaConstant(tc->next->vtinfo->irGlobal->value);
|
||||
llvm::Constant* castbase = isaConstant(gIR->irDsymbol[tc->next->vtinfo].irGlobal->value);
|
||||
castbase = llvm::ConstantExpr::getBitCast(castbase, stype->getElementType(2));
|
||||
sinits.push_back(castbase);
|
||||
|
||||
@@ -735,13 +735,13 @@ void TypeInfoAssociativeArrayDeclaration::llvmDefine()
|
||||
// get symbol
|
||||
assert(tc->index->vtinfo);
|
||||
DtoForceDeclareDsymbol(tc->index->vtinfo);
|
||||
castbase = isaConstant(tc->index->vtinfo->irGlobal->value);
|
||||
castbase = isaConstant(gIR->irDsymbol[tc->index->vtinfo].irGlobal->value);
|
||||
castbase = llvm::ConstantExpr::getBitCast(castbase, stype->getElementType(3));
|
||||
sinits.push_back(castbase);
|
||||
|
||||
// create the symbol
|
||||
llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
|
||||
isaGlobalVar(irGlobal->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(gIR->irDsymbol[this].irGlobal->value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
void TypeInfoAssociativeArrayDeclaration::toDt(dt_t **pdt)
|
||||
@@ -825,7 +825,7 @@ void TypeInfoStructDeclaration::llvmDeclare()
|
||||
const llvm::StructType* stype = isaStruct(((TypeClass*)base->type)->llvmType->get());
|
||||
|
||||
// create the symbol
|
||||
irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
gIR->irDsymbol[this].irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
}
|
||||
|
||||
void TypeInfoStructDeclaration::llvmDefine()
|
||||
@@ -845,7 +845,7 @@ void TypeInfoStructDeclaration::llvmDefine()
|
||||
|
||||
// vtbl
|
||||
std::vector<llvm::Constant*> sinits;
|
||||
sinits.push_back(base->irStruct->vtbl);
|
||||
sinits.push_back(gIR->irDsymbol[base].irStruct->vtbl);
|
||||
|
||||
// monitor
|
||||
sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(llvm::Type::Int8Ty)));
|
||||
@@ -865,7 +865,7 @@ void TypeInfoStructDeclaration::llvmDefine()
|
||||
else
|
||||
{
|
||||
size_t cisize = getTypeStoreSize(tc->llvmType->get());
|
||||
llvm::Constant* cicast = llvm::ConstantExpr::getBitCast(sd->irStruct->init, initpt);
|
||||
llvm::Constant* cicast = llvm::ConstantExpr::getBitCast(gIR->irDsymbol[sd].irStruct->init, initpt);
|
||||
sinits.push_back(DtoConstSlice(DtoConstSize_t(cisize), cicast));
|
||||
}
|
||||
|
||||
@@ -925,8 +925,8 @@ void TypeInfoStructDeclaration::llvmDefine()
|
||||
fd = fdx->overloadExactMatch(tftohash);
|
||||
if (fd) {
|
||||
DtoForceDeclareDsymbol(fd);
|
||||
assert(gIR->irFunc[fd]->func != 0);
|
||||
llvm::Constant* c = isaConstant(gIR->irFunc[fd]->func);
|
||||
assert(gIR->irDsymbol[fd].irFunc->func != 0);
|
||||
llvm::Constant* c = isaConstant(gIR->irDsymbol[fd].irFunc->func);
|
||||
assert(c);
|
||||
c = llvm::ConstantExpr::getBitCast(c, ptty);
|
||||
sinits.push_back(c);
|
||||
@@ -951,8 +951,8 @@ void TypeInfoStructDeclaration::llvmDefine()
|
||||
fd = fdx->overloadExactMatch(tfeqptr);
|
||||
if (fd) {
|
||||
DtoForceDeclareDsymbol(fd);
|
||||
assert(gIR->irFunc[fd]->func != 0);
|
||||
llvm::Constant* c = isaConstant(gIR->irFunc[fd]->func);
|
||||
assert(gIR->irDsymbol[fd].irFunc->func != 0);
|
||||
llvm::Constant* c = isaConstant(gIR->irDsymbol[fd].irFunc->func);
|
||||
assert(c);
|
||||
c = llvm::ConstantExpr::getBitCast(c, ptty);
|
||||
sinits.push_back(c);
|
||||
@@ -979,8 +979,8 @@ void TypeInfoStructDeclaration::llvmDefine()
|
||||
fd = fdx->overloadExactMatch(tftostring);
|
||||
if (fd) {
|
||||
DtoForceDeclareDsymbol(fd);
|
||||
assert(gIR->irFunc[fd]->func != 0);
|
||||
llvm::Constant* c = isaConstant(gIR->irFunc[fd]->func);
|
||||
assert(gIR->irDsymbol[fd].irFunc->func != 0);
|
||||
llvm::Constant* c = isaConstant(gIR->irDsymbol[fd].irFunc->func);
|
||||
assert(c);
|
||||
c = llvm::ConstantExpr::getBitCast(c, ptty);
|
||||
sinits.push_back(c);
|
||||
@@ -1001,7 +1001,7 @@ void TypeInfoStructDeclaration::llvmDefine()
|
||||
llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
|
||||
llvm::GlobalVariable* gvar = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,tiInit,toChars(),gIR->module);
|
||||
|
||||
isaGlobalVar(irGlobal->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(gIR->irDsymbol[this].irGlobal->value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
void TypeInfoStructDeclaration::toDt(dt_t **pdt)
|
||||
@@ -1025,7 +1025,7 @@ void TypeInfoClassDeclaration::llvmDeclare()
|
||||
const llvm::StructType* stype = isaStruct(base->type->llvmType->get());
|
||||
|
||||
// create the symbol
|
||||
irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
gIR->irDsymbol[this].irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
}
|
||||
|
||||
void TypeInfoClassDeclaration::llvmDefine()
|
||||
@@ -1044,7 +1044,7 @@ void TypeInfoClassDeclaration::llvmDefine()
|
||||
// initializer vector
|
||||
std::vector<llvm::Constant*> sinits;
|
||||
// first is always the vtable
|
||||
sinits.push_back(base->irStruct->vtbl);
|
||||
sinits.push_back(gIR->irDsymbol[base].irStruct->vtbl);
|
||||
|
||||
// monitor
|
||||
sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(llvm::Type::Int8Ty)));
|
||||
@@ -1052,12 +1052,12 @@ void TypeInfoClassDeclaration::llvmDefine()
|
||||
// get classinfo
|
||||
assert(tinfo->ty == Tclass);
|
||||
TypeClass *tc = (TypeClass *)tinfo;
|
||||
assert(tc->sym->irStruct->classInfo);
|
||||
sinits.push_back(tc->sym->irStruct->classInfo);
|
||||
assert(gIR->irDsymbol[tc->sym].irStruct->classInfo);
|
||||
sinits.push_back(gIR->irDsymbol[tc->sym].irStruct->classInfo);
|
||||
|
||||
// create the symbol
|
||||
llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
|
||||
isaGlobalVar(irGlobal->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(gIR->irDsymbol[this].irGlobal->value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
void TypeInfoClassDeclaration::toDt(dt_t **pdt)
|
||||
@@ -1081,7 +1081,7 @@ void TypeInfoInterfaceDeclaration::llvmDeclare()
|
||||
const llvm::StructType* stype = isaStruct(base->type->llvmType->get());
|
||||
|
||||
// create the symbol
|
||||
irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
gIR->irDsymbol[this].irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
}
|
||||
|
||||
void TypeInfoInterfaceDeclaration::llvmDefine()
|
||||
@@ -1100,7 +1100,7 @@ void TypeInfoInterfaceDeclaration::llvmDefine()
|
||||
// initializer vector
|
||||
std::vector<llvm::Constant*> sinits;
|
||||
// first is always the vtable
|
||||
sinits.push_back(base->irStruct->vtbl);
|
||||
sinits.push_back(gIR->irDsymbol[base].irStruct->vtbl);
|
||||
|
||||
// monitor
|
||||
sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(llvm::Type::Int8Ty)));
|
||||
@@ -1108,12 +1108,12 @@ void TypeInfoInterfaceDeclaration::llvmDefine()
|
||||
// get classinfo
|
||||
assert(tinfo->ty == Tclass);
|
||||
TypeClass *tc = (TypeClass *)tinfo;
|
||||
assert(tc->sym->irStruct->classInfo);
|
||||
sinits.push_back(tc->sym->irStruct->classInfo);
|
||||
assert(gIR->irDsymbol[tc->sym].irStruct->classInfo);
|
||||
sinits.push_back(gIR->irDsymbol[tc->sym].irStruct->classInfo);
|
||||
|
||||
// create the symbol
|
||||
llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
|
||||
isaGlobalVar(irGlobal->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(gIR->irDsymbol[this].irGlobal->value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
void TypeInfoInterfaceDeclaration::toDt(dt_t **pdt)
|
||||
@@ -1137,7 +1137,7 @@ void TypeInfoTupleDeclaration::llvmDeclare()
|
||||
const llvm::StructType* stype = isaStruct(base->type->llvmType->get());
|
||||
|
||||
// create the symbol
|
||||
irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
gIR->irDsymbol[this].irGlobal->value = new llvm::GlobalVariable(stype,true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module);
|
||||
}
|
||||
|
||||
void TypeInfoTupleDeclaration::llvmDefine()
|
||||
@@ -1156,7 +1156,7 @@ void TypeInfoTupleDeclaration::llvmDefine()
|
||||
// initializer vector
|
||||
std::vector<llvm::Constant*> sinits;
|
||||
// first is always the vtable
|
||||
sinits.push_back(base->irStruct->vtbl);
|
||||
sinits.push_back(gIR->irDsymbol[base].irStruct->vtbl);
|
||||
|
||||
// monitor
|
||||
sinits.push_back(llvm::ConstantPointerNull::get(getPtrToType(llvm::Type::Int8Ty)));
|
||||
@@ -1176,8 +1176,8 @@ void TypeInfoTupleDeclaration::llvmDefine()
|
||||
Argument *arg = (Argument *)tu->arguments->data[i];
|
||||
arg->type->getTypeInfo(NULL);
|
||||
DtoForceDeclareDsymbol(arg->type->vtinfo);
|
||||
assert(arg->type->vtinfo->irGlobal->value);
|
||||
llvm::Constant* c = isaConstant(arg->type->vtinfo->irGlobal->value);
|
||||
assert(gIR->irDsymbol[arg->type->vtinfo].irGlobal->value);
|
||||
llvm::Constant* c = isaConstant(gIR->irDsymbol[arg->type->vtinfo].irGlobal->value);
|
||||
c = llvm::ConstantExpr::getBitCast(c, tiTy);
|
||||
arrInits.push_back(c);
|
||||
}
|
||||
@@ -1192,7 +1192,7 @@ void TypeInfoTupleDeclaration::llvmDefine()
|
||||
|
||||
// create the symbol
|
||||
llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
|
||||
isaGlobalVar(irGlobal->value)->setInitializer(tiInit);
|
||||
isaGlobalVar(gIR->irDsymbol[this].irGlobal->value)->setInitializer(tiInit);
|
||||
}
|
||||
|
||||
void TypeInfoTupleDeclaration::toDt(dt_t **pdt)
|
||||
|
||||
Reference in New Issue
Block a user