| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/bit-vector.h" | 5 #include "src/bit-vector.h" |
| 6 #include "src/compiler/instruction.h" | 6 #include "src/compiler/instruction.h" |
| 7 #include "src/compiler/register-allocator-verifier.h" | 7 #include "src/compiler/register-allocator-verifier.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 int value = imm->type() == ImmediateOperand::INLINE ? imm->inline_value() | 153 int value = imm->type() == ImmediateOperand::INLINE ? imm->inline_value() |
| 154 : imm->indexed_value(); | 154 : imm->indexed_value(); |
| 155 constraint->type_ = kImmediate; | 155 constraint->type_ = kImmediate; |
| 156 constraint->value_ = value; | 156 constraint->value_ = value; |
| 157 } else { | 157 } else { |
| 158 CHECK(op->IsUnallocated()); | 158 CHECK(op->IsUnallocated()); |
| 159 const UnallocatedOperand* unallocated = UnallocatedOperand::cast(op); | 159 const UnallocatedOperand* unallocated = UnallocatedOperand::cast(op); |
| 160 int vreg = unallocated->virtual_register(); | 160 int vreg = unallocated->virtual_register(); |
| 161 constraint->virtual_register_ = vreg; | 161 constraint->virtual_register_ = vreg; |
| 162 if (unallocated->basic_policy() == UnallocatedOperand::FIXED_SLOT) { | 162 if (unallocated->basic_policy() == UnallocatedOperand::FIXED_SLOT) { |
| 163 constraint->type_ = sequence()->IsFP(vreg) ? kDoubleSlot : kSlot; | 163 constraint->type_ = sequence()->IsFP(vreg) ? kFPSlot : kSlot; |
| 164 constraint->value_ = unallocated->fixed_slot_index(); | 164 constraint->value_ = unallocated->fixed_slot_index(); |
| 165 } else { | 165 } else { |
| 166 switch (unallocated->extended_policy()) { | 166 switch (unallocated->extended_policy()) { |
| 167 case UnallocatedOperand::ANY: | 167 case UnallocatedOperand::ANY: |
| 168 case UnallocatedOperand::NONE: | 168 case UnallocatedOperand::NONE: |
| 169 if (sequence()->IsFP(vreg)) { | 169 if (sequence()->IsFP(vreg)) { |
| 170 constraint->type_ = kNoneDouble; | 170 constraint->type_ = kNoneFP; |
| 171 } else { | 171 } else { |
| 172 constraint->type_ = kNone; | 172 constraint->type_ = kNone; |
| 173 } | 173 } |
| 174 break; | 174 break; |
| 175 case UnallocatedOperand::FIXED_REGISTER: | 175 case UnallocatedOperand::FIXED_REGISTER: |
| 176 if (unallocated->HasSecondaryStorage()) { | 176 if (unallocated->HasSecondaryStorage()) { |
| 177 constraint->type_ = kRegisterAndSlot; | 177 constraint->type_ = kRegisterAndSlot; |
| 178 constraint->spilled_slot_ = unallocated->GetSecondaryStorage(); | 178 constraint->spilled_slot_ = unallocated->GetSecondaryStorage(); |
| 179 } else { | 179 } else { |
| 180 constraint->type_ = kFixedRegister; | 180 constraint->type_ = kFixedRegister; |
| 181 } | 181 } |
| 182 constraint->value_ = unallocated->fixed_register_index(); | 182 constraint->value_ = unallocated->fixed_register_index(); |
| 183 break; | 183 break; |
| 184 case UnallocatedOperand::FIXED_DOUBLE_REGISTER: | 184 case UnallocatedOperand::FIXED_FP_REGISTER: |
| 185 constraint->type_ = kFixedDoubleRegister; | 185 constraint->type_ = kFixedFPRegister; |
| 186 constraint->value_ = unallocated->fixed_register_index(); | 186 constraint->value_ = unallocated->fixed_register_index(); |
| 187 break; | 187 break; |
| 188 case UnallocatedOperand::MUST_HAVE_REGISTER: | 188 case UnallocatedOperand::MUST_HAVE_REGISTER: |
| 189 if (sequence()->IsFP(vreg)) { | 189 if (sequence()->IsFP(vreg)) { |
| 190 constraint->type_ = kDoubleRegister; | 190 constraint->type_ = kFPRegister; |
| 191 } else { | 191 } else { |
| 192 constraint->type_ = kRegister; | 192 constraint->type_ = kRegister; |
| 193 } | 193 } |
| 194 break; | 194 break; |
| 195 case UnallocatedOperand::MUST_HAVE_SLOT: | 195 case UnallocatedOperand::MUST_HAVE_SLOT: |
| 196 constraint->type_ = sequence()->IsFP(vreg) ? kDoubleSlot : kSlot; | 196 constraint->type_ = sequence()->IsFP(vreg) ? kFPSlot : kSlot; |
| 197 break; | 197 break; |
| 198 case UnallocatedOperand::SAME_AS_FIRST_INPUT: | 198 case UnallocatedOperand::SAME_AS_FIRST_INPUT: |
| 199 constraint->type_ = kSameAsFirst; | 199 constraint->type_ = kSameAsFirst; |
| 200 break; | 200 break; |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 void RegisterAllocatorVerifier::CheckConstraint( | 206 void RegisterAllocatorVerifier::CheckConstraint( |
| 207 const InstructionOperand* op, const OperandConstraint* constraint) { | 207 const InstructionOperand* op, const OperandConstraint* constraint) { |
| 208 switch (constraint->type_) { | 208 switch (constraint->type_) { |
| 209 case kConstant: | 209 case kConstant: |
| 210 CHECK(op->IsConstant()); | 210 CHECK(op->IsConstant()); |
| 211 CHECK_EQ(ConstantOperand::cast(op)->virtual_register(), | 211 CHECK_EQ(ConstantOperand::cast(op)->virtual_register(), |
| 212 constraint->value_); | 212 constraint->value_); |
| 213 return; | 213 return; |
| 214 case kImmediate: { | 214 case kImmediate: { |
| 215 CHECK(op->IsImmediate()); | 215 CHECK(op->IsImmediate()); |
| 216 const ImmediateOperand* imm = ImmediateOperand::cast(op); | 216 const ImmediateOperand* imm = ImmediateOperand::cast(op); |
| 217 int value = imm->type() == ImmediateOperand::INLINE | 217 int value = imm->type() == ImmediateOperand::INLINE |
| 218 ? imm->inline_value() | 218 ? imm->inline_value() |
| 219 : imm->indexed_value(); | 219 : imm->indexed_value(); |
| 220 CHECK_EQ(value, constraint->value_); | 220 CHECK_EQ(value, constraint->value_); |
| 221 return; | 221 return; |
| 222 } | 222 } |
| 223 case kRegister: | 223 case kRegister: |
| 224 CHECK(op->IsRegister()); | 224 CHECK(op->IsRegister()); |
| 225 return; | 225 return; |
| 226 case kDoubleRegister: | 226 case kFPRegister: |
| 227 CHECK(op->IsFPRegister()); | 227 CHECK(op->IsFPRegister()); |
| 228 return; | 228 return; |
| 229 case kExplicit: | 229 case kExplicit: |
| 230 CHECK(op->IsExplicit()); | 230 CHECK(op->IsExplicit()); |
| 231 return; | 231 return; |
| 232 case kFixedRegister: | 232 case kFixedRegister: |
| 233 case kRegisterAndSlot: | 233 case kRegisterAndSlot: |
| 234 CHECK(op->IsRegister()); | 234 CHECK(op->IsRegister()); |
| 235 CHECK_EQ(LocationOperand::cast(op)->GetRegister().code(), | 235 CHECK_EQ(LocationOperand::cast(op)->register_code(), constraint->value_); |
| 236 constraint->value_); | |
| 237 return; | 236 return; |
| 238 case kFixedDoubleRegister: | 237 case kFixedFPRegister: |
| 239 CHECK(op->IsFPRegister()); | 238 CHECK(op->IsFPRegister()); |
| 240 CHECK_EQ(LocationOperand::cast(op)->GetDoubleRegister().code(), | 239 CHECK_EQ(LocationOperand::cast(op)->register_code(), constraint->value_); |
| 241 constraint->value_); | |
| 242 return; | 240 return; |
| 243 case kFixedSlot: | 241 case kFixedSlot: |
| 244 CHECK(op->IsStackSlot()); | 242 CHECK(op->IsStackSlot()); |
| 245 CHECK_EQ(LocationOperand::cast(op)->index(), constraint->value_); | 243 CHECK_EQ(LocationOperand::cast(op)->index(), constraint->value_); |
| 246 return; | 244 return; |
| 247 case kSlot: | 245 case kSlot: |
| 248 CHECK(op->IsStackSlot()); | 246 CHECK(op->IsStackSlot()); |
| 249 return; | 247 return; |
| 250 case kDoubleSlot: | 248 case kFPSlot: |
| 251 CHECK(op->IsFPStackSlot()); | 249 CHECK(op->IsFPStackSlot()); |
| 252 return; | 250 return; |
| 253 case kNone: | 251 case kNone: |
| 254 CHECK(op->IsRegister() || op->IsStackSlot()); | 252 CHECK(op->IsRegister() || op->IsStackSlot()); |
| 255 return; | 253 return; |
| 256 case kNoneDouble: | 254 case kNoneFP: |
| 257 CHECK(op->IsFPRegister() || op->IsFPStackSlot()); | 255 CHECK(op->IsFPRegister() || op->IsFPStackSlot()); |
| 258 return; | 256 return; |
| 259 case kSameAsFirst: | 257 case kSameAsFirst: |
| 260 CHECK(false); | 258 CHECK(false); |
| 261 return; | 259 return; |
| 262 } | 260 } |
| 263 } | 261 } |
| 264 | 262 |
| 265 void BlockAssessments::PerformMoves(const Instruction* instruction) { | 263 void BlockAssessments::PerformMoves(const Instruction* instruction) { |
| 266 const ParallelMove* first = | 264 const ParallelMove* first = |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 new (zone()) FinalAssessment(vreg, pending); | 549 new (zone()) FinalAssessment(vreg, pending); |
| 552 break; | 550 break; |
| 553 } | 551 } |
| 554 } | 552 } |
| 555 } | 553 } |
| 556 } | 554 } |
| 557 | 555 |
| 558 } // namespace compiler | 556 } // namespace compiler |
| 559 } // namespace internal | 557 } // namespace internal |
| 560 } // namespace v8 | 558 } // namespace v8 |
| OLD | NEW |