[IR] Add DenseMapInfo<CallSite>.

Summary:
A CallSite is basically an Instruction*, and you can put Instruction*s
into DenseMaps, so you should be able to do the same with CallSites.

This is used in a later patch.

Reviewers: timshen

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25643

llvm-svn: 284870
This commit is contained in:
Justin Lebar 2016-10-21 20:10:44 +00:00
parent 6f72737c3b
commit 245c3e75cd
1 changed files with 22 additions and 0 deletions

View File

@ -623,9 +623,31 @@ public:
}
private:
friend struct DenseMapInfo<CallSite>;
User::op_iterator getCallee() const;
};
template <> struct DenseMapInfo<CallSite> {
using BaseInfo = llvm::DenseMapInfo<decltype(CallSite::I)>;
static CallSite getEmptyKey() {
CallSite CS;
CS.I = BaseInfo::getEmptyKey();
return CS;
}
static CallSite getTombstoneKey() {
CallSite CS;
CS.I = BaseInfo::getTombstoneKey();
return CS;
}
static unsigned getHashValue(const CallSite &CS) {
return BaseInfo::getHashValue(CS.I);
}
static bool isEqual(const CallSite &LHS, const CallSite &RHS) {
return LHS == RHS;
}
};
/// ImmutableCallSite - establish a view to a call site for examination
class ImmutableCallSite : public CallSiteBase<> {
public: