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

Side by Side Diff: runtime/vm/flow_graph_allocator.cc

Issue 13471013: Flow graph SIMD changes (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_allocator.h" 5 #include "vm/flow_graph_allocator.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/il_printer.h" 9 #include "vm/il_printer.h"
10 #include "vm/flow_graph.h" 10 #include "vm/flow_graph.h"
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 if (loc.policy() == Location::kRequiresFpuRegister) { 636 if (loc.policy() == Location::kRequiresFpuRegister) {
637 return Location::kFpuRegister; 637 return Location::kFpuRegister;
638 } else { 638 } else {
639 return Location::kRegister; 639 return Location::kRegister;
640 } 640 }
641 } 641 }
642 642
643 643
644 static Location::Kind RegisterKindForResult(Instruction* instr) { 644 static Location::Kind RegisterKindForResult(Instruction* instr) {
645 if ((instr->representation() == kUnboxedDouble) || 645 if ((instr->representation() == kUnboxedDouble) ||
646 (instr->representation() == kUnboxedMint)) { 646 (instr->representation() == kUnboxedMint) ||
647 (instr->representation() == kUnboxedFloat32x4) ||
648 (instr->representation() == kUnboxedUint32x4)) {
647 return Location::kFpuRegister; 649 return Location::kFpuRegister;
648 } else { 650 } else {
649 return Location::kRegister; 651 return Location::kRegister;
650 } 652 }
651 } 653 }
652 654
653 655
654 // 656 //
655 // When describing shape of live ranges in comments below we are going to use 657 // When describing shape of live ranges in comments below we are going to use
656 // the following notation: 658 // the following notation:
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 LiveRange* last_sibling = range; 1591 LiveRange* last_sibling = range;
1590 while (last_sibling->next_sibling() != NULL) { 1592 while (last_sibling->next_sibling() != NULL) {
1591 last_sibling = last_sibling->next_sibling(); 1593 last_sibling = last_sibling->next_sibling();
1592 } 1594 }
1593 1595
1594 spill_slots_[idx] = last_sibling->End(); 1596 spill_slots_[idx] = last_sibling->End();
1595 1597
1596 if (register_kind_ == Location::kRegister) { 1598 if (register_kind_ == Location::kRegister) {
1597 range->set_spill_slot(Location::StackSlot(idx)); 1599 range->set_spill_slot(Location::StackSlot(idx));
1598 } else { 1600 } else {
1599 // Double spill slots are essentially one (x64) or two (ia32) normal 1601 // FPU register spill slots are essentially two (x64) or four (ia32) normal
1600 // word size spill slots. We use the index of the slot with the lowest 1602 // word size spill slots. We use the index of the slot with the lowest
1601 // address as an index for the double spill slot. In terms of indexes 1603 // address as an index for the FPU register spill slot. In terms of indexes
1602 // this relation is inverted: so we have to take the highest index. 1604 // this relation is inverted: so we have to take the highest index.
1603 const intptr_t slot_idx = 1605 const intptr_t slot_idx =
1604 idx * kDoubleSpillSlotFactor + (kDoubleSpillSlotFactor - 1); 1606 idx * kFpuRegisterSpillFactor + (kFpuRegisterSpillFactor - 1);
1605 range->set_spill_slot( 1607 Location location;
1606 Location::DoubleStackSlot( 1608 if (range->representation() == kUnboxedFloat32x4) {
1607 cpu_spill_slot_count_ + slot_idx, range->representation())); 1609 location = Location::Float32x4StackSlot(cpu_spill_slot_count_ + slot_idx,
Vyacheslav Egorov (Google) 2013/04/03 14:25:45 moving this duplicated expression: cpu_spill_slot_
Cutch 2013/04/04 22:24:06 Done.
1610 range->representation());
Vyacheslav Egorov (Google) 2013/04/03 14:25:45 I find it confusing that we still pass representat
Cutch 2013/04/04 22:24:06 Done.
1611 } else if (range->representation() == kUnboxedUint32x4) {
1612 location = Location::Uint32x4StackSlot(cpu_spill_slot_count_ + slot_idx,
1613 range->representation());
1614 } else {
1615 ASSERT((range->representation() == kUnboxedDouble) ||
1616 (range->representation() == kUnboxedMint));
1617 location = Location::DoubleStackSlot(cpu_spill_slot_count_ + slot_idx,
1618 range->representation());
1619 }
1620 range->set_spill_slot(location);
1608 } 1621 }
1609 1622
1610 spilled_.Add(range); 1623 spilled_.Add(range);
1611 } 1624 }
1612 1625
1613 1626
1614 void FlowGraphAllocator::MarkAsObjectAtSafepoints(LiveRange* range) { 1627 void FlowGraphAllocator::MarkAsObjectAtSafepoints(LiveRange* range) {
1615 intptr_t stack_index = range->spill_slot().stack_index(); 1628 intptr_t stack_index = range->spill_slot().stack_index();
1616 ASSERT(stack_index >= 0); 1629 ASSERT(stack_index >= 0);
1617 1630
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2516 unallocated_xmm_, 2529 unallocated_xmm_,
2517 fpu_regs_, 2530 fpu_regs_,
2518 blocked_fpu_registers_); 2531 blocked_fpu_registers_);
2519 AllocateUnallocatedRanges(); 2532 AllocateUnallocatedRanges();
2520 2533
2521 ResolveControlFlow(); 2534 ResolveControlFlow();
2522 2535
2523 GraphEntryInstr* entry = block_order_[0]->AsGraphEntry(); 2536 GraphEntryInstr* entry = block_order_[0]->AsGraphEntry();
2524 ASSERT(entry != NULL); 2537 ASSERT(entry != NULL);
2525 intptr_t double_spill_slot_count = 2538 intptr_t double_spill_slot_count =
2526 spill_slots_.length() * kDoubleSpillSlotFactor; 2539 spill_slots_.length() * kFpuRegisterSpillFactor;
2527 entry->set_spill_slot_count(cpu_spill_slot_count_ + double_spill_slot_count); 2540 entry->set_spill_slot_count(cpu_spill_slot_count_ + double_spill_slot_count);
2528 2541
2529 if (FLAG_print_ssa_liveranges) { 2542 if (FLAG_print_ssa_liveranges) {
2530 const Function& function = flow_graph_.parsed_function().function(); 2543 const Function& function = flow_graph_.parsed_function().function();
2531 2544
2532 OS::Print("-- [after ssa allocator] ranges [%s] ---------\n", 2545 OS::Print("-- [after ssa allocator] ranges [%s] ---------\n",
2533 function.ToFullyQualifiedCString()); 2546 function.ToFullyQualifiedCString());
2534 PrintLiveRanges(); 2547 PrintLiveRanges();
2535 OS::Print("----------------------------------------------\n"); 2548 OS::Print("----------------------------------------------\n");
2536 2549
2537 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", 2550 OS::Print("-- [after ssa allocator] ir [%s] -------------\n",
2538 function.ToFullyQualifiedCString()); 2551 function.ToFullyQualifiedCString());
2539 FlowGraphPrinter printer(flow_graph_, true); 2552 FlowGraphPrinter printer(flow_graph_, true);
2540 printer.PrintBlocks(); 2553 printer.PrintBlocks();
2541 OS::Print("----------------------------------------------\n"); 2554 OS::Print("----------------------------------------------\n");
2542 } 2555 }
2543 } 2556 }
2544 2557
2545 2558
2546 } // namespace dart 2559 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698