From 04c868ef502d38c0f62549e5ef49987be6881b5d Mon Sep 17 00:00:00 2001 From: Andrew Lenharth Date: Thu, 27 Jan 2005 08:31:19 +0000 Subject: [PATCH] stack frame fix and zero FP reg fix git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19857 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Alpha/AlphaRegisterInfo.cpp | 27 ++++++++++++++++---------- lib/Target/Alpha/AlphaRegisterInfo.td | 4 ++-- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/Target/Alpha/AlphaRegisterInfo.cpp b/lib/Target/Alpha/AlphaRegisterInfo.cpp index 0c5ca352020..e2cb4b0ad50 100644 --- a/lib/Target/Alpha/AlphaRegisterInfo.cpp +++ b/lib/Target/Alpha/AlphaRegisterInfo.cpp @@ -208,7 +208,7 @@ void AlphaRegisterInfo::emitPrologue(MachineFunction &MF) const { if (NumBytes <= 32767) { MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(-NumBytes).addReg(Alpha::R30); MBB.insert(MBBI, MI); - } else if (NumBytes <= 32767 * 65536) { + } else if ((unsigned long)NumBytes <= (unsigned long)32767 * (unsigned long)65536) { long y = NumBytes / 65536; if (NumBytes % 65536 > 32767) ++y; @@ -217,7 +217,7 @@ void AlphaRegisterInfo::emitPrologue(MachineFunction &MF) const { MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(-(NumBytes - y * 65536)).addReg(Alpha::R30); MBB.insert(MBBI, MI); } else { - std::cerr << "Too big a stack frame\n"; + std::cerr << "Too big a stack frame at " << NumBytes << "\n"; abort(); } } @@ -235,14 +235,21 @@ void AlphaRegisterInfo::emitEpilogue(MachineFunction &MF, if (NumBytes != 0) { - if (NumBytes <= 32000) //FIXME: do this better - { - MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(NumBytes).addReg(Alpha::R30); - MBB.insert(MBBI, MI); - } else { - std::cerr << "Too big a stack frame\n"; - abort(); - } + if (NumBytes <= 32767) { + MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(NumBytes).addReg(Alpha::R30); + MBB.insert(MBBI, MI); + } else if ((unsigned long)NumBytes <= (unsigned long)32767 * (unsigned long)65536) { + long y = NumBytes / 65536; + if (NumBytes % 65536 > 32767) + ++y; + MI=BuildMI(Alpha::LDAH, 2, Alpha::R30).addImm(y).addReg(Alpha::R30); + MBB.insert(MBBI, MI); + MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(NumBytes - y * 65536).addReg(Alpha::R30); + MBB.insert(MBBI, MI); + } else { + std::cerr << "Too big a stack frame at " << NumBytes << "\n"; + abort(); + } } } diff --git a/lib/Target/Alpha/AlphaRegisterInfo.td b/lib/Target/Alpha/AlphaRegisterInfo.td index 80f264bf88d..51a9b5aa6d2 100644 --- a/lib/Target/Alpha/AlphaRegisterInfo.td +++ b/lib/Target/Alpha/AlphaRegisterInfo.td @@ -81,13 +81,13 @@ def GPRC : RegisterClass; + R9, R10, R11, R12, R13, R14, R15, R26, /*R28,*/ R29, R30 /*, R31*/ ]>; //R28 is reserved for the assembler //Don't allocate 15, 29, 30, 31 //Allocation volatiles only for now def FPRC : RegisterClass; + F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30]>; -- 2.34.1