mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-15 12:23:13 +01:00
Get rid of USE_METADATA
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
return N->getElement(i);
|
||||
}
|
||||
|
||||
#define USE_METADATA
|
||||
#define METADATA_LINKAGE_TYPE llvm::GlobalValue::WeakODRLinkage
|
||||
|
||||
// *** Metadata for TypeInfo instances ***
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user