From 0a7eec400ff070b43dd4e46e216e67d7c339b867 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sun, 2 Jun 2013 18:41:59 +0200 Subject: [PATCH] Removed dead global initializer code. --- gen/llvmhelpers.cpp | 45 --------------------------------------------- gen/llvmhelpers.h | 3 --- 2 files changed, 48 deletions(-) diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index c36d5641..cfd88b63 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -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(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 diff --git a/gen/llvmhelpers.h b/gen/llvmhelpers.h index efd37be2..f5b89f8a 100644 --- a/gen/llvmhelpers.h +++ b/gen/llvmhelpers.h @@ -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);