mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-13 03:13:13 +01:00
Removed dead global initializer code.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user