aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-05-28 19:34:00 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-05-28 19:34:00 +0000
commitfece1822bf6350f24df10c7d3a7ee515d4d0d830 (patch)
treefc6902356048e8aed3b9e90720ee61f3f7773284 /lib
parentb985158c35a103b681607361d05e61d8ebbcab41 (diff)
downloadexternal_llvm-fece1822bf6350f24df10c7d3a7ee515d4d0d830.zip
external_llvm-fece1822bf6350f24df10c7d3a7ee515d4d0d830.tar.gz
external_llvm-fece1822bf6350f24df10c7d3a7ee515d4d0d830.tar.bz2
Give PhiCp nodes better names in many cases.
Simplify InsertPhiElimInstructions(), and give it a better doxygen comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13880 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/SparcV9/InstrSelection/InstrSelection.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
index bed9bb5..db7478a 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
@@ -220,8 +220,7 @@ InstructionSelection::InsertCodeForPhis(Function &F) {
for (MachineFunction::iterator BB = MF.begin(); BB != MF.end(); ++BB) {
for (BasicBlock::const_iterator IIt = BB->getBasicBlock()->begin();
const PHINode *PN = dyn_cast<PHINode>(IIt); ++IIt) {
- // FIXME: This is probably wrong...
- Value *PhiCpRes = new PHINode(PN->getType(), "PhiCp:");
+ Value *PhiCpRes = new PHINode(PN->getType(), PN->getName() + ":PhiCp");
// The leak detector shouldn't track these nodes. They are not garbage,
// even though their parent field is never filled in.
@@ -254,11 +253,10 @@ InstructionSelection::InsertCodeForPhis(Function &F) {
} // for all BBs in function
}
-//-------------------------------------------------------------------------
-// Thid method inserts a copy instruction to a predecessor BB as a result
-// of phi elimination.
-//-------------------------------------------------------------------------
-
+/// InsertPhiElimInstructions - Inserts the instructions in CpVec into the
+/// MachineBasicBlock corresponding to BB, just before its terminator
+/// instruction. This is used by InsertCodeForPhis() to insert copies, above.
+///
void
InstructionSelection::InsertPhiElimInstructions(BasicBlock *BB,
const std::vector<MachineInstr*>& CpVec)
@@ -268,19 +266,9 @@ InstructionSelection::InsertPhiElimInstructions(BasicBlock *BB,
MachineInstr *FirstMIOfTerm = MC4Term.front();
assert (FirstMIOfTerm && "No Machine Instrs for terminator");
- MachineFunction &MF = MachineFunction::get(BB->getParent());
-
- // 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 *MBB = FirstMIOfTerm->getParent();
+ assert(MBB && "Machine BB for predecessor's terminator not found");
MachineBasicBlock::iterator MCIt = FirstMIOfTerm;
-
assert(MCIt != MBB->end() && "Start inst of terminator not found");
// insert the copy instructions just before the first machine instruction