Fix code generation of materialized conditions.
Move the logic for knowing if a condition needs to be materialized
in an optimization pass (so that the information does not change
as a side effect of another optimization).
Also clean-up arm and x86_64 codegen:
- arm: ldr and str are for power-users when a constant is
in play. We should use LoadFromOffset and StoreToOffset.
- x86_64: fix misuses of movq instead of movl.
Change-Id: I01a03b91803624be2281a344a13ad5efbf4f3ef3
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 4cac319..3a0b40c 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -537,7 +537,7 @@
input->AddUseAt(this, inputs_.Size() - 1);
}
-#define DEFINE_ACCEPT(name) \
+#define DEFINE_ACCEPT(name, super) \
void H##name::Accept(HGraphVisitor* visitor) { \
visitor->Visit##name(this); \
}
@@ -575,24 +575,6 @@
return nullptr;
}
-bool HCondition::NeedsMaterialization() const {
- if (!HasOnlyOneUse()) {
- return true;
- }
- HUseListNode<HInstruction>* uses = GetUses();
- HInstruction* user = uses->GetUser();
- if (!user->IsIf()) {
- return true;
- }
-
- // TODO: if there is no intervening instructions with side-effect between this condition
- // and the If instruction, we should move the condition just before the If.
- if (GetNext() != user) {
- return true;
- }
- return false;
-}
-
bool HCondition::IsBeforeWhenDisregardMoves(HIf* if_) const {
HInstruction* previous = if_->GetPrevious();
while (previous != nullptr && previous->IsParallelMove()) {