From: Justin Lebar Date: Fri, 21 Oct 2016 20:10:44 +0000 (+0000) Subject: [IR] Add DenseMapInfo. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dea54d6b4db0de57fca94a298ce2a3daf07948de;p=llvm [IR] Add DenseMapInfo. 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284870 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/CallSite.h b/include/llvm/IR/CallSite.h index f8f31f6608e..40784992743 100644 --- a/include/llvm/IR/CallSite.h +++ b/include/llvm/IR/CallSite.h @@ -623,9 +623,31 @@ public: } private: + friend struct DenseMapInfo; User::op_iterator getCallee() const; }; +template <> struct DenseMapInfo { + using BaseInfo = llvm::DenseMapInfo; + + 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: