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

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: Address comments, add -lcse-max-iters option. 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
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),
« src/IceInst.h ('K') | « src/IceInst.h ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698