aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
diff options
context:
space:
mode:
authorAditya Nandakumar <aditya_nandakumar@apple.com>2014-11-13 09:26:31 +0000
committerAditya Nandakumar <aditya_nandakumar@apple.com>2014-11-13 09:26:31 +0000
commita27193297f76d9847ec6c62042444a0c69b7dac7 (patch)
treeba5bf0e2f6265070a71090a97cc6ffb94b320b2d /llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
parent8e586617c462178145cad3563bcfd7e9c30fdf67 (diff)
downloadllvm-a27193297f76d9847ec6c62042444a0c69b7dac7.zip
llvm-a27193297f76d9847ec6c62042444a0c69b7dac7.tar.gz
llvm-a27193297f76d9847ec6c62042444a0c69b7dac7.tar.bz2
This patch changes the ownership of TLOF from TargetLoweringBase to TargetMachine so that different subtargets could share the TLOF effectively
llvm-svn: 221878
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetMachine.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
index b0bfaab..6e4c907 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "PPCTargetMachine.h"
+#include "PPCTargetObjectFile.h"
#include "PPC.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/Function.h"
@@ -60,6 +61,15 @@ static std::string computeFSAdditions(StringRef FS, CodeGenOpt::Level OL, String
return FullFS;
}
+static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
+ // If it isn't a Mach-O file then it's going to be a linux ELF
+ // object file.
+ if (TT.isOSDarwin())
+ return make_unique<TargetLoweringObjectFileMachO>();
+
+ return make_unique<PPC64LinuxTargetObjectFile>();
+}
+
// The FeatureString here is a little subtle. We are modifying the feature string
// with what are (currently) non-function specific overrides as it goes into the
// LLVMTargetMachine constructor and then using the stored value in the
@@ -70,6 +80,7 @@ PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT, StringRef CPU,
CodeGenOpt::Level OL)
: LLVMTargetMachine(T, TT, CPU, computeFSAdditions(FS, OL, TT), Options, RM,
CM, OL),
+ TLOF(createTLOF(Triple(getTargetTriple()))),
Subtarget(TT, CPU, TargetFS, *this) {
initAsmInfo();
}