Insert machine instructions generated for Phi nodes into their

corresponding MachineCodeForInstruction vectors.

I need to be able to get the register allocated for the thing which is
called PhiCpRes in this code; this should make that task easier, plus,
Phi nodes are no longer "special" in the sense that their
MachineCodeForInstruction is empty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13904 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke 2004-05-30 03:33:49 +00:00
parent cdd69e6719
commit 2ffbb6d20a

View File

@ -217,6 +217,7 @@ void InstructionSelection::InsertCodeForPhis(Function &F) {
// For each of PN's incoming values, insert a copy in the corresponding
// predecessor block.
MachineCodeForInstruction &MCforPN = MachineCodeForInstruction::get (PN);
for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i) {
std::vector<MachineInstr*> mvec, CpVec;
Target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PhiCpRes,
@ -230,12 +231,14 @@ void InstructionSelection::InsertCodeForPhis(Function &F) {
}
// Insert the copy instructions into the predecessor BB.
InsertPhiElimInstructions(PN->getIncomingBlock(i), CpVec);
MCforPN.insert (MCforPN.end (), CpVec.begin (), CpVec.end ());
}
// Insert a copy instruction from PhiCpRes to PN.
std::vector<MachineInstr*> mvec;
Target.getRegInfo().cpValue2Value(PhiCpRes, const_cast<PHINode*>(PN),
mvec);
BB->insert(BB->begin(), mvec.begin(), mvec.end());
MCforPN.insert (MCforPN.end (), mvec.begin (), mvec.end ());
} // for each Phi Instr in BB
} // for all BBs in function
}