diff --git a/builtins/dispatch.ll b/builtins/dispatch.ll index 3046b380..85825a58 100644 --- a/builtins/dispatch.ll +++ b/builtins/dispatch.ll @@ -104,6 +104,19 @@ ;; abort(); ;; } +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; LLVM has different IR for different versions since 3.7 + +define(`PTR_OP_ARGS', + ifelse(LLVM_VERSION, LLVM_3_7, + ``$1 , $1 * $2'', + ``$1 * $2'' + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + define i32 @__get_system_isa() nounwind uwtable { entry: %0 = tail call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 1) nounwind diff --git a/module.cpp b/module.cpp index 48e97b3f..6469bc11 100644 --- a/module.cpp +++ b/module.cpp @@ -1406,11 +1406,11 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine, pm.add(new llvm::DataLayout(*g->target->getDataLayout())); #elif defined(LLVM_3_5) pm.add(new llvm::DataLayoutPass(*g->target->getDataLayout())); -#else // LLVM 3.6+ +#elif defined(LLVM_3_6) llvm::DataLayoutPass *dlp= new llvm::DataLayoutPass(); dlp->doInitialization(*module); pm.add(dlp); -#endif +#endif // LLVM 3.7+ doesn't have DataLayoutPass anymore. llvm::formatted_raw_ostream fos(of->os()); diff --git a/opt.cpp b/opt.cpp index 93d9991a..23f2f00f 100644 --- a/opt.cpp +++ b/opt.cpp @@ -528,11 +528,11 @@ Optimize(llvm::Module *module, int optLevel) { optPM.add(new llvm::DataLayout(*g->target->getDataLayout())); #elif defined(LLVM_3_5) optPM.add(new llvm::DataLayoutPass(*g->target->getDataLayout())); -#else // LLVM 3.6+ +#elif defined(LLVM_3_6) llvm::DataLayoutPass *dlp= new llvm::DataLayoutPass(); dlp->doInitialization(*module); optPM.add(dlp); -#endif +#endif // LLVM 3.7+ doesn't have DataLayoutPass anymore. llvm::TargetMachine *targetMachine = g->target->GetTargetMachine();