Index: src/IceOperand.h |
diff --git a/src/IceOperand.h b/src/IceOperand.h |
index b3e0f5f027a8a80c8a84f094d4a2d20f4b98d3df..fdb2a66c8a415b52ae78ae5a045692825a7ca799 100644 |
--- a/src/IceOperand.h |
+++ b/src/IceOperand.h |
@@ -98,6 +98,12 @@ public: |
virtual Variable *asBoolean() { return nullptr; } |
+ virtual SizeT hashValue() const { |
+ llvm::report_fatal_error("Tried to hash unsupported operand type : " + |
+ std::to_string(Kind)); |
+ return 0; |
+ } |
+ |
protected: |
Operand(OperandKind Kind, Type Ty) : Ty(Ty), Kind(Kind) { |
// It is undefined behavior to have a larger value in the enum |
@@ -153,6 +159,7 @@ public: |
++LookupCount; |
} |
CounterType getLookupCount() const { return LookupCount; } |
+ SizeT hashValue() const override { return 0; } |
protected: |
Constant(OperandKind Kind, Type Ty) : Operand(Kind, Ty) { |
@@ -204,6 +211,10 @@ public: |
return Operand->getKind() == K; |
} |
+ SizeT hashValue() const override { |
+ return std::hash<PrimType>()(Value); |
+ } |
+ |
virtual bool shouldBeRandomizedOrPooled() const override { return false; } |
private: |
@@ -769,6 +780,10 @@ public: |
return Kind >= kVariable && Kind <= kVariable_Max; |
} |
+ SizeT hashValue() const override { |
+ return std::hash<SizeT>()(getIndex()); |
+ } |
+ |
protected: |
Variable(const Cfg *Func, OperandKind K, Type Ty, SizeT Index) |
: Operand(K, Ty), Number(Index), |