More unification work.

This commit is contained in:
kai 2012-07-29 15:19:13 +02:00
parent e13b115583
commit 10a0bdf891
2 changed files with 27 additions and 0 deletions

View file

@ -321,11 +321,21 @@ int main(int argc, char** argv)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#if LDC_LLVM_VER >= 301
llvm::TargetOptions targetOptions;
// FIXME: Options here are { None, Less, Default, Aggressive } as defined http://llvm.org/docs/doxygen/html/namespacellvm_1_1CodeGenOpt.html
llvm::CodeGenOpt::Level codeGenOptLevel = llvm::CodeGenOpt::None; // I am setting this to None for the moment as I dont know how this changes generation
#endif
Array* libs; Array* libs;
if (global.params.symdebug) if (global.params.symdebug)
{ {
libs = global.params.debuglibnames; libs = global.params.debuglibnames;
#if LDC_LLVM_VER == 300
llvm::NoFramePointerElim = true; llvm::NoFramePointerElim = true;
#else
targetOptions.NoFramePointerElim = true;
#endif
} }
else else
libs = global.params.defaultlibnames; libs = global.params.defaultlibnames;
@ -531,8 +541,21 @@ int main(int argc, char** argv)
//assert(target.get() && "Could not allocate target machine!"); //assert(target.get() && "Could not allocate target machine!");
//gTargetMachine = target.get(); //gTargetMachine = target.get();
#if LDC_LLVM_VER == 300
llvm::TargetMachine* target = theTarget->createTargetMachine(triple, mCPU, FeaturesStr, llvm::TargetMachine* target = theTarget->createTargetMachine(triple, mCPU, FeaturesStr,
mRelocModel, mCodeModel); mRelocModel, mCodeModel);
#else
llvm::TargetMachine * target = theTarget->createTargetMachine(
llvm::StringRef(triple),
llvm::StringRef(mCPU),
llvm::StringRef(FeaturesStr),
targetOptions,
mRelocModel,
mCodeModel,
codeGenOptLevel
);
#endif
gTargetMachine = target; gTargetMachine = target;
gTargetData = target->getTargetData(); gTargetData = target->getTargetData();

View file

@ -13,7 +13,11 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#if LDC_LLVM_VER == 300
IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, unsigned a) : type(t) IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, unsigned a) : type(t)
#else
IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, llvm::Attributes a) : type(t)
#endif
{ {
ltype = t != Type::tvoid && bref ? DtoType(t->pointerTo()) : DtoType(t); ltype = t != Type::tvoid && bref ? DtoType(t->pointerTo()) : DtoType(t);
attrs = a; attrs = a;