diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-04-09 05:20:15 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-04-09 05:20:15 +0000 |
| commit | f8a9bfbc03ee138a1632b861e994c192878ca977 (patch) | |
| tree | 6be871855f8506a80947f4181442a3ef14e38fbd /llvm/lib/Target/Sparc | |
| parent | 5074bb529e9734908f199ba1da2ec309715660b6 (diff) | |
| download | bcm5719-llvm-f8a9bfbc03ee138a1632b861e994c192878ca977.tar.gz bcm5719-llvm-f8a9bfbc03ee138a1632b861e994c192878ca977.zip | |
Move the InsertPrologEpilogCode class out of the Sparc.cpp file into the
new PrologEpilogCodeInserter.cpp file, and include the bodies of the
GetInstructionsFor(Prolog|Epilog) functions from SparcInstrSelection.cpp
into the class. This eliminates the need for a static global vector of
instructions and a class of errors that is really unneccesary.
llvm-svn: 2194
Diffstat (limited to 'llvm/lib/Target/Sparc')
| -rw-r--r-- | llvm/lib/Target/Sparc/SparcInstrSelection.cpp | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp index 2094f6ec41c..a5c1a359c3f 100644 --- a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp +++ b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp @@ -1214,87 +1214,6 @@ CreateCopyInstructionsByType(const TargetMachine& target, //******************* Externally Visible Functions *************************/ -//------------------------------------------------------------------------ -// External Function: GetInstructionsForProlog -// External Function: GetInstructionsForEpilog -// -// Purpose: -// Create prolog and epilog code for procedure entry and exit -//------------------------------------------------------------------------ - -extern unsigned -GetInstructionsForProlog(BasicBlock* entryBB, - TargetMachine &target, - MachineInstr** mvec) -{ - MachineInstr* M; - const MachineFrameInfo& frameInfo = target.getFrameInfo(); - unsigned int N = 0; - - // 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. - // - Function *F = entryBB->getParent(); - 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; - - if (target.getInstrInfo().constantFitsInImmedField(SAVE, staticStackSize)) - { - M = new MachineInstr(SAVE); - M->SetMachineOperandReg(0, target.getRegInfo().getStackPointer()); - M->SetMachineOperandConst(1, MachineOperand::MO_SignExtendedImmed, - - (int) staticStackSize); - M->SetMachineOperandReg(2, target.getRegInfo().getStackPointer()); - mvec[N++] = M; - } - else - { - M = new MachineInstr(SETSW); - M->SetMachineOperandConst(0, MachineOperand::MO_SignExtendedImmed, - - (int) staticStackSize); - M->SetMachineOperandReg(1, MachineOperand::MO_MachineRegister, - target.getRegInfo().getUnifiedRegNum( - target.getRegInfo().getRegClassIDOfType(Type::IntTy), - SparcIntRegOrder::l0)); - mvec[N++] = M; - - M = new MachineInstr(SAVE); - M->SetMachineOperandReg(0, target.getRegInfo().getStackPointer()); - M->SetMachineOperandReg(1, MachineOperand::MO_MachineRegister, - target.getRegInfo().getUnifiedRegNum( - target.getRegInfo().getRegClassIDOfType(Type::IntTy), - SparcIntRegOrder::l0)); - M->SetMachineOperandReg(2, target.getRegInfo().getStackPointer()); - mvec[N++] = M; - } - - return N; -} - - -extern unsigned -GetInstructionsForEpilog(BasicBlock* anExitBB, - TargetMachine &target, - MachineInstr** mvec) -{ - mvec[0] = new MachineInstr(RESTORE); - mvec[0]->SetMachineOperandReg(0, target.getRegInfo().getZeroRegNum()); - mvec[0]->SetMachineOperandConst(1, MachineOperand::MO_SignExtendedImmed, - (int64_t)0); - mvec[0]->SetMachineOperandReg(2, target.getRegInfo().getZeroRegNum()); - - return 1; -} - //------------------------------------------------------------------------ // External Function: ThisIsAChainRule |

