diff options
Diffstat (limited to 'lib/Target/TargetMachineC.cpp')
-rw-r--r-- | lib/Target/TargetMachineC.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/Target/TargetMachineC.cpp b/lib/Target/TargetMachineC.cpp index f82566c37baa..02836eaf08e5 100644 --- a/lib/Target/TargetMachineC.cpp +++ b/lib/Target/TargetMachineC.cpp @@ -18,7 +18,7 @@ #include "llvm/IR/DataLayout.h" #include "llvm/IR/Module.h" #include "llvm/IR/LegacyPassManager.h" -#include "llvm/Support/CodeGen.h" +#include "llvm/Support/CodeGenCWrappers.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Host.h" @@ -32,15 +32,6 @@ using namespace llvm; -namespace llvm { -// Friend to the TargetMachine, access legacy API that are made private in C++ -struct C_API_PRIVATE_ACCESS { - static const DataLayout &getDataLayout(const TargetMachine &T) { - return T.getDataLayout(); - } -}; -} - static TargetMachine *unwrap(LLVMTargetMachineRef P) { return reinterpret_cast<TargetMachine *>(P); } @@ -114,7 +105,7 @@ LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T, const char* Triple, const char* CPU, const char* Features, LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc, LLVMCodeModel CodeModel) { - Reloc::Model RM; + Optional<Reloc::Model> RM; switch (Reloc){ case LLVMRelocStatic: RM = Reloc::Static; @@ -126,7 +117,6 @@ LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T, RM = Reloc::DynamicNoPIC; break; default: - RM = Reloc::Default; break; } @@ -175,16 +165,15 @@ char* LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T) { return strdup(StringRep.c_str()); } -/** Deprecated: use LLVMGetDataLayout(LLVMModuleRef M) instead. */ -LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T) { - return wrap(&C_API_PRIVATE_ACCESS::getDataLayout(*unwrap(T))); -} - void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T, LLVMBool VerboseAsm) { unwrap(T)->Options.MCOptions.AsmVerbose = VerboseAsm; } +LLVMTargetDataRef LLVMCreateTargetDataLayout(LLVMTargetMachineRef T) { + return wrap(new DataLayout(unwrap(T)->createDataLayout())); +} + static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M, raw_pwrite_stream &OS, LLVMCodeGenFileType codegen, |