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();
41 struct OperandConstraint {
43 int value_; // subkind index when relevant
44 int virtual_register_;
47 struct InstructionConstraint {
48 const Instruction* instruction_;
49 size_t operand_constaints_size_;
50 OperandConstraint* operand_constraints_;
55 typedef ZoneVector<InstructionConstraint> Constraints;
57 Zone* zone() const { return zone_; }
58 const RegisterConfiguration* config() { return config_; }
59 const InstructionSequence* sequence() const { return sequence_; }
60 Constraints* constraints() { return &constraints_; }
62 static void VerifyInput(const OperandConstraint& constraint);
63 static void VerifyTemp(const OperandConstraint& constraint);
64 static void VerifyOutput(const OperandConstraint& constraint);
66 void BuildConstraint(const InstructionOperand* op,
67 OperandConstraint* constraint);
68 void CheckConstraint(const InstructionOperand* op,
69 const OperandConstraint* constraint);
71 void VerifyGapMoves(BlockMaps* outgoing_mappings, bool initial_pass);
74 const RegisterConfiguration* config_;
75 const InstructionSequence* const sequence_;
76 Constraints constraints_;
78 DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorVerifier);
81 } // namespace compiler
82 } // namespace internal