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
3 // found in the LICENSE file.
5 #ifndef V8_REGISTER_ALLOCATOR_VERIFIER_H_
6 #define V8_REGISTER_ALLOCATOR_VERIFIER_H_
8 #include "src/zone-containers.h"
14 class InstructionOperand;
15 class InstructionSequence;
17 class RegisterAllocatorVerifier FINAL : public ZoneObject {
19 RegisterAllocatorVerifier(Zone* zone, const RegisterConfiguration* config,
20 const InstructionSequence* sequence);
22 void VerifyAssignment();
23 void VerifyGapMoves();
39 struct OperandConstraint {
41 int value_; // subkind index when relevant
42 int virtual_register_;
45 struct InstructionConstraint {
46 const Instruction* instruction_;
47 size_t operand_constaints_size_;
48 OperandConstraint* operand_constraints_;
53 typedef ZoneVector<InstructionConstraint> Constraints;
55 Zone* zone() const { return zone_; }
56 const RegisterConfiguration* config() { return config_; }
57 const InstructionSequence* sequence() const { return sequence_; }
58 Constraints* constraints() { return &constraints_; }
60 static void VerifyInput(const OperandConstraint& constraint);
61 static void VerifyTemp(const OperandConstraint& constraint);
62 static void VerifyOutput(const OperandConstraint& constraint);
64 void BuildConstraint(const InstructionOperand* op,
65 OperandConstraint* constraint);
66 void CheckConstraint(const InstructionOperand* op,
67 const OperandConstraint* constraint);
69 void VerifyGapMoves(BlockMaps* outgoing_mappings, bool initial_pass);
72 const RegisterConfiguration* config_;
73 const InstructionSequence* const sequence_;
74 Constraints constraints_;
76 DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorVerifier);
79 } // namespace compiler
80 } // namespace internal