| 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 #ifndef V8_REGISTER_ALLOCATOR_VERIFIER_H_ | 5 #ifndef V8_REGISTER_ALLOCATOR_VERIFIER_H_ |
| 6 #define V8_REGISTER_ALLOCATOR_VERIFIER_H_ | 6 #define V8_REGISTER_ALLOCATOR_VERIFIER_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 namespace compiler { | 13 namespace compiler { |
| 14 | 14 |
| 15 class InstructionOperand; | 15 class InstructionOperand; |
| 16 class InstructionSequence; | 16 class InstructionSequence; |
| 17 | 17 |
| 18 class RegisterAllocatorVerifier FINAL : public ZoneObject { | 18 class RegisterAllocatorVerifier FINAL : public ZoneObject { |
| 19 public: | 19 public: |
| 20 RegisterAllocatorVerifier(Zone* zone, const InstructionSequence* sequence); | 20 RegisterAllocatorVerifier(Zone* zone, const RegisterConfiguration* config, |
| 21 const InstructionSequence* sequence); |
| 21 | 22 |
| 22 void VerifyAssignment(); | 23 void VerifyAssignment(); |
| 24 void VerifyGapMoves(); |
| 23 | 25 |
| 24 private: | 26 private: |
| 25 enum ConstraintType { | 27 enum ConstraintType { |
| 26 kConstant, | 28 kConstant, |
| 27 kImmediate, | 29 kImmediate, |
| 28 kRegister, | 30 kRegister, |
| 29 kFixedRegister, | 31 kFixedRegister, |
| 30 kDoubleRegister, | 32 kDoubleRegister, |
| 31 kFixedDoubleRegister, | 33 kFixedDoubleRegister, |
| 32 kFixedSlot, | 34 kFixedSlot, |
| 33 kNone, | 35 kNone, |
| 34 kNoneDouble, | 36 kNoneDouble, |
| 35 kSameAsFirst | 37 kSameAsFirst |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 struct OperandConstraint { | 40 struct OperandConstraint { |
| 39 ConstraintType type_; | 41 ConstraintType type_; |
| 40 int value_; // subkind index when relevant | 42 int value_; // subkind index when relevant |
| 43 int virtual_register_; |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 struct InstructionConstraint { | 46 struct InstructionConstraint { |
| 44 const Instruction* instruction_; | 47 const Instruction* instruction_; |
| 45 size_t operand_constaints_size_; | 48 size_t operand_constaints_size_; |
| 46 OperandConstraint* operand_constraints_; | 49 OperandConstraint* operand_constraints_; |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 typedef ZoneVector<InstructionConstraint> Constraints; | 52 typedef ZoneVector<InstructionConstraint> Constraints; |
| 50 | 53 |
| 54 Zone* zone() const { return zone_; } |
| 55 const RegisterConfiguration* config() { return config_; } |
| 51 const InstructionSequence* sequence() const { return sequence_; } | 56 const InstructionSequence* sequence() const { return sequence_; } |
| 52 Constraints* constraints() { return &constraints_; } | 57 Constraints* constraints() { return &constraints_; } |
| 58 |
| 59 static void VerifyInput(const OperandConstraint& constraint); |
| 60 static void VerifyTemp(const OperandConstraint& constraint); |
| 61 static void VerifyOutput(const OperandConstraint& constraint); |
| 62 |
| 53 void BuildConstraint(const InstructionOperand* op, | 63 void BuildConstraint(const InstructionOperand* op, |
| 54 OperandConstraint* constraint); | 64 OperandConstraint* constraint); |
| 55 void CheckConstraint(const InstructionOperand* op, | 65 void CheckConstraint(const InstructionOperand* op, |
| 56 const OperandConstraint* constraint); | 66 const OperandConstraint* constraint); |
| 57 | 67 |
| 68 Zone* const zone_; |
| 69 const RegisterConfiguration* config_; |
| 58 const InstructionSequence* const sequence_; | 70 const InstructionSequence* const sequence_; |
| 59 Constraints constraints_; | 71 Constraints constraints_; |
| 60 | 72 |
| 61 DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorVerifier); | 73 DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorVerifier); |
| 62 }; | 74 }; |
| 63 | 75 |
| 64 } // namespace compiler | 76 } // namespace compiler |
| 65 } // namespace internal | 77 } // namespace internal |
| 66 } // namespace v8 | 78 } // namespace v8 |
| 67 | 79 |
| 68 #endif | 80 #endif |
| OLD | NEW |