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

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
« no previous file with comments | « runtime/vm/flow_graph_allocator.h ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = cpu_spill_slot_count_ +
1604 idx * kDoubleSpillSlotFactor + (kDoubleSpillSlotFactor - 1); 1606 idx * kFpuRegisterSpillFactor + (kFpuRegisterSpillFactor - 1);
1605 range->set_spill_slot( 1607
1606 Location::DoubleStackSlot( 1608 Location location;
1607 cpu_spill_slot_count_ + slot_idx, range->representation())); 1609 if (range->representation() == kUnboxedFloat32x4) {
1610 location = Location::Float32x4StackSlot(slot_idx);
1611 } else if (range->representation() == kUnboxedUint32x4) {
1612 location = Location::Uint32x4StackSlot(slot_idx);
1613 } else {
1614 ASSERT((range->representation() == kUnboxedDouble) ||
1615 (range->representation() == kUnboxedMint));
1616 location = Location::DoubleStackSlot(slot_idx,
1617 range->representation());
1618 }
1619 range->set_spill_slot(location);
1608 } 1620 }
1609 1621
1610 spilled_.Add(range); 1622 spilled_.Add(range);
1611 } 1623 }
1612 1624
1613 1625
1614 void FlowGraphAllocator::MarkAsObjectAtSafepoints(LiveRange* range) { 1626 void FlowGraphAllocator::MarkAsObjectAtSafepoints(LiveRange* range) {
1615 intptr_t stack_index = range->spill_slot().stack_index(); 1627 intptr_t stack_index = range->spill_slot().stack_index();
1616 ASSERT(stack_index >= 0); 1628 ASSERT(stack_index >= 0);
1617 1629
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2516 unallocated_xmm_, 2528 unallocated_xmm_,
2517 fpu_regs_, 2529 fpu_regs_,
2518 blocked_fpu_registers_); 2530 blocked_fpu_registers_);
2519 AllocateUnallocatedRanges(); 2531 AllocateUnallocatedRanges();
2520 2532
2521 ResolveControlFlow(); 2533 ResolveControlFlow();
2522 2534
2523 GraphEntryInstr* entry = block_order_[0]->AsGraphEntry(); 2535 GraphEntryInstr* entry = block_order_[0]->AsGraphEntry();
2524 ASSERT(entry != NULL); 2536 ASSERT(entry != NULL);
2525 intptr_t double_spill_slot_count = 2537 intptr_t double_spill_slot_count =
2526 spill_slots_.length() * kDoubleSpillSlotFactor; 2538 spill_slots_.length() * kFpuRegisterSpillFactor;
2527 entry->set_spill_slot_count(cpu_spill_slot_count_ + double_spill_slot_count); 2539 entry->set_spill_slot_count(cpu_spill_slot_count_ + double_spill_slot_count);
2528 2540
2529 if (FLAG_print_ssa_liveranges) { 2541 if (FLAG_print_ssa_liveranges) {
2530 const Function& function = flow_graph_.parsed_function().function(); 2542 const Function& function = flow_graph_.parsed_function().function();
2531 2543
2532 OS::Print("-- [after ssa allocator] ranges [%s] ---------\n", 2544 OS::Print("-- [after ssa allocator] ranges [%s] ---------\n",
2533 function.ToFullyQualifiedCString()); 2545 function.ToFullyQualifiedCString());
2534 PrintLiveRanges(); 2546 PrintLiveRanges();
2535 OS::Print("----------------------------------------------\n"); 2547 OS::Print("----------------------------------------------\n");
2536 2548
2537 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", 2549 OS::Print("-- [after ssa allocator] ir [%s] -------------\n",
2538 function.ToFullyQualifiedCString()); 2550 function.ToFullyQualifiedCString());
2539 FlowGraphPrinter printer(flow_graph_, true); 2551 FlowGraphPrinter printer(flow_graph_, true);
2540 printer.PrintBlocks(); 2552 printer.PrintBlocks();
2541 OS::Print("----------------------------------------------\n"); 2553 OS::Print("----------------------------------------------\n");
2542 } 2554 }
2543 } 2555 }
2544 2556
2545 2557
2546 } // namespace dart 2558 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_allocator.h ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698