Add (simple) side effects flags and equality methods on nodes.
This is in preparation of doing GVN and LICM.
Change-Id: I43050ff846755f9387a62b893d548ecdb54e7e95
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index f07029d..207c605 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -468,4 +468,16 @@
return false;
}
+bool HInstruction::Equals(HInstruction* other) const {
+ if (!InstructionTypeEquals(other)) return false;
+ if (!InstructionDataEquals(other)) return false;
+ if (GetType() != other->GetType()) return false;
+ if (InputCount() != other->InputCount()) return false;
+
+ for (size_t i = 0, e = InputCount(); i < e; ++i) {
+ if (InputAt(i) != other->InputAt(i)) return false;
+ }
+ return true;
+}
+
} // namespace art