summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-10-21 20:10:44 +0000
committerJustin Lebar <jlebar@google.com>2016-10-21 20:10:44 +0000
commit245c3e75cd84b012a7dd9fdd79f21e74bc95d1e1 (patch)
treea96f565dd8abd865a1a91317305e1681ea2e1481
parent6f72737c3bd66085e5196b7cb78ef4fdfc39e796 (diff)
downloadbcm5719-llvm-245c3e75cd84b012a7dd9fdd79f21e74bc95d1e1.tar.gz
bcm5719-llvm-245c3e75cd84b012a7dd9fdd79f21e74bc95d1e1.zip
[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
-rw-r--r--llvm/include/llvm/IR/CallSite.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/include/llvm/IR/CallSite.h b/llvm/include/llvm/IR/CallSite.h
index f8f31f6608e..40784992743 100644
--- a/llvm/include/llvm/IR/CallSite.h
+++ b/llvm/include/llvm/IR/CallSite.h
@@ -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:
OpenPOWER on IntegriCloud