diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2018-01-22 17:01:36 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2018-01-24 07:18:01 -0800 |
| commit | 03f86ae9829a0a5c6f4fbef0530809b1d24ede3c (patch) | |
| tree | ad47557d75f33c57b4053805f7438ba7914512bb /src/rustllvm/PassWrapper.cpp | |
| parent | fdecb0564b86f6876124903a05e590e929532039 (diff) | |
| download | rust-03f86ae9829a0a5c6f4fbef0530809b1d24ede3c.tar.gz rust-03f86ae9829a0a5c6f4fbef0530809b1d24ede3c.zip | |
llvm6: CodeModel::{JIT,}Default no longer exists
LLVM has since removed the `CodeModel::Default` enum value in favor of an `Optional` implementationg throughout LLVM. Let's mirror the same change in Rust and update the various bindings we call accordingly. Removed in llvm-mirror/llvm@9aafb854c
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
| -rw-r--r-- | src/rustllvm/PassWrapper.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 54a73a04bfa..b501f6150be 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -23,9 +23,14 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Host.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Target/TargetSubtargetInfo.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" +#if LLVM_VERSION_GE(6, 0) +#include "llvm/CodeGen/TargetSubtargetInfo.h" +#else +#include "llvm/Target/TargetSubtargetInfo.h" +#endif + #if LLVM_VERSION_GE(4, 0) #include "llvm/Transforms/IPO/AlwaysInliner.h" #include "llvm/Transforms/IPO/FunctionImport.h" @@ -210,20 +215,15 @@ extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM, enum class LLVMRustCodeModel { Other, - Default, - JITDefault, Small, Kernel, Medium, Large, + None, }; static CodeModel::Model fromRust(LLVMRustCodeModel Model) { switch (Model) { - case LLVMRustCodeModel::Default: - return CodeModel::Default; - case LLVMRustCodeModel::JITDefault: - return CodeModel::JITDefault; case LLVMRustCodeModel::Small: return CodeModel::Small; case LLVMRustCodeModel::Kernel: @@ -360,7 +360,6 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( bool TrapUnreachable, bool Singlethread) { - auto CM = fromRust(RustCM); auto OptLevel = fromRust(RustOptLevel); auto RM = fromRust(RustReloc); @@ -399,6 +398,13 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( Options.ThreadModel = ThreadModel::Single; } +#if LLVM_VERSION_GE(6, 0) + Optional<CodeModel::Model> CM; +#else + CodeModel::Model CM = CodeModel::Model::Default; +#endif + if (RustCM != LLVMRustCodeModel::None) + CM = fromRust(RustCM); TargetMachine *TM = TheTarget->createTargetMachine( Trip.getTriple(), RealCPU, Feature, Options, RM, CM, OptLevel); return wrap(TM); |
