From ed9a2f63719049e721d535c7aae7be7cda0f121c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 20 Nov 2006 20:48:05 +0000 Subject: [PATCH] in ppc64-mode, don't allocate the 32-bit version of r13 either. llvm-svn: 31884 --- lib/Target/PowerPC/PPCRegisterInfo.td | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Target/PowerPC/PPCRegisterInfo.td b/lib/Target/PowerPC/PPCRegisterInfo.td index 6c18e17eebb..51000f9a080 100644 --- a/lib/Target/PowerPC/PPCRegisterInfo.td +++ b/lib/Target/PowerPC/PPCRegisterInfo.td @@ -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().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