Factor out getStaticStackSize from InsertPrologCode(), so that I can more

easily steal it for a separate use in the reoptimizer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12568 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke 2004-03-31 20:58:37 +00:00
parent 60d6e54c72
commit 368c5da198

View File

@ -51,6 +51,20 @@ namespace {
// 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 @@ void InsertPrologEpilogCode::InsertPrologCode(MachineFunction &MF)
// 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)) {