mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Give PhiCp nodes better names in many cases.
Simplify InsertPhiElimInstructions(), and give it a better doxygen comment. llvm-svn: 13880
This commit is contained in:
parent
2bd005cb45
commit
403be90321
@ -220,8 +220,7 @@ InstructionSelection::InsertCodeForPhis(Function &F) {
|
|||||||
for (MachineFunction::iterator BB = MF.begin(); BB != MF.end(); ++BB) {
|
for (MachineFunction::iterator BB = MF.begin(); BB != MF.end(); ++BB) {
|
||||||
for (BasicBlock::const_iterator IIt = BB->getBasicBlock()->begin();
|
for (BasicBlock::const_iterator IIt = BB->getBasicBlock()->begin();
|
||||||
const PHINode *PN = dyn_cast<PHINode>(IIt); ++IIt) {
|
const PHINode *PN = dyn_cast<PHINode>(IIt); ++IIt) {
|
||||||
// FIXME: This is probably wrong...
|
Value *PhiCpRes = new PHINode(PN->getType(), PN->getName() + ":PhiCp");
|
||||||
Value *PhiCpRes = new PHINode(PN->getType(), "PhiCp:");
|
|
||||||
|
|
||||||
// The leak detector shouldn't track these nodes. They are not garbage,
|
// The leak detector shouldn't track these nodes. They are not garbage,
|
||||||
// even though their parent field is never filled in.
|
// even though their parent field is never filled in.
|
||||||
@ -254,11 +253,10 @@ InstructionSelection::InsertCodeForPhis(Function &F) {
|
|||||||
} // for all BBs in function
|
} // for all BBs in function
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
/// InsertPhiElimInstructions - Inserts the instructions in CpVec into the
|
||||||
// Thid method inserts a copy instruction to a predecessor BB as a result
|
/// MachineBasicBlock corresponding to BB, just before its terminator
|
||||||
// of phi elimination.
|
/// instruction. This is used by InsertCodeForPhis() to insert copies, above.
|
||||||
//-------------------------------------------------------------------------
|
///
|
||||||
|
|
||||||
void
|
void
|
||||||
InstructionSelection::InsertPhiElimInstructions(BasicBlock *BB,
|
InstructionSelection::InsertPhiElimInstructions(BasicBlock *BB,
|
||||||
const std::vector<MachineInstr*>& CpVec)
|
const std::vector<MachineInstr*>& CpVec)
|
||||||
@ -268,19 +266,9 @@ InstructionSelection::InsertPhiElimInstructions(BasicBlock *BB,
|
|||||||
MachineInstr *FirstMIOfTerm = MC4Term.front();
|
MachineInstr *FirstMIOfTerm = MC4Term.front();
|
||||||
assert (FirstMIOfTerm && "No Machine Instrs for terminator");
|
assert (FirstMIOfTerm && "No Machine Instrs for terminator");
|
||||||
|
|
||||||
MachineFunction &MF = MachineFunction::get(BB->getParent());
|
MachineBasicBlock *MBB = FirstMIOfTerm->getParent();
|
||||||
|
assert(MBB && "Machine BB for predecessor's terminator not found");
|
||||||
// FIXME: if PHI instructions existed in the machine code, this would be
|
|
||||||
// unnecessary.
|
|
||||||
MachineBasicBlock *MBB = 0;
|
|
||||||
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
|
|
||||||
if (I->getBasicBlock() == BB) {
|
|
||||||
MBB = I;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
MachineBasicBlock::iterator MCIt = FirstMIOfTerm;
|
MachineBasicBlock::iterator MCIt = FirstMIOfTerm;
|
||||||
|
|
||||||
assert(MCIt != MBB->end() && "Start inst of terminator not found");
|
assert(MCIt != MBB->end() && "Start inst of terminator not found");
|
||||||
|
|
||||||
// insert the copy instructions just before the first machine instruction
|
// insert the copy instructions just before the first machine instruction
|
||||||
|
Loading…
Reference in New Issue
Block a user