diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2004-03-31 20:58:37 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2004-03-31 20:58:37 +0000 |
commit | 368c5da1986fce45a4594222a130df1c1c38fd79 (patch) | |
tree | c1a20e972d28a3bbc88db8b2054cc2df24281e5c | |
parent | 60d6e54c72ceb173a6de119ee44d1b9694380e78 (diff) | |
download | external_llvm-368c5da1986fce45a4594222a130df1c1c38fd79.zip external_llvm-368c5da1986fce45a4594222a130df1c1c38fd79.tar.gz external_llvm-368c5da1986fce45a4594222a130df1c1c38fd79.tar.bz2 |
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
-rw-r--r-- | lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp b/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp index 8df8c6e..48874e7 100644 --- a/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp +++ b/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp @@ -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)) { |