in ppc64-mode, don't allocate the 32-bit version of r13 either.
authorChris Lattner <sabre@nondot.org>
Mon, 20 Nov 2006 20:48:05 +0000 (20:48 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 20 Nov 2006 20:48:05 +0000 (20:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31884 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCRegisterInfo.td

index 6c18e17eebbd6b05a529f6e2399252c42f7c3b51..51000f9a080780045a291d996504860e10f90593 100644 (file)
@@ -224,6 +224,12 @@ def GPRC : RegisterClass<"PPC", [i32], 32,
     }
     GPRCClass::iterator
     GPRCClass::allocation_order_end(const MachineFunction &MF) const {
+      // On PPC64, r13 is the thread pointer.  Never allocate this register.
+      // Note that this is overconservative, as it also prevents allocation of
+      // R31 when the FP is not needed.
+      if (MF.getTarget().getSubtarget<PPCSubtarget>().isPPC64())
+        return end()-5;  // don't allocate R13, R31, R0, R1, LR
+        
       if (needsFP(MF))
         return end()-4;  // don't allocate R31, R0, R1, LR
       else