From 85767882450cdd4d18cdcfabe6a936bef37cdab7 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 11 Jul 2009 14:19:21 +0200 Subject: [PATCH] Get rid of USE_METADATA --- gen/main.cpp | 2 -- gen/metadata.h | 1 - gen/optimizer.cpp | 6 ------ gen/passes/GarbageCollect2Stack.cpp | 8 -------- gen/passes/Passes.h | 2 -- gen/passes/StripMetaData.cpp | 8 -------- gen/typinf.cpp | 2 -- ir/irclass.cpp | 3 --- 8 files changed, 32 deletions(-) diff --git a/gen/main.cpp b/gen/main.cpp index 23802795..6079a436 100644 --- a/gen/main.cpp +++ b/gen/main.cpp @@ -921,13 +921,11 @@ LDC_TARGETS std::string errormsg; for (int i = 0; i < llvmModules.size(); i++) { -#ifdef USE_METADATA //FIXME: workaround for llvm metadata bug: // the LinkInModule call asserts with metadata unstripped llvm::ModulePass* stripMD = createStripMetaData(); stripMD->runOnModule(*llvmModules[i]); delete stripMD; -#endif if(linker.LinkInModule(llvmModules[i], &errormsg)) error("%s", errormsg.c_str()); diff --git a/gen/metadata.h b/gen/metadata.h index 035d16ee..f7f6b2ff 100644 --- a/gen/metadata.h +++ b/gen/metadata.h @@ -15,7 +15,6 @@ return N->getElement(i); } -#define USE_METADATA #define METADATA_LINKAGE_TYPE llvm::GlobalValue::WeakODRLinkage // *** Metadata for TypeInfo instances *** diff --git a/gen/optimizer.cpp b/gen/optimizer.cpp index 5e1e8624..7a8c70ab 100644 --- a/gen/optimizer.cpp +++ b/gen/optimizer.cpp @@ -53,7 +53,6 @@ disableSimplifyRuntimeCalls("disable-simplify-drtcalls", cl::desc("Disable simplification of runtime calls in -O"), cl::ZeroOrMore); -#ifdef USE_METADATA static cl::opt disableGCToStack("disable-gc2stack", cl::desc("Disable promotion of GC allocations to stack memory in -O"), @@ -64,7 +63,6 @@ static cl::opt disableStripMetaData("disable-strip-metadata", cl::desc("Disable default metadata stripping (not recommended)"), cl::ZeroOrMore); -#endif static cl::opt enableInlining("inlining", @@ -225,7 +223,6 @@ static void addPassesForOptLevel(PassManager& pm) { bool ldc_optimize_module(llvm::Module* m) { if (!optimize()) { -#ifdef USE_METADATA if (!disableStripMetaData) { // This one always needs to run if metadata is generated, because // the code generator will assert if it's not used. @@ -233,7 +230,6 @@ bool ldc_optimize_module(llvm::Module* m) stripMD->runOnModule(*m); delete stripMD; } -#endif return false; } @@ -272,13 +268,11 @@ bool ldc_optimize_module(llvm::Module* m) if (optimize) addPassesForOptLevel(pm); -#ifdef USE_METADATA if (!disableStripMetaData) { // This one is purposely not disabled by disableLangSpecificPasses // because the code generator will assert if it's not used. addPass(pm, createStripMetaData()); } -#endif pm.run(*m); return true; diff --git a/gen/passes/GarbageCollect2Stack.cpp b/gen/passes/GarbageCollect2Stack.cpp index 42123e5d..298274e3 100644 --- a/gen/passes/GarbageCollect2Stack.cpp +++ b/gen/passes/GarbageCollect2Stack.cpp @@ -14,11 +14,6 @@ #include "gen/metadata.h" -// This pass doesn't work without metadata, so #ifdef it out entirely if the -// LLVM version in use doesn't support it. -#ifdef USE_METADATA - - #define DEBUG_TYPE "dgc2stack" #include "Passes.h" @@ -647,6 +642,3 @@ bool isSafeToStackAllocate(Instruction* Alloc, DominatorTree& DT) { // All uses examined - not captured or live across original allocation. return true; } - - -#endif //USE_METADATA diff --git a/gen/passes/Passes.h b/gen/passes/Passes.h index 5b2758cb..29e9df21 100644 --- a/gen/passes/Passes.h +++ b/gen/passes/Passes.h @@ -10,10 +10,8 @@ namespace llvm { // Performs simplifications on runtime calls. llvm::FunctionPass* createSimplifyDRuntimeCalls(); -#ifdef USE_METADATA llvm::FunctionPass* createGarbageCollect2Stack(); llvm::ModulePass* createStripMetaData(); -#endif llvm::ModulePass* createStripExternalsPass(); diff --git a/gen/passes/StripMetaData.cpp b/gen/passes/StripMetaData.cpp index ba12a86f..4031271c 100644 --- a/gen/passes/StripMetaData.cpp +++ b/gen/passes/StripMetaData.cpp @@ -19,11 +19,6 @@ #include "gen/metadata.h" -// This pass isn't needed without metadata, so #ifdef it out entirely if the -// LLVM version in use doesn't support it. -#ifdef USE_METADATA - - #define DEBUG_TYPE "strip-metadata" #include "Passes.h" @@ -79,6 +74,3 @@ bool StripMetaData::runOnModule(Module &M) { } return Changed; } - - -#endif //USE_METADATA diff --git a/gen/typinf.cpp b/gen/typinf.cpp index 80a7ef26..62c4d08f 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -303,7 +303,6 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid) tid->ir.irGlobal = irg; -#ifdef USE_METADATA // Add some metadata for use by optimization passes. std::string metaname = std::string(TD_PREFIX) + mangle; LLGlobalVariable* meta = gIR->module->getGlobalVariable(metaname); @@ -321,7 +320,6 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid) new llvm::GlobalVariable(*gIR->module, metadata->getType(), true, METADATA_LINKAGE_TYPE, metadata, metaname); } -#endif DtoDeclareTypeInfo(tid); } diff --git a/ir/irclass.cpp b/ir/irclass.cpp index ca174b2b..c9fcf6ea 100644 --- a/ir/irclass.cpp +++ b/ir/irclass.cpp @@ -71,9 +71,7 @@ LLGlobalVariable * IrStruct::getClassInfoSymbol() classInfo = new llvm::GlobalVariable( *gIR->module, tc->getPA().get(), false, _linkage, NULL, initname); -#ifdef USE_METADATA // Generate some metadata on this ClassInfo if it's for a class. - ClassDeclaration* classdecl = aggrdecl->isClassDeclaration(); if (classdecl && !aggrdecl->isInterfaceDeclaration()) { // Gather information @@ -92,7 +90,6 @@ LLGlobalVariable * IrStruct::getClassInfoSymbol() new llvm::GlobalVariable(*gIR->module, metadata->getType(), true, METADATA_LINKAGE_TYPE, metadata, CD_PREFIX + initname); } -#endif return classInfo; }