Get rid of USE_METADATA

This commit is contained in:
Benjamin Kramer
2009-07-11 14:19:21 +02:00
parent 45f7401a5b
commit 8576788245
8 changed files with 0 additions and 32 deletions

View File

@@ -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());

View File

@@ -15,7 +15,6 @@
return N->getElement(i);
}
#define USE_METADATA
#define METADATA_LINKAGE_TYPE llvm::GlobalValue::WeakODRLinkage
// *** Metadata for TypeInfo instances ***

View File

@@ -53,7 +53,6 @@ disableSimplifyRuntimeCalls("disable-simplify-drtcalls",
cl::desc("Disable simplification of runtime calls in -O<N>"),
cl::ZeroOrMore);
#ifdef USE_METADATA
static cl::opt<bool>
disableGCToStack("disable-gc2stack",
cl::desc("Disable promotion of GC allocations to stack memory in -O<N>"),
@@ -64,7 +63,6 @@ static cl::opt<bool>
disableStripMetaData("disable-strip-metadata",
cl::desc("Disable default metadata stripping (not recommended)"),
cl::ZeroOrMore);
#endif
static cl::opt<opts::BoolOrDefaultAdapter, false, opts::FlagParser>
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;

View File

@@ -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

View File

@@ -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();

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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;
}