From e8fd25f5c5eaf8f04c60ca66551aee9b66591a14 Mon Sep 17 00:00:00 2001 From: Duraid Madina Date: Tue, 12 Apr 2005 18:42:59 +0000 Subject: [PATCH] * OK, after changing to use liveIn/liveOut instead of IDEFs, to avoid redundant mov out3=r44 type instructions, we need to tell the register allocator the truth about out? registers. FIXME: unfortunately, since the list of allocatable registers is immutable, we can't simply 'delete r127' from the allocation order, say, if 'out0' is used. The only correct thing we can do is have a linear order of regs: out7, out6 ... out2, out1, out0, r32, r33, r34 ... r126, r127 and slide a 'window' of 96 registers along this line, depending on how many of the out? regs a function actually uses. The only downside of this is that the out? registers will be allocated _first_, which makes the resulting assembly ugly. :( Note this in the README. Hope this gets fixed soon. :) (note the 3rd person speech there) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21252 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/IA64/IA64RegisterInfo.td | 21 ++++++++++++++++----- lib/Target/IA64/README | 2 ++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/Target/IA64/IA64RegisterInfo.td b/lib/Target/IA64/IA64RegisterInfo.td index be2adb347d6..9d33dc30558 100644 --- a/lib/Target/IA64/IA64RegisterInfo.td +++ b/lib/Target/IA64/IA64RegisterInfo.td @@ -234,7 +234,13 @@ def B6 : GR<0, "b6">; // in IA64RegisterInfo.cpp def GR : RegisterClass // these last 7 are special (look down) + r0, r1, r2, r12, r13, r15, r22]> // the last 15 are special (look down) { let Methods = [{ + + iterator allocation_order_begin(MachineFunction &MF) const { + // hide registers appropriately: + return begin()+(8-(MF.getInfo()->outRegsUsed)); + } + iterator allocation_order_end(MachineFunction &MF) const { - int numReservedRegs=7; // the 15 special registers r0,r1,r2,r12,r13 etc + int numReservedRegs=7; // the 7 special registers r0,r1,r2,r12,r13 etc + // we also can't allocate registers for use as locals if they're // already required as 'out' registers numReservedRegs+=MF.getInfo()->outRegsUsed; diff --git a/lib/Target/IA64/README b/lib/Target/IA64/README index ec94299e28f..d1a8fd2fa0f 100644 --- a/lib/Target/IA64/README +++ b/lib/Target/IA64/README @@ -55,6 +55,8 @@ I guarantee it. TODO: - clean up and thoroughly test the isel patterns. + - fix stacked register allocation order: (for readability) we don't want + the out? registers being the first ones used - fix up floating point (nb http://gcc.gnu.org/wiki?pagename=ia64%20floating%20point ) - bundling!