diff options
Diffstat (limited to 'lib/IR/Constants.cpp')
-rw-r--r-- | lib/IR/Constants.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/IR/Constants.cpp b/lib/IR/Constants.cpp index 1f6f5ac427..ecd2cfd9fd 100644 --- a/lib/IR/Constants.cpp +++ b/lib/IR/Constants.cpp @@ -1375,6 +1375,17 @@ BlockAddress::BlockAddress(Function *F, BasicBlock *BB) BB->AdjustBlockAddressRefCount(1); } +BlockAddress *BlockAddress::lookup(const BasicBlock *BB) { + if (!BB->hasAddressTaken()) + return 0; + + const Function *F = BB->getParent(); + assert(F != 0 && "Block must have a parent"); + BlockAddress *BA = + F->getContext().pImpl->BlockAddresses.lookup(std::make_pair(F, BB)); + assert(BA && "Refcount and block address map disagree!"); + return BA; +} // destroyConstant - Remove the constant from the constant table. // |