summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2014-09-03 14:51:22 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2014-09-08 16:33:33 +0100
commit065bf77b43c39da315b974ea08a5ed25e9049681 (patch)
tree917d8df78e0d929d018ea4c30519707f2a159e52 /compiler/optimizing/nodes.cc
parent9d740016b6ce35e9b596391eafe64be5ceaec76b (diff)
Add (simple) side effects flags and equality methods on nodes.
This is in preparation of doing GVN and LICM. Change-Id: I43050ff846755f9387a62b893d548ecdb54e7e95
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index f07029d6c2..207c605ddd 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -468,4 +468,16 @@ bool HCondition::NeedsMaterialization() const {
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