mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-29 14:40:25 +00:00
Rewrote uses of deprecated `MachineFunction::get(BasicBlock *BB)'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4352 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b7551ef115
commit
e585a7d12a
@ -294,7 +294,7 @@ struct SparcFunctionAsmPrinter : public FunctionPass, public AsmPrinter {
|
||||
|
||||
void emitFunction(const Function &F);
|
||||
private :
|
||||
void emitBasicBlock(const BasicBlock *BB);
|
||||
void emitBasicBlock(const MachineBasicBlock &MBB);
|
||||
void emitMachineInst(const MachineInstr *MI);
|
||||
|
||||
unsigned int printOperands(const MachineInstr *MI, unsigned int opNum);
|
||||
@ -462,16 +462,13 @@ SparcFunctionAsmPrinter::emitMachineInst(const MachineInstr *MI)
|
||||
}
|
||||
|
||||
void
|
||||
SparcFunctionAsmPrinter::emitBasicBlock(const BasicBlock *BB)
|
||||
SparcFunctionAsmPrinter::emitBasicBlock(const MachineBasicBlock &MBB)
|
||||
{
|
||||
// Emit a label for the basic block
|
||||
toAsm << getID(BB) << ":\n";
|
||||
|
||||
// Get the vector of machine instructions corresponding to this bb.
|
||||
const MachineBasicBlock &MIs = MachineBasicBlock::get(BB);
|
||||
toAsm << getID(MBB.getBasicBlock()) << ":\n";
|
||||
|
||||
// Loop over all of the instructions in the basic block...
|
||||
for (MachineBasicBlock::const_iterator MII = MIs.begin(), MIE = MIs.end();
|
||||
for (MachineBasicBlock::const_iterator MII = MBB.begin(), MIE = MBB.end();
|
||||
MII != MIE; ++MII)
|
||||
emitMachineInst(*MII);
|
||||
toAsm << "\n"; // Seperate BB's with newlines
|
||||
@ -489,8 +486,9 @@ SparcFunctionAsmPrinter::emitFunction(const Function &F)
|
||||
toAsm << methName << ":\n";
|
||||
|
||||
// Output code for all of the basic blocks in the function...
|
||||
for (Function::const_iterator I = F.begin(), E = F.end(); I != E; ++I)
|
||||
emitBasicBlock(I);
|
||||
MachineFunction &MF = MachineFunction::get(&F);
|
||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); I != E; ++I)
|
||||
emitBasicBlock(*I);
|
||||
|
||||
// Output a .size directive so the debugger knows the extents of the function
|
||||
toAsm << ".EndOf_" << methName << ":\n\t.size "
|
||||
|
@ -117,14 +117,17 @@ void InsertPrologEpilogCode::InsertPrologCode(Function &F)
|
||||
mvec.push_back(M);
|
||||
}
|
||||
|
||||
MachineBasicBlock& bbMvec = MachineBasicBlock::get(&F.getEntryNode());
|
||||
MachineBasicBlock& bbMvec = mcInfo.front();
|
||||
bbMvec.insert(bbMvec.begin(), mvec.begin(), mvec.end());
|
||||
}
|
||||
|
||||
void InsertPrologEpilogCode::InsertEpilogCode(Function &F)
|
||||
{
|
||||
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
|
||||
Instruction *TermInst = (Instruction*)I->getTerminator();
|
||||
MachineFunction &MF = MachineFunction::get(&F);
|
||||
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
|
||||
MachineBasicBlock &MBB = *I;
|
||||
BasicBlock &BB = *I->getBasicBlock();
|
||||
Instruction *TermInst = (Instruction*)BB.getTerminator();
|
||||
if (TermInst->getOpcode() == Instruction::Ret)
|
||||
{
|
||||
MachineInstr *Restore = new MachineInstr(RESTORE);
|
||||
@ -133,7 +136,6 @@ void InsertPrologEpilogCode::InsertEpilogCode(Function &F)
|
||||
(int64_t)0);
|
||||
Restore->SetMachineOperandReg(2, Target.getRegInfo().getZeroRegNum());
|
||||
|
||||
MachineBasicBlock& bbMvec = MachineBasicBlock::get(I);
|
||||
MachineCodeForInstruction &termMvec =
|
||||
MachineCodeForInstruction::get(TermInst);
|
||||
|
||||
@ -142,12 +144,12 @@ void InsertPrologEpilogCode::InsertEpilogCode(Function &F)
|
||||
unsigned numNOPs = 0;
|
||||
while (termMvec.back()->getOpCode() == NOP)
|
||||
{
|
||||
assert( termMvec.back() == bbMvec.back());
|
||||
delete bbMvec.pop_back();
|
||||
assert( termMvec.back() == MBB.back());
|
||||
delete MBB.pop_back();
|
||||
termMvec.pop_back();
|
||||
++numNOPs;
|
||||
}
|
||||
assert(termMvec.back() == bbMvec.back());
|
||||
assert(termMvec.back() == MBB.back());
|
||||
|
||||
// Check that we found the right number of NOPs and have the right
|
||||
// number of instructions to replace them.
|
||||
@ -156,7 +158,7 @@ void InsertPrologEpilogCode::InsertEpilogCode(Function &F)
|
||||
assert(ndelays == 1 && "Cannot use epilog code for delay slots?");
|
||||
|
||||
// Append the epilog code to the end of the basic block.
|
||||
bbMvec.push_back(Restore);
|
||||
MBB.push_back(Restore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user