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

Chris Lattner lattner at cs.uiuc.edu
Sun Oct 27 23:31:01 PST 2002


Changes in directory llvm/lib/CodeGen/InstrSelection:

InstrSelection.cpp updated: 1.51 -> 1.52

---
Log message:

Change MachineBasicBlock's to not be Annotations, instead they are kept as
part of a linked list tracked by MachineFunction.  MachineBasicBlock::get
is now linear time instead of constant time, and thus is deprecated!



---
Diffs of the changes:

Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp
diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.51 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.52
--- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.51	Sun Oct 27 20:01:37 2002
+++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp	Sun Oct 27 23:30:46 2002
@@ -139,14 +139,20 @@
     }
   
   //
-  // Record instructions in the vector for each basic block
+  // Create the MachineBasicBlock records and add all of the MachineInstrs
+  // defined in the MachineCodeForInstruction objects to also live in the
+  // MachineBasicBlock objects.
   // 
-  for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; ++BI)
+  MachineFunction &MF = MachineFunction::get(&F);
+  for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; ++BI) {
+    MachineBasicBlock *MCBB = new MachineBasicBlock(BI);
+    MF.getBasicBlockList().push_back(MCBB);
+
     for (BasicBlock::iterator II = BI->begin(); II != BI->end(); ++II) {
       MachineCodeForInstruction &mvec = MachineCodeForInstruction::get(II);
-      MachineBasicBlock &MCBB = MachineBasicBlock::get(BI);
-      MCBB.insert(MCBB.end(), mvec.begin(), mvec.end());
+      MCBB->insert(MCBB->end(), mvec.begin(), mvec.end());
     }
+  }
 
   // Insert phi elimination code
   InsertCodeForPhis(F);





More information about the llvm-commits mailing list