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

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


Changes in directory llvm/lib/CodeGen:

MachineFunction.cpp updated: 1.22 -> 1.23
MachineBasicBlock.cpp (r1.4) removed

---
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/MachineFunction.cpp
diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.22 llvm/lib/CodeGen/MachineFunction.cpp:1.23
--- llvm/lib/CodeGen/MachineFunction.cpp:1.22	Sun Oct 27 20:01:35 2002
+++ llvm/lib/CodeGen/MachineFunction.cpp	Sun Oct 27 23:30:44 2002
@@ -72,6 +72,21 @@
 }
 
 
+// get - This deprecated static method returns the MachineBasicBlock object
+// for the specified BasicBlock.
+//
+MachineBasicBlock& MachineBasicBlock::get(const BasicBlock *BB) {
+  const Function *F = BB->getParent();
+  MachineFunction &MF = MachineFunction::get(F);
+
+  for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
+    if (I->getBasicBlock() == BB)
+      return *I;
+  assert(0 && "MachineBasicBlock object not found for specified block!");
+  return get(BB);
+}
+
+
 //===---------------------------------------------------------------------===//
 // MachineFunction implementation
 //===---------------------------------------------------------------------===//





More information about the llvm-commits mailing list