diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-01-26 10:02:45 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-01-30 09:34:25 +0000 |
commit | 82091dad38f3e5bfaf3b6984c9ab73069fb68310 (patch) | |
tree | f66bd397f64a13ee102e45e0b6267c5d55e77505 /compiler/optimizing/nodes.cc | |
parent | 28acb6feb50951645c37c077bd3897ea760ca322 (diff) | |
download | android_art-82091dad38f3e5bfaf3b6984c9ab73069fb68310.tar.gz android_art-82091dad38f3e5bfaf3b6984c9ab73069fb68310.tar.bz2 android_art-82091dad38f3e5bfaf3b6984c9ab73069fb68310.zip |
Implement LICM in optimizing compiler.
Change-Id: I9c8afb0a58ef45e568576015473cbfd5f011c242
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r-- | compiler/optimizing/nodes.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index fe9ce740da..5fd75f652d 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -707,7 +707,7 @@ std::ostream& operator<<(std::ostream& os, const HInstruction::InstructionKind& return os; } -void HInstruction::InsertBefore(HInstruction* cursor) { +void HInstruction::MoveBefore(HInstruction* cursor) { next_->previous_ = previous_; if (previous_ != nullptr) { previous_->next_ = next_; @@ -715,6 +715,7 @@ void HInstruction::InsertBefore(HInstruction* cursor) { if (block_->instructions_.first_instruction_ == this) { block_->instructions_.first_instruction_ = next_; } + DCHECK_NE(block_->instructions_.last_instruction_, this); previous_ = cursor->previous_; if (previous_ != nullptr) { @@ -723,6 +724,10 @@ void HInstruction::InsertBefore(HInstruction* cursor) { next_ = cursor; cursor->previous_ = this; block_ = cursor->block_; + + if (block_->instructions_.first_instruction_ == cursor) { + block_->instructions_.first_instruction_ = this; + } } void HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) { @@ -737,7 +742,7 @@ void HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) { for (HInstructionIterator it(entry_block_->GetInstructions()); !it.Done(); it.Advance()) { HInstruction* current = it.Current(); if (current->IsConstant()) { - current->InsertBefore(outer_graph->GetEntryBlock()->GetLastInstruction()); + current->MoveBefore(outer_graph->GetEntryBlock()->GetLastInstruction()); } else if (current->IsParameterValue()) { current->ReplaceWith(invoke->InputAt(parameter_index++)); } else { |