mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-04 03:06:28 +00:00
Add a const lookup routine to get a BlockAddress constant if there is
one, but not create one. This is useful in the verifier when we want to query the constant if it exists but not create one. To be used in an upcoming commit. llvm-svn: 199568
This commit is contained in:
parent
3062cd8540
commit
8bc1905283
@ -757,6 +757,12 @@ public:
|
||||
/// block must be embedded into a function.
|
||||
static BlockAddress *get(BasicBlock *BB);
|
||||
|
||||
/// \brief Lookup an existing \c BlockAddress constant for the given
|
||||
/// BasicBlock.
|
||||
///
|
||||
/// \returns 0 if \c !BB->hasAddressTaken(), otherwise the \c BlockAddress.
|
||||
static BlockAddress *lookup(const BasicBlock *BB);
|
||||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
|
@ -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.
|
||||
//
|
||||
|
@ -281,8 +281,8 @@ public:
|
||||
|
||||
StringMap<ConstantDataSequential*> CDSConstants;
|
||||
|
||||
|
||||
DenseMap<std::pair<Function*, BasicBlock*> , BlockAddress*> BlockAddresses;
|
||||
DenseMap<std::pair<const Function *, const BasicBlock *>, BlockAddress *>
|
||||
BlockAddresses;
|
||||
ConstantUniqueMap<ExprMapKeyType, const ExprMapKeyType&, Type, ConstantExpr>
|
||||
ExprConstants;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user