summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2015-04-29 10:23:07 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-29 10:23:07 +0000
commitfadf977d85bfbf3f9d5d4730afb660cbed34f989 (patch)
treed64b1cd421d92a52930c44fc96cc822b19ff1430 /compiler/optimizing/nodes.cc
parentd474b1d0fd69fdeb481adda8c0814512956f2d51 (diff)
parent2967ec6c3dad1c1dc15fc827188bd5ecfa75493b (diff)
downloadandroid_art-fadf977d85bfbf3f9d5d4730afb660cbed34f989.tar.gz
android_art-fadf977d85bfbf3f9d5d4730afb660cbed34f989.tar.bz2
android_art-fadf977d85bfbf3f9d5d4730afb660cbed34f989.zip
Merge "Add InsertInstructionAfter in HBasicBlock."
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 e2eb46aabb..699987c05e 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -449,6 +449,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);