[llvm-commits] CVS: llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Sat May 29 22:36:02 PDT 2004


Changes in directory llvm/lib/Target/SparcV9/InstrSelection:

InstrSelection.cpp updated: 1.76 -> 1.77

---
Log message:

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.


---
Diffs of the changes:  (+3 -0)

Index: llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
diff -u llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp:1.76 llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp:1.77
--- llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp:1.76	Sat May 29 18:10:20 2004
+++ llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp	Sat May 29 22:33:49 2004
@@ -217,6 +217,7 @@
 
       // 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 @@
         }
         // 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
 }





More information about the llvm-commits mailing list