From 065bf77b43c39da315b974ea08a5ed25e9049681 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 3 Sep 2014 14:51:22 +0100 Subject: Add (simple) side effects flags and equality methods on nodes. This is in preparation of doing GVN and LICM. Change-Id: I43050ff846755f9387a62b893d548ecdb54e7e95 --- compiler/optimizing/nodes.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'compiler/optimizing/nodes.cc') 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 -- cgit v1.2.3-59-g8ed1b