summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
authorGuillaume "Vermeille" Sanchez <guillaumesa@google.com>2015-04-24 16:36:52 +0100
committerGuillaume "Vermeille" Sanchez <guillaumesa@google.com>2015-04-27 13:04:35 +0100
commit2967ec6c3dad1c1dc15fc827188bd5ecfa75493b (patch)
treef923c51b3a6aaa2a05e6fcf6fe0c68cbab718cef /compiler/optimizing/nodes.cc
parent9f3565a632d12c9cadd7d966da308fd26dbc899c (diff)
downloadandroid_art-2967ec6c3dad1c1dc15fc827188bd5ecfa75493b.tar.gz
android_art-2967ec6c3dad1c1dc15fc827188bd5ecfa75493b.tar.bz2
android_art-2967ec6c3dad1c1dc15fc827188bd5ecfa75493b.zip
Add InsertInstructionAfter in HBasicBlock.
Change-Id: I56e4e6edb39d1aab747877b7e517e94f0393f296
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 6ab57b8e50..39c1b4eea3 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -456,6 +456,20 @@ void HBasicBlock::InsertInstructionBefore(HInstruction* instruction, HInstructio
instructions_.InsertInstructionBefore(instruction, cursor);
}
+void HBasicBlock::InsertInstructionAfter(HInstruction* instruction, HInstruction* cursor) {
+ DCHECK(!cursor->IsPhi());
+ DCHECK(!instruction->IsPhi());
+ DCHECK_EQ(instruction->GetId(), -1);
+ DCHECK_NE(cursor->GetId(), -1);
+ DCHECK_EQ(cursor->GetBlock(), this);
+ DCHECK(!instruction->IsControlFlow());
+ DCHECK(!cursor->IsControlFlow());
+ instruction->SetBlock(this);
+ instruction->SetId(GetGraph()->GetNextInstructionId());
+ UpdateInputsUsers(instruction);
+ instructions_.InsertInstructionAfter(instruction, cursor);
+}
+
void HBasicBlock::InsertPhiAfter(HPhi* phi, HPhi* cursor) {
DCHECK_EQ(phi->GetId(), -1);
DCHECK_NE(cursor->GetId(), -1);