summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-05-12 21:35:22 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-05-12 21:35:22 +0000
commit0bcb1ad7be8515492ba02f64c0e43113ecdf8e32 (patch)
tree91333f72de69f2a3609175620b43fc6a46120395 /lib/CodeGen/MachineBasicBlock.cpp
parentf460f1679e8ac1935220e1878fd97cf44f093659 (diff)
downloadllvm-0bcb1ad7be8515492ba02f64c0e43113ecdf8e32.tar.gz
llvm-0bcb1ad7be8515492ba02f64c0e43113ecdf8e32.tar.bz2
llvm-0bcb1ad7be8515492ba02f64c0e43113ecdf8e32.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--lib/CodeGen/MachineBasicBlock.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp
index b9f11e8eb1..eccf389576 100644
--- a/lib/CodeGen/MachineBasicBlock.cpp
+++ b/lib/CodeGen/MachineBasicBlock.cpp
@@ -26,6 +26,25 @@ const MachineFunction *MachineBasicBlock::getParent() const {
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()
{