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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229471 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2015-02-17 06:45:15 +00:00
parent cdc4c07360
commit fb031eee53
6 changed files with 46 additions and 36 deletions
+4 -13
View File
@@ -49,9 +49,8 @@ PPCSubtarget::PPCSubtarget(const std::string &TT, const std::string &CPU,
: PPCGenSubtargetInfo(TT, CPU, FS), TargetTriple(TT),
IsPPC64(TargetTriple.getArch() == Triple::ppc64 ||
TargetTriple.getArch() == Triple::ppc64le),
TargetABI(PPC_ABI_UNKNOWN), TM(TM),
FrameLowering(initializeSubtargetDependencies(CPU, FS)), InstrInfo(*this),
TLInfo(TM, *this), TSInfo(TM.getDataLayout()) {}
TM(TM), FrameLowering(initializeSubtargetDependencies(CPU, FS)),
InstrInfo(*this), TLInfo(TM, *this), TSInfo(TM.getDataLayout()) {}
void PPCSubtarget::initializeEnvironment() {
StackAlignment = 16;
@@ -132,16 +131,6 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
// Determine endianness.
IsLittleEndian = (TargetTriple.getArch() == Triple::ppc64le);
// Determine default ABI.
if (TargetABI == PPC_ABI_UNKNOWN) {
if (!isDarwin() && IsPPC64) {
if (IsLittleEndian)
TargetABI = PPC_ABI_ELFv2;
else
TargetABI = PPC_ABI_ELFv1;
}
}
}
/// hasLazyResolverStub - Return true if accesses to the specified global have
@@ -215,3 +204,5 @@ bool PPCSubtarget::enableSubRegLiveness() const {
return UseSubRegLiveness;
}
bool PPCSubtarget::isELFv2ABI() const { return TM.isELFv2ABI(); }
bool PPCSubtarget::isPPC64() const { return TM.isPPC64(); }