[llvm-commits] CVS: llvm/lib/CodeGen/MachineBasicBlock.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Wed May 12 16:35:08 PDT 2004
Changes in directory llvm/lib/CodeGen:
MachineBasicBlock.cpp updated: 1.9 -> 1.10
---
Log message:
Add non-const MachineBasicBlock::getParent() accessor method.
MBBs start out as #-1. When a MBB is added to a MachineFunction, it
gets the next available unique MBB number. If it is removed from a
MachineFunction, it goes back to being #-1.
---
Diffs of the changes: (+19 -0)
Index: llvm/lib/CodeGen/MachineBasicBlock.cpp
diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.9 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.10
--- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.9 Mon Feb 23 12:36:38 2004
+++ llvm/lib/CodeGen/MachineBasicBlock.cpp Wed May 12 16:35:22 2004
@@ -26,6 +26,25 @@
return &MachineFunction::get(getBasicBlock()->getParent());
}
+MachineFunction *MachineBasicBlock::getParent() {
+ // Get the parent by getting the Function parent of the basic block, and
+ // getting the MachineFunction from it.
+ return &MachineFunction::get(getBasicBlock()->getParent());
+}
+
+// MBBs start out as #-1. When a MBB is added to a MachineFunction, it
+// gets the next available unique MBB number. If it is removed from a
+// MachineFunction, it goes back to being #-1.
+void ilist_traits<MachineBasicBlock>::addNodeToList (MachineBasicBlock* N)
+{
+ N->Number = N->getParent ()->getNextMBBNumber ();
+}
+
+void ilist_traits<MachineBasicBlock>::removeNodeFromList (MachineBasicBlock* N)
+{
+ N->Number = -1;
+}
+
MachineInstr* ilist_traits<MachineInstr>::createNode()
{
More information about the llvm-commits
mailing list