Add MachineBasicBlock2IndexFunctor. This is useful for densemaps from

MachineBasicBlocks to an arbitrary type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alkis Evlogimenos 2004-08-27 04:00:26 +00:00
parent fc093bd081
commit 6177d3f448

View File

@ -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)