From 01095a5d43bbfde13731688ddcf6048ebb8b7721 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 23 Jul 2016 20:41:05 +0000 Subject: Vendor import of llvm release_39 branch r276489: https://llvm.org/svn/llvm-project/llvm/branches/release_39@276489 --- lib/Target/TargetMachineC.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'lib/Target/TargetMachineC.cpp') 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(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 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, -- cgit v1.3