Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: runtime/vm/flow_graph_allocator.cc

Issue 10909169: Add support for WritableRegister policy in the register allocator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't use non-volatile EBX in a test Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_allocator.cc
diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc
index a3664ede81aa48f9131678830e93a257942aff32..d8e30f627bed50046ab82ffc9bf4b579acc02350 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -846,15 +846,38 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
range->AddUseInterval(block->start_pos(), pos - 1);
range->AddHintedUse(pos - 1, move->src_slot(), in_ref);
} else if (in_ref->IsUnallocated()) {
- // Normal unallocated input. Expected shape of
- // live ranges:
- //
- // i i'
- // value -----*
- //
- ASSERT(in_ref->IsUnallocated());
- range->AddUseInterval(block->start_pos(), pos + 1);
- range->AddUse(pos + 1, in_ref);
+ if (in_ref->policy() == Location::kWritableRegister) {
+ // Writable unallocated input. Expected shape of
+ // live ranges:
+ //
+ // i i'
+ // value --*
+ // temp [--)
+ MoveOperands* move = AddMoveAt(pos,
+ Location::RequiresRegister(),
+ Location::PrefersRegister());
+
+ // Add uses to the live range of the input.
+ range->AddUseInterval(block->start_pos(), pos);
+ range->AddUse(pos, move->src_slot());
+
+ // Create live range for the temporary.
+ LiveRange* temp = MakeLiveRangeForTemporary();
+ temp->AddUseInterval(pos, pos + 1);
+ temp->AddHintedUse(pos, in_ref, move->src_slot());
+ temp->AddUse(pos, move->dest_slot());
+ *in_ref = Location::RequiresRegister();
+ CompleteRange(temp, RegisterKindFromPolicy(*in_ref));
+ } else {
+ // Normal unallocated input. Expected shape of
+ // live ranges:
+ //
+ // i i'
+ // value -----*
+ //
+ range->AddUseInterval(block->start_pos(), pos + 1);
+ range->AddUse(pos + 1, in_ref);
+ }
} else {
ASSERT(in_ref->IsConstant());
}
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698