[PATCH] D25643: [IR] Add DenseMapInfo<CallSite>.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 13:20:05 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL284870: [IR] Add DenseMapInfo<CallSite>. (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D25643?vs=74771&id=75475#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25643

Files:
  llvm/trunk/include/llvm/IR/CallSite.h


Index: llvm/trunk/include/llvm/IR/CallSite.h
===================================================================
--- llvm/trunk/include/llvm/IR/CallSite.h
+++ llvm/trunk/include/llvm/IR/CallSite.h
@@ -623,9 +623,31 @@
   }
 
 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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25643.75475.patch
Type: text/x-patch
Size: 998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161021/74cb165f/attachment.bin>


More information about the llvm-commits mailing list