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

Unified Diff: runtime/vm/flow_graph_allocator.cc

Issue 10968059: Support for unboxed 64-bit integer bitwise operations and equality on ia32. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed boxing of smis and added one more 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
Index: runtime/vm/flow_graph_allocator.cc
===================================================================
--- runtime/vm/flow_graph_allocator.cc (revision 12765)
+++ runtime/vm/flow_graph_allocator.cc (working copy)
@@ -62,6 +62,7 @@
FlowGraphAllocator::FlowGraphAllocator(const FlowGraph& flow_graph)
: flow_graph_(flow_graph),
+ reps_(NULL),
block_order_(flow_graph.reverse_postorder()),
postorder_(flow_graph.postorder()),
live_out_(block_order_.length()),
@@ -392,14 +393,17 @@
LiveRange* FlowGraphAllocator::GetLiveRange(intptr_t vreg) {
if (live_ranges_[vreg] == NULL) {
- live_ranges_[vreg] = new LiveRange(vreg);
+ Location::Representation rep =
+ reps_->Contains(vreg) ? Location::kMint : Location::kDouble;
+ live_ranges_[vreg] = new LiveRange(vreg, rep);
}
return live_ranges_[vreg];
}
LiveRange* FlowGraphAllocator::MakeLiveRangeForTemporary() {
- LiveRange* range = new LiveRange(kTempVirtualRegister);
+ Location::Representation ignored = Location::kDouble;
+ LiveRange* range = new LiveRange(kTempVirtualRegister, ignored);
#if defined(DEBUG)
temporaries_.Add(range);
#endif
@@ -417,7 +421,8 @@
}
if (blocking_ranges[loc.register_code()] == NULL) {
- LiveRange* range = new LiveRange(kNoVirtualRegister);
+ Location::Representation ignored = Location::kDouble;
+ LiveRange* range = new LiveRange(kNoVirtualRegister, ignored);
blocking_ranges[loc.register_code()] = range;
range->set_assigned_location(loc);
#if defined(DEBUG)
@@ -581,7 +586,8 @@
static Location::Kind RegisterKindForResult(Instruction* instr) {
- if (instr->representation() == kUnboxedDouble) {
+ if (instr->representation() == kUnboxedDouble ||
+ instr->representation() == kUnboxedInteger) {
return Location::kXmmRegister;
} else {
return Location::kRegister;
@@ -913,8 +919,9 @@
}
for (intptr_t reg = 0; reg < kNumberOfXmmRegisters; reg++) {
+ Location::Representation ignored = Location::kDouble;
BlockLocation(
- Location::XmmRegisterLocation(static_cast<XmmRegister>(reg)),
+ Location::XmmRegisterLocation(static_cast<XmmRegister>(reg), ignored),
pos,
pos + 1);
}
@@ -1382,6 +1389,7 @@
UseInterval* last_use_interval = (last_before_split == last_use_interval_) ?
first_after_split : last_use_interval_;
next_sibling_ = new LiveRange(vreg(),
+ representation(),
first_use_after_split,
first_after_split,
last_use_interval,
@@ -1496,7 +1504,7 @@
idx * kDoubleSpillSlotFactor + (kDoubleSpillSlotFactor - 1);
range->set_spill_slot(
Location::DoubleStackSlot(
- cpu_spill_slot_count_ + slot_idx));
+ cpu_spill_slot_count_ + slot_idx, range->representation()));
}
spilled_.Add(range);
@@ -1597,7 +1605,7 @@
if (free_until <= unallocated->Start()) return false;
TRACE_ALLOC(OS::Print("assigning free register "));
- TRACE_ALLOC(MakeRegisterLocation(candidate).Print());
+ TRACE_ALLOC(MakeRegisterLocation(candidate, Location::kDouble).Print());
TRACE_ALLOC(OS::Print(" to %"Pd"\n", unallocated->vreg()));
if (free_until != kMaxPosition) {
@@ -1608,7 +1616,8 @@
}
registers_[candidate].Add(unallocated);
- unallocated->set_assigned_location(MakeRegisterLocation(candidate));
+ unallocated->set_assigned_location(
+ MakeRegisterLocation(candidate, unallocated->representation()));
return true;
}
@@ -1641,7 +1650,7 @@
}
TRACE_ALLOC(OS::Print("assigning blocked register "));
- TRACE_ALLOC(MakeRegisterLocation(candidate).Print());
+ TRACE_ALLOC(MakeRegisterLocation(candidate, Location::kDouble).Print());
TRACE_ALLOC(OS::Print(" to live range %"Pd" until %"Pd"\n",
unallocated->vreg(), blocked_at));
@@ -1747,7 +1756,8 @@
if (first_evicted != -1) RemoveEvicted(reg, first_evicted);
registers_[reg].Add(unallocated);
- unallocated->set_assigned_location(MakeRegisterLocation(reg));
+ unallocated->set_assigned_location(
+ MakeRegisterLocation(reg, unallocated->representation()));
}
@@ -2138,7 +2148,30 @@
}
+void FlowGraphAllocator::CollectRepresentations() {
+ reps_ = new BitVector(flow_graph_.max_virtual_register_number());
+
+ for (BlockIterator it = flow_graph_.reverse_postorder_iterator();
+ !it.Done();
+ it.Advance()) {
+ BlockEntryInstr* block = it.Current();
+ // TODO(fschneider): Support unboxed mint representation for phis.
+ for (ForwardInstructionIterator instr_it(block);
+ !instr_it.Done();
+ instr_it.Advance()) {
+ Instruction* instr = instr_it.Current();
+ if (instr->IsDefinition() && instr->representation() == kUnboxedInteger) {
+ reps_->Add(instr->AsDefinition()->ssa_temp_index());
+ }
+ }
+ }
+}
+
+
+
void FlowGraphAllocator::AllocateRegisters() {
+ CollectRepresentations();
+
EliminateEnvironmentUses();
AnalyzeLiveness();

Powered by Google App Engine
This is Rietveld 408576698