diff options
| author | bors <bors@rust-lang.org> | 2020-05-17 21:22:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-17 21:22:48 +0000 |
| commit | 5f472813dfa3f4c380a7a24e350d3e6a5a66ae7c (patch) | |
| tree | 1f88e9eb84127e4efdc3c72a42b90656d4f05255 /src/rustllvm/PassWrapper.cpp | |
| parent | d79f1bd31a1401b5d08096fcdf9a9eb23ddf95df (diff) | |
| parent | 59187f97713b8c9d54a4697dfe736037ddc22f8a (diff) | |
| download | rust-5f472813dfa3f4c380a7a24e350d3e6a5a66ae7c.tar.gz rust-5f472813dfa3f4c380a7a24e350d3e6a5a66ae7c.zip | |
Auto merge of #72248 - petrochenkov:codemodel, r=Amanieu
Cleanup and document `-C code-model` r? @Amanieu
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
| -rw-r--r-- | src/rustllvm/PassWrapper.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index b17fa57c5c1..6c638c5453a 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -274,7 +274,7 @@ extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM, } enum class LLVMRustCodeModel { - Other, + Tiny, Small, Kernel, Medium, @@ -282,8 +282,10 @@ enum class LLVMRustCodeModel { None, }; -static CodeModel::Model fromRust(LLVMRustCodeModel Model) { +static Optional<CodeModel::Model> fromRust(LLVMRustCodeModel Model) { switch (Model) { + case LLVMRustCodeModel::Tiny: + return CodeModel::Tiny; case LLVMRustCodeModel::Small: return CodeModel::Small; case LLVMRustCodeModel::Kernel: @@ -292,6 +294,8 @@ static CodeModel::Model fromRust(LLVMRustCodeModel Model) { return CodeModel::Medium; case LLVMRustCodeModel::Large: return CodeModel::Large; + case LLVMRustCodeModel::None: + return None; default: report_fatal_error("Bad CodeModel."); } @@ -452,6 +456,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( auto OptLevel = fromRust(RustOptLevel); auto RM = fromRust(RustReloc); + auto CM = fromRust(RustCM); std::string Error; Triple Trip(Triple::normalize(TripleStr)); @@ -490,9 +495,6 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( Options.EmitStackSizeSection = EmitStackSizeSection; - Optional<CodeModel::Model> CM; - if (RustCM != LLVMRustCodeModel::None) - CM = fromRust(RustCM); TargetMachine *TM = TheTarget->createTargetMachine( Trip.getTriple(), CPU, Feature, Options, RM, CM, OptLevel); return wrap(TM); |
