[llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Wed Mar 31 14:59:01 PST 2004
Changes in directory llvm/lib/Target/SparcV9:
SparcV9PrologEpilogInserter.cpp updated: 1.36 -> 1.37
---
Log message:
Factor out getStaticStackSize from InsertPrologCode(), so that I can more
easily steal it for a separate use in the reoptimizer.
---
Diffs of the changes: (+15 -9)
Index: llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp:1.36 llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp:1.37
--- llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp:1.36 Wed Feb 25 12:44:15 2004
+++ llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp Wed Mar 31 14:58:37 2004
@@ -51,6 +51,20 @@
// Create prolog and epilog code for procedure entry and exit
//------------------------------------------------------------------------
+static unsigned getStaticStackSize (MachineFunction &MF) {
+ const TargetFrameInfo& frameInfo = MF.getTarget().getFrameInfo();
+
+ unsigned staticStackSize = MF.getInfo()->getStaticStackSize();
+
+ if (staticStackSize < (unsigned) frameInfo.getMinStackFrameSize())
+ staticStackSize = (unsigned) frameInfo.getMinStackFrameSize();
+ if (unsigned padsz = (staticStackSize %
+ (unsigned) frameInfo.getStackFrameSizeAlignment()))
+ staticStackSize += frameInfo.getStackFrameSizeAlignment() - padsz;
+
+ return staticStackSize;
+}
+
void InsertPrologEpilogCode::InsertPrologCode(MachineFunction &MF)
{
std::vector<MachineInstr*> mvec;
@@ -61,15 +75,7 @@
// immediate field, we have to use a free register to hold the size.
// See the comments below for the choice of this register.
//
- unsigned staticStackSize = MF.getInfo()->getStaticStackSize();
-
- if (staticStackSize < (unsigned) frameInfo.getMinStackFrameSize())
- staticStackSize = (unsigned) frameInfo.getMinStackFrameSize();
-
- if (unsigned padsz = (staticStackSize %
- (unsigned) frameInfo.getStackFrameSizeAlignment()))
- staticStackSize += frameInfo.getStackFrameSizeAlignment() - padsz;
-
+ unsigned staticStackSize = getStaticStackSize (MF);
int32_t C = - (int) staticStackSize;
int SP = TM.getRegInfo().getStackPointer();
if (TM.getInstrInfo().constantFitsInImmedField(V9::SAVEi,staticStackSize)) {
More information about the llvm-commits
mailing list