Removed dead global initializer code.

This commit is contained in:
David Nadlinger
2013-06-02 18:41:59 +02:00
parent feeb5e95cc
commit 0a7eec400f
2 changed files with 0 additions and 48 deletions

View File

@@ -985,51 +985,6 @@ void DtoResolveDsymbol(Dsymbol* dsym)
}
}
//////////////////////////////////////////////////////////////////////////////////////////
void DtoConstInitGlobal(VarDeclaration* vd)
{
vd->codegen(Type::sir);
if (vd->ir.initialized) return;
vd->ir.initialized = gIR->dmodule;
Logger::println("DtoConstInitGlobal(%s) @ %s", vd->toChars(), vd->loc.toChars());
LOG_SCOPE;
// build the initializer
LLConstant* initVal = DtoConstInitializer(vd->loc, vd->type, vd->init);
// set the initializer if appropriate
IrGlobal* glob = vd->ir.irGlobal;
llvm::GlobalVariable* gvar = llvm::cast<llvm::GlobalVariable>(glob->value);
//if (LLStructType *st = isaStruct(glob->type)) {
// st->setBody(initVal);
//}
assert(!glob->constInit);
glob->constInit = initVal;
// assign the initializer
if (!(vd->storage_class & STCextern) && mustDefineSymbol(vd))
{
if (Logger::enabled())
{
Logger::println("setting initializer");
Logger::cout() << "global: " << *gvar << '\n';
#if 0
Logger::cout() << "init: " << *initVal << '\n';
#endif
}
gvar->setInitializer(initVal);
// do debug info
DtoDwarfGlobalVariable(gvar, vd);
}
}
/****************************************************************************************/
/*////////////////////////////////////////////////////////////////////////////////////////
// DECLARATION EXP HELPER

View File

@@ -108,9 +108,6 @@ TemplateInstance* DtoIsTemplateInstance(Dsymbol* s, bool checkLiteralOwner = fal
/// Dispatches as appropriate.
void DtoResolveDsymbol(Dsymbol* dsym);
/// Generates the constant initializer for a global variable.
void DtoConstInitGlobal(VarDeclaration* vd);
// declaration inside a declarationexp
void DtoVarDeclaration(VarDeclaration* var);
DValue* DtoDeclarationExp(Dsymbol* declaration);