diff options
author | Eric Christopher <echristo@gmail.com> | 2015-02-17 06:45:15 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2015-02-17 06:45:15 +0000 |
commit | fee6aaf683edfdfc8e5d6ffd17821f7d52936a53 (patch) | |
tree | 06c72fa071d8e99e1e2de68c0269717960c39bc9 /llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | |
parent | 10c45464981b0e9c81d7549ed5f85e56cfe19072 (diff) | |
download | bcm5719-llvm-fee6aaf683edfdfc8e5d6ffd17821f7d52936a53.tar.gz bcm5719-llvm-fee6aaf683edfdfc8e5d6ffd17821f7d52936a53.zip |
Move ABI handling and 64-bitness to the PowerPC target machine.
This required changing how the computation of the ABI is handled
and how some of the checks for ABI/target are done.
llvm-svn: 229471
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index 04cb4f9979e..a81f7fbfc1c 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -123,6 +123,30 @@ static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) { return make_unique<PPC64LinuxTargetObjectFile>(); } +static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, + const TargetOptions &Options) { + if (Options.MCOptions.getABIName().startswith("elfv1")) + return PPCTargetMachine::PPC_ABI_ELFv1; + else if (Options.MCOptions.getABIName().startswith("elfv2")) + return PPCTargetMachine::PPC_ABI_ELFv2; + + assert(Options.MCOptions.getABIName().empty() && + "Unknown target-abi option!"); + + if (!TT.isMacOSX()) { + switch (TT.getArch()) { + case Triple::ppc64le: + return PPCTargetMachine::PPC_ABI_ELFv2; + case Triple::ppc64: + return PPCTargetMachine::PPC_ABI_ELFv1; + default: + // Fallthrough. + ; + } + } + return PPCTargetMachine::PPC_ABI_UNKNOWN; +} + // 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 @@ -134,6 +158,7 @@ PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT, StringRef CPU, : LLVMTargetMachine(T, TT, CPU, computeFSAdditions(FS, OL, TT), Options, RM, CM, OL), TLOF(createTLOF(Triple(getTargetTriple()))), + TargetABI(computeTargetABI(Triple(TT), Options)), DL(getDataLayoutString(Triple(TT))), Subtarget(TT, CPU, TargetFS, *this) { initAsmInfo(); } |