Chromium Code Reviews| Index: src/IceOperand.h |
| diff --git a/src/IceOperand.h b/src/IceOperand.h |
| index b3e0f5f027a8a80c8a84f094d4a2d20f4b98d3df..2cd58106db70fbfd8b266182029db9c2ea37d1f6 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; } |
| + virtual SizeT hashValue() const override { return 0; } |
|
Jim Stichnoth
2016/05/24 04:58:11
You shouldn't need "virtual" if you're using "over
manasijm
2016/05/24 16:54:21
Done.
|
| protected: |
| Constant(OperandKind Kind, Type Ty) : Operand(Kind, Ty) { |
| @@ -204,6 +211,10 @@ public: |
| return Operand->getKind() == K; |
| } |
| + virtual 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; |
| } |
| + virtual 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), |