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/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 | 78 |
79 namespace { | 79 namespace { |
80 | 80 |
81 void VisitRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) { | 81 void VisitRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) { |
82 ArmOperandGenerator g(selector); | 82 ArmOperandGenerator g(selector); |
83 selector->Emit(opcode, g.DefineAsRegister(node), | 83 selector->Emit(opcode, g.DefineAsRegister(node), |
84 g.UseRegister(node->InputAt(0))); | 84 g.UseRegister(node->InputAt(0))); |
85 } | 85 } |
86 | 86 |
87 | |
88 void VisitRRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) { | 87 void VisitRRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) { |
89 ArmOperandGenerator g(selector); | 88 ArmOperandGenerator g(selector); |
90 selector->Emit(opcode, g.DefineAsRegister(node), | 89 selector->Emit(opcode, g.DefineAsRegister(node), |
91 g.UseRegister(node->InputAt(0)), | 90 g.UseRegister(node->InputAt(0)), |
92 g.UseRegister(node->InputAt(1))); | 91 g.UseRegister(node->InputAt(1))); |
93 } | 92 } |
94 | 93 |
95 void VisitRRRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) { | 94 void VisitRRRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) { |
96 ArmOperandGenerator g(selector); | 95 ArmOperandGenerator g(selector); |
| 96 // Use DefineSameAsFirst for ternary ops that clobber their first input, |
| 97 // e.g. the NEON vbsl instruction. |
97 selector->Emit( | 98 selector->Emit( |
98 opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), | 99 opcode, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
99 g.UseRegister(node->InputAt(1)), g.UseRegister(node->InputAt(2))); | 100 g.UseRegister(node->InputAt(1)), g.UseRegister(node->InputAt(2))); |
100 } | 101 } |
101 | 102 |
102 void VisitRRI(InstructionSelector* selector, ArchOpcode opcode, Node* node) { | 103 void VisitRRI(InstructionSelector* selector, ArchOpcode opcode, Node* node) { |
103 ArmOperandGenerator g(selector); | 104 ArmOperandGenerator g(selector); |
104 int32_t imm = OpParameter<int32_t>(node); | 105 int32_t imm = OpParameter<int32_t>(node); |
105 selector->Emit(opcode, g.DefineAsRegister(node), | 106 selector->Emit(opcode, g.DefineAsRegister(node), |
106 g.UseRegister(node->InputAt(0)), g.UseImmediate(imm)); | 107 g.UseRegister(node->InputAt(0)), g.UseImmediate(imm)); |
107 } | 108 } |
108 | 109 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 opcode = load_rep.IsUnsigned() ? kArmLdrh : kArmLdrsh; | 421 opcode = load_rep.IsUnsigned() ? kArmLdrh : kArmLdrsh; |
421 break; | 422 break; |
422 case MachineRepresentation::kTaggedSigned: // Fall through. | 423 case MachineRepresentation::kTaggedSigned: // Fall through. |
423 case MachineRepresentation::kTaggedPointer: // Fall through. | 424 case MachineRepresentation::kTaggedPointer: // Fall through. |
424 case MachineRepresentation::kTagged: // Fall through. | 425 case MachineRepresentation::kTagged: // Fall through. |
425 case MachineRepresentation::kWord32: | 426 case MachineRepresentation::kWord32: |
426 opcode = kArmLdr; | 427 opcode = kArmLdr; |
427 break; | 428 break; |
428 case MachineRepresentation::kWord64: // Fall through. | 429 case MachineRepresentation::kWord64: // Fall through. |
429 case MachineRepresentation::kSimd128: // Fall through. | 430 case MachineRepresentation::kSimd128: // Fall through. |
| 431 case MachineRepresentation::kSimd1x4: // Fall through. |
| 432 case MachineRepresentation::kSimd1x8: // Fall through. |
| 433 case MachineRepresentation::kSimd1x16: // Fall through. |
430 case MachineRepresentation::kNone: | 434 case MachineRepresentation::kNone: |
431 UNREACHABLE(); | 435 UNREACHABLE(); |
432 return; | 436 return; |
433 } | 437 } |
434 | 438 |
435 InstructionOperand output = g.DefineAsRegister(node); | 439 InstructionOperand output = g.DefineAsRegister(node); |
436 EmitLoad(this, opcode, &output, base, index); | 440 EmitLoad(this, opcode, &output, base, index); |
437 } | 441 } |
438 | 442 |
439 void InstructionSelector::VisitProtectedLoad(Node* node) { | 443 void InstructionSelector::VisitProtectedLoad(Node* node) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 opcode = kArmStrh; | 509 opcode = kArmStrh; |
506 break; | 510 break; |
507 case MachineRepresentation::kTaggedSigned: // Fall through. | 511 case MachineRepresentation::kTaggedSigned: // Fall through. |
508 case MachineRepresentation::kTaggedPointer: // Fall through. | 512 case MachineRepresentation::kTaggedPointer: // Fall through. |
509 case MachineRepresentation::kTagged: // Fall through. | 513 case MachineRepresentation::kTagged: // Fall through. |
510 case MachineRepresentation::kWord32: | 514 case MachineRepresentation::kWord32: |
511 opcode = kArmStr; | 515 opcode = kArmStr; |
512 break; | 516 break; |
513 case MachineRepresentation::kWord64: // Fall through. | 517 case MachineRepresentation::kWord64: // Fall through. |
514 case MachineRepresentation::kSimd128: // Fall through. | 518 case MachineRepresentation::kSimd128: // Fall through. |
| 519 case MachineRepresentation::kSimd1x4: // Fall through. |
| 520 case MachineRepresentation::kSimd1x8: // Fall through. |
| 521 case MachineRepresentation::kSimd1x16: // Fall through. |
515 case MachineRepresentation::kNone: | 522 case MachineRepresentation::kNone: |
516 UNREACHABLE(); | 523 UNREACHABLE(); |
517 return; | 524 return; |
518 } | 525 } |
519 | 526 |
520 InstructionOperand inputs[4]; | 527 InstructionOperand inputs[4]; |
521 size_t input_count = 0; | 528 size_t input_count = 0; |
522 inputs[input_count++] = g.UseRegister(value); | 529 inputs[input_count++] = g.UseRegister(value); |
523 inputs[input_count++] = g.UseRegister(base); | 530 inputs[input_count++] = g.UseRegister(base); |
524 EmitStore(this, opcode, input_count, inputs, index); | 531 EmitStore(this, opcode, input_count, inputs, index); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 break; | 675 break; |
669 case MachineRepresentation::kFloat64: | 676 case MachineRepresentation::kFloat64: |
670 opcode = kCheckedLoadFloat64; | 677 opcode = kCheckedLoadFloat64; |
671 break; | 678 break; |
672 case MachineRepresentation::kBit: // Fall through. | 679 case MachineRepresentation::kBit: // Fall through. |
673 case MachineRepresentation::kTaggedSigned: // Fall through. | 680 case MachineRepresentation::kTaggedSigned: // Fall through. |
674 case MachineRepresentation::kTaggedPointer: // Fall through. | 681 case MachineRepresentation::kTaggedPointer: // Fall through. |
675 case MachineRepresentation::kTagged: // Fall through. | 682 case MachineRepresentation::kTagged: // Fall through. |
676 case MachineRepresentation::kWord64: // Fall through. | 683 case MachineRepresentation::kWord64: // Fall through. |
677 case MachineRepresentation::kSimd128: // Fall through. | 684 case MachineRepresentation::kSimd128: // Fall through. |
| 685 case MachineRepresentation::kSimd1x4: // Fall through. |
| 686 case MachineRepresentation::kSimd1x8: // Fall through. |
| 687 case MachineRepresentation::kSimd1x16: // Fall through. |
678 case MachineRepresentation::kNone: | 688 case MachineRepresentation::kNone: |
679 UNREACHABLE(); | 689 UNREACHABLE(); |
680 return; | 690 return; |
681 } | 691 } |
682 InstructionOperand offset_operand = g.UseRegister(offset); | 692 InstructionOperand offset_operand = g.UseRegister(offset); |
683 InstructionOperand length_operand = g.CanBeImmediate(length, kArmCmp) | 693 InstructionOperand length_operand = g.CanBeImmediate(length, kArmCmp) |
684 ? g.UseImmediate(length) | 694 ? g.UseImmediate(length) |
685 : g.UseRegister(length); | 695 : g.UseRegister(length); |
686 Emit(opcode | AddressingModeField::encode(kMode_Offset_RR), | 696 Emit(opcode | AddressingModeField::encode(kMode_Offset_RR), |
687 g.DefineAsRegister(node), offset_operand, length_operand, | 697 g.DefineAsRegister(node), offset_operand, length_operand, |
(...skipping 24 matching lines...) Expand all Loading... |
712 break; | 722 break; |
713 case MachineRepresentation::kFloat64: | 723 case MachineRepresentation::kFloat64: |
714 opcode = kCheckedStoreFloat64; | 724 opcode = kCheckedStoreFloat64; |
715 break; | 725 break; |
716 case MachineRepresentation::kBit: // Fall through. | 726 case MachineRepresentation::kBit: // Fall through. |
717 case MachineRepresentation::kTaggedSigned: // Fall through. | 727 case MachineRepresentation::kTaggedSigned: // Fall through. |
718 case MachineRepresentation::kTaggedPointer: // Fall through. | 728 case MachineRepresentation::kTaggedPointer: // Fall through. |
719 case MachineRepresentation::kTagged: // Fall through. | 729 case MachineRepresentation::kTagged: // Fall through. |
720 case MachineRepresentation::kWord64: // Fall through. | 730 case MachineRepresentation::kWord64: // Fall through. |
721 case MachineRepresentation::kSimd128: // Fall through. | 731 case MachineRepresentation::kSimd128: // Fall through. |
| 732 case MachineRepresentation::kSimd1x4: // Fall through. |
| 733 case MachineRepresentation::kSimd1x8: // Fall through. |
| 734 case MachineRepresentation::kSimd1x16: // Fall through. |
722 case MachineRepresentation::kNone: | 735 case MachineRepresentation::kNone: |
723 UNREACHABLE(); | 736 UNREACHABLE(); |
724 return; | 737 return; |
725 } | 738 } |
726 InstructionOperand offset_operand = g.UseRegister(offset); | 739 InstructionOperand offset_operand = g.UseRegister(offset); |
727 InstructionOperand length_operand = g.CanBeImmediate(length, kArmCmp) | 740 InstructionOperand length_operand = g.CanBeImmediate(length, kArmCmp) |
728 ? g.UseImmediate(length) | 741 ? g.UseImmediate(length) |
729 : g.UseRegister(length); | 742 : g.UseRegister(length); |
730 Emit(opcode | AddressingModeField::encode(kMode_Offset_RR), g.NoOutput(), | 743 Emit(opcode | AddressingModeField::encode(kMode_Offset_RR), g.NoOutput(), |
731 offset_operand, length_operand, g.UseRegister(value), | 744 offset_operand, length_operand, g.UseRegister(value), |
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2340 Vector<MachineType> req_aligned = Vector<MachineType>::New(2); | 2353 Vector<MachineType> req_aligned = Vector<MachineType>::New(2); |
2341 req_aligned[0] = MachineType::Float32(); | 2354 req_aligned[0] = MachineType::Float32(); |
2342 req_aligned[1] = MachineType::Float64(); | 2355 req_aligned[1] = MachineType::Float64(); |
2343 return MachineOperatorBuilder::AlignmentRequirements:: | 2356 return MachineOperatorBuilder::AlignmentRequirements:: |
2344 SomeUnalignedAccessUnsupported(req_aligned, req_aligned); | 2357 SomeUnalignedAccessUnsupported(req_aligned, req_aligned); |
2345 } | 2358 } |
2346 | 2359 |
2347 } // namespace compiler | 2360 } // namespace compiler |
2348 } // namespace internal | 2361 } // namespace internal |
2349 } // namespace v8 | 2362 } // namespace v8 |
OLD | NEW |