OLD | NEW |
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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 static Location::Kind RegisterKindFromPolicy(Location loc) { | 742 static Location::Kind RegisterKindFromPolicy(Location loc) { |
743 if (loc.policy() == Location::kRequiresFpuRegister) { | 743 if (loc.policy() == Location::kRequiresFpuRegister) { |
744 return Location::kFpuRegister; | 744 return Location::kFpuRegister; |
745 } else { | 745 } else { |
746 return Location::kRegister; | 746 return Location::kRegister; |
747 } | 747 } |
748 } | 748 } |
749 | 749 |
750 | 750 |
751 static Location::Kind RegisterKindForResult(Instruction* instr) { | 751 static Location::Kind RegisterKindForResult(Instruction* instr) { |
752 if ((instr->representation() == kUnboxedDouble) || | 752 const Representation rep = instr->representation(); |
753 (instr->representation() == kUnboxedFloat32x4) || | 753 #if !defined(TARGET_ARCH_DBC) |
754 (instr->representation() == kUnboxedInt32x4) || | 754 if ((rep == kUnboxedDouble) || (rep == kUnboxedFloat32x4) || |
755 (instr->representation() == kUnboxedFloat64x2) || | 755 (rep == kUnboxedInt32x4) || (rep == kUnboxedFloat64x2) || |
756 (instr->representation() == kPairOfUnboxedDouble)) { | 756 (rep == kPairOfUnboxedDouble)) { |
757 return Location::kFpuRegister; | 757 return Location::kFpuRegister; |
758 } else { | 758 } else { |
759 return Location::kRegister; | 759 return Location::kRegister; |
760 } | 760 } |
| 761 #else |
| 762 // DBC supports only unboxed doubles and does not have distinguished FPU |
| 763 // registers. |
| 764 ASSERT((rep != kUnboxedFloat32x4) && (rep != kUnboxedInt32x4) && |
| 765 (rep != kUnboxedFloat64x2) && (rep != kPairOfUnboxedDouble)); |
| 766 return Location::kRegister; |
| 767 #endif |
761 } | 768 } |
762 | 769 |
763 | 770 |
764 // | 771 // |
765 // When describing shape of live ranges in comments below we are going to use | 772 // When describing shape of live ranges in comments below we are going to use |
766 // the following notation: | 773 // the following notation: |
767 // | 774 // |
768 // B block entry | 775 // B block entry |
769 // g g' start and end of goto instruction | 776 // g g' start and end of goto instruction |
770 // i i' start and end of any other instruction | 777 // i i' start and end of any other instruction |
(...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3048 cpu_spill_slot_count_ = spill_slots_.length(); | 3055 cpu_spill_slot_count_ = spill_slots_.length(); |
3049 spill_slots_.Clear(); | 3056 spill_slots_.Clear(); |
3050 quad_spill_slots_.Clear(); | 3057 quad_spill_slots_.Clear(); |
3051 untagged_spill_slots_.Clear(); | 3058 untagged_spill_slots_.Clear(); |
3052 | 3059 |
3053 PrepareForAllocation(Location::kFpuRegister, | 3060 PrepareForAllocation(Location::kFpuRegister, |
3054 kNumberOfFpuRegisters, | 3061 kNumberOfFpuRegisters, |
3055 unallocated_xmm_, | 3062 unallocated_xmm_, |
3056 fpu_regs_, | 3063 fpu_regs_, |
3057 blocked_fpu_registers_); | 3064 blocked_fpu_registers_); |
| 3065 #if defined(TARGET_ARCH_DBC) |
| 3066 // For DBC all registers should have been allocated in the first pass. |
| 3067 ASSERT(unallocated_.is_empty()); |
| 3068 #endif |
| 3069 |
3058 AllocateUnallocatedRanges(); | 3070 AllocateUnallocatedRanges(); |
3059 #if defined(TARGET_ARCH_DBC) | 3071 #if defined(TARGET_ARCH_DBC) |
3060 const intptr_t last_used_fpu_register = last_used_register_; | 3072 const intptr_t last_used_fpu_register = last_used_register_; |
3061 ASSERT(last_used_fpu_register == -1); // Not supported right now. | 3073 ASSERT(last_used_fpu_register == -1); // Not supported right now. |
3062 #endif | 3074 #endif |
3063 | 3075 |
3064 ResolveControlFlow(); | 3076 ResolveControlFlow(); |
3065 | 3077 |
3066 GraphEntryInstr* entry = block_order_[0]->AsGraphEntry(); | 3078 GraphEntryInstr* entry = block_order_[0]->AsGraphEntry(); |
3067 ASSERT(entry != NULL); | 3079 ASSERT(entry != NULL); |
(...skipping 30 matching lines...) Expand all Loading... |
3098 FlowGraphPrinter printer(flow_graph_, true); | 3110 FlowGraphPrinter printer(flow_graph_, true); |
3099 printer.PrintBlocks(); | 3111 printer.PrintBlocks(); |
3100 #endif | 3112 #endif |
3101 } | 3113 } |
3102 THR_Print("----------------------------------------------\n"); | 3114 THR_Print("----------------------------------------------\n"); |
3103 } | 3115 } |
3104 } | 3116 } |
3105 | 3117 |
3106 | 3118 |
3107 } // namespace dart | 3119 } // namespace dart |
OLD | NEW |