summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-10-13 00:24:06 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-10-13 00:24:06 +0000
commit78044fbc8eb987ea2e38dc415caca5c9612d3ed1 (patch)
tree91b36a38a22a1adceb9035822c230cb74b837200
parentf4f7292b4e2da442e8f829a32c095eea7c90dc99 (diff)
downloadbcm5719-llvm-78044fbc8eb987ea2e38dc415caca5c9612d3ed1.tar.gz
bcm5719-llvm-78044fbc8eb987ea2e38dc415caca5c9612d3ed1.zip
Don't use %l0 for large operands to a SAVE since it is needed *before* SAVE!
We now use %g1 instead since that is shared and volatile. llvm-svn: 4133
-rw-r--r--llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp b/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp
index cfa71f663c3..75146c072ed 100644
--- a/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp
+++ b/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp
@@ -58,15 +58,14 @@ void InsertPrologEpilogCode::InsertPrologCode(Function &F)
// The second operand is the stack size. If it does not fit in the
// immediate field, we have to use a free register to hold the size.
- // We will assume that local register `l0' is unused since the SAVE
- // instruction must be the first instruction in each procedure.
+ // See the comments below for the choice of this register.
//
MachineCodeForMethod& mcInfo = MachineCodeForMethod::get(&F);
unsigned int staticStackSize = mcInfo.getStaticStackSize();
if (staticStackSize < (unsigned) frameInfo.getMinStackFrameSize())
staticStackSize = (unsigned) frameInfo.getMinStackFrameSize();
-
+
if (unsigned padsz = (staticStackSize %
(unsigned) frameInfo.getStackFrameSizeAlignment()))
staticStackSize += frameInfo.getStackFrameSizeAlignment() - padsz;
@@ -83,13 +82,14 @@ void InsertPrologEpilogCode::InsertPrologCode(Function &F)
else
{
// We have to put the stack size value into a register before SAVE.
- // Use register %l0 to since it must be unused at function entry.
+ // Use register %g1 since it is volatile across calls. Note that the
+ // local (%l) and in (%i) registers cannot be used before the SAVE!
// Do this by creating a code sequence equivalent to:
- // SETSW -(stackSize), %l0
+ // SETSW -(stackSize), %g1
int32_t C = - (int) staticStackSize;
int uregNum = Target.getRegInfo().getUnifiedRegNum(
Target.getRegInfo().getRegClassIDOfType(Type::IntTy),
- SparcIntRegClass::l0);
+ SparcIntRegClass::g1);
M = new MachineInstr(SETHI);
M->SetMachineOperandConst(0, MachineOperand::MO_SignExtendedImmed, C);
@@ -110,7 +110,7 @@ void InsertPrologEpilogCode::InsertPrologCode(Function &F)
M->SetMachineOperandReg(2, uregNum);
mvec.push_back(M);
- // Now generate the SAVE using the value in register %l0
+ // Now generate the SAVE using the value in register %g1
M = new MachineInstr(SAVE);
M->SetMachineOperandReg(0, Target.getRegInfo().getStackPointer());
M->SetMachineOperandReg(1, uregNum);
OpenPOWER on IntegriCloud