From 10a0bdf89139b9587687bf62299159ff18fc6446 Mon Sep 17 00:00:00 2001 From: kai Date: Sun, 29 Jul 2012 15:19:13 +0200 Subject: [PATCH] More unification work. --- driver/main.cpp | 23 +++++++++++++++++++++++ ir/irfunction.cpp | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/driver/main.cpp b/driver/main.cpp index 732f50d1..62132890 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -321,11 +321,21 @@ int main(int argc, char** argv) 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; if (global.params.symdebug) { libs = global.params.debuglibnames; +#if LDC_LLVM_VER == 300 llvm::NoFramePointerElim = true; +#else + targetOptions.NoFramePointerElim = true; +#endif } else libs = global.params.defaultlibnames; @@ -531,8 +541,21 @@ int main(int argc, char** argv) //assert(target.get() && "Could not allocate target machine!"); //gTargetMachine = target.get(); +#if LDC_LLVM_VER == 300 llvm::TargetMachine* target = theTarget->createTargetMachine(triple, mCPU, FeaturesStr, mRelocModel, mCodeModel); +#else + llvm::TargetMachine * target = theTarget->createTargetMachine( + llvm::StringRef(triple), + llvm::StringRef(mCPU), + llvm::StringRef(FeaturesStr), + targetOptions, + mRelocModel, + mCodeModel, + codeGenOptLevel + ); +#endif + gTargetMachine = target; gTargetData = target->getTargetData(); diff --git a/ir/irfunction.cpp b/ir/irfunction.cpp index 8a391435..e78d1eed 100644 --- a/ir/irfunction.cpp +++ b/ir/irfunction.cpp @@ -13,7 +13,11 @@ ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// +#if LDC_LLVM_VER == 300 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); attrs = a;