summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/CodeGen/MachineBasicBlock.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
index 9d4ede6de1f..fb037402903 100644
--- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -220,6 +220,16 @@ private: // Methods used to maintain doubly linked list of blocks...
}
};
+// 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)
OpenPOWER on IntegriCloud