Factorize code for common LocationSummary of HInvoke.
This is one step forward, we could factorize more, but
I wanted to get this out of the way first.
Change-Id: I6ae411a737eebaecb64974f47af507ce0cfbae85
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index 0cd63a6..65aea68 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -288,6 +288,20 @@
}
}
+void CodeGenerator::CreateCommonInvokeLocationSummary(
+ HInvoke* invoke, InvokeDexCallingConventionVisitor* visitor){
+ ArenaAllocator* allocator = invoke->GetBlock()->GetGraph()->GetArena();
+ LocationSummary* locations = new (allocator) LocationSummary(invoke, LocationSummary::kCall);
+ locations->AddTemp(visitor->GetMethodLocation());
+
+ for (size_t i = 0; i < invoke->GetNumberOfArguments(); i++) {
+ HInstruction* input = invoke->InputAt(i);
+ locations->SetInAt(i, visitor->GetNextLocation(input->GetType()));
+ }
+
+ locations->SetOut(visitor->GetReturnLocation(invoke->GetType()));
+}
+
void CodeGenerator::BlockIfInRegister(Location location, bool is_out) const {
// The DCHECKS below check that a register is not specified twice in
// the summary. The out location can overlap with an input, so we need