[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu Aug 26 21:00:37 PDT 2004



Changes in directory llvm/include/llvm/CodeGen:

MachineBasicBlock.h updated: 1.37 -> 1.38
---
Log message:

Add MachineBasicBlock2IndexFunctor. This is useful for densemaps from
MachineBasicBlocks to an arbitrary type.


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

Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h
diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.37 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.38
--- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.37	Sat Jul 31 04:59:04 2004
+++ llvm/include/llvm/CodeGen/MachineBasicBlock.h	Thu Aug 26 23:00:26 2004
@@ -220,6 +220,16 @@
   }
 };
 
+// This is useful when building DenseMaps keyed on MachineBasicBlocks
+struct MachineBasicBlock2IndexFunctor
+  : std::unary_function<const MachineBasicBlock*, unsigned> {
+  unsigned operator()(const MachineBasicBlock* MBB) const {
+    assert(MBB->getNumber() != -1 &&
+           "MachineBasicBlock does not belong to a MachineFunction");
+    return MBB->getNumber();
+  }
+};
+
 
 //===--------------------------------------------------------------------===//
 // GraphTraits specializations for machine basic block graphs (machine-CFGs)






More information about the llvm-commits mailing list