Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: src/IceOperand.h

Issue 1997443002: Subzero: Initial implementation of BB Local CSE (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Final touches Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceInst.h ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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),
« no previous file with comments | « src/IceInst.h ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698