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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user