@@ -54,8 +54,11 @@ class HwModeSelect<list<HwMode> Ms> {
54
54
// patterns.
55
55
class ValueTypeByHwMode<list<HwMode> Ms, list<ValueType> Ts>
56
56
: HwModeSelect<Ms>, ValueType<0, 0> {
57
- // The length of this list must be the same as the length of Ms.
58
57
list<ValueType> Objects = Ts;
58
+
59
+ // The length of this list must be the same as the length of Ms.
60
+ assert !eq(!size(Objects), !size(Modes)),
61
+ "The Objects and Modes lists must be the same length";
59
62
}
60
63
61
64
// A class that implements a counterpart of PtrValueType, which is
@@ -79,8 +82,11 @@ class RegInfo<int RS, int SS, int SA> {
79
82
// The register size/alignment information, parameterized by a HW mode.
80
83
class RegInfoByHwMode<list<HwMode> Ms = [], list<RegInfo> Ts = []>
81
84
: HwModeSelect<Ms> {
82
- // The length of this list must be the same as the length of Ms.
83
85
list<RegInfo> Objects = Ts;
86
+
87
+ // The length of this list must be the same as the length of Ms.
88
+ assert !eq(!size(Objects), !size(Modes)),
89
+ "The Objects and Modes lists must be the same length";
84
90
}
85
91
86
92
class SubRegRange<int size, int offset = 0> {
@@ -90,8 +96,11 @@ class SubRegRange<int size, int offset = 0> {
90
96
91
97
class SubRegRangeByHwMode<list<HwMode> Ms = [], list<SubRegRange> Ts = []>
92
98
: HwModeSelect<Ms> {
93
- // The length of this list must be the same as the length of Ms.
94
99
list<SubRegRange> Objects = Ts;
100
+
101
+ // The length of this list must be the same as the length of Ms.
102
+ assert !eq(!size(Objects), !size(Modes)),
103
+ "The Objects and Modes lists must be the same length";
95
104
}
96
105
97
106
// SubRegIndex - Use instances of SubRegIndex to identify subregisters.
@@ -575,8 +584,11 @@ class InstructionEncoding {
575
584
// to encode and decode based on HwMode.
576
585
class EncodingByHwMode<list<HwMode> Ms = [], list<InstructionEncoding> Ts = []>
577
586
: HwModeSelect<Ms> {
578
- // The length of this list must be the same as the length of Ms.
579
587
list<InstructionEncoding> Objects = Ts;
588
+
589
+ // The length of this list must be the same as the length of Ms.
590
+ assert !eq(!size(Objects), !size(Modes)),
591
+ "The Objects and Modes lists must be the same length";
580
592
}
581
593
582
594
//===----------------------------------------------------------------------===//
0 commit comments