@@ -18,7 +18,7 @@ def UImmLog2XLenNonZeroAsmOperand : AsmOperandClass {
18
18
let DiagnosticType = "InvalidUImmLog2XLenNonZero";
19
19
}
20
20
21
- def uimmlog2xlennonzero : Operand<XLenVT> , ImmLeaf<XLenVT, [{
21
+ def uimmlog2xlennonzero : RISCVOp , ImmLeaf<XLenVT, [{
22
22
if (Subtarget->is64Bit())
23
23
return isUInt<6>(Imm) && (Imm != 0);
24
24
return isUInt<5>(Imm) && (Imm != 0);
@@ -27,7 +27,6 @@ def uimmlog2xlennonzero : Operand<XLenVT>, ImmLeaf<XLenVT, [{
27
27
// TODO: should ensure invalid shamt is rejected when decoding.
28
28
let DecoderMethod = "decodeUImmNonZeroOperand<6>";
29
29
let OperandType = "OPERAND_UIMMLOG2XLEN_NONZERO";
30
- let OperandNamespace = "RISCVOp";
31
30
let MCOperandPredicate = [{
32
31
int64_t Imm;
33
32
if (!MCOp.evaluateAsConstantImm(Imm))
@@ -38,12 +37,7 @@ def uimmlog2xlennonzero : Operand<XLenVT>, ImmLeaf<XLenVT, [{
38
37
}];
39
38
}
40
39
41
- def simm6 : Operand<XLenVT>, ImmLeaf<XLenVT, [{return isInt<6>(Imm);}]> {
42
- let ParserMatchClass = SImmAsmOperand<6>;
43
- let EncoderMethod = "getImmOpValue";
44
- let DecoderMethod = "decodeSImmOperand<6>";
45
- let OperandType = "OPERAND_SIMM6";
46
- let OperandNamespace = "RISCVOp";
40
+ def simm6 : RISCVSImmLeafOp<6> {
47
41
let MCOperandPredicate = [{
48
42
int64_t Imm;
49
43
if (MCOp.evaluateAsConstantImm(Imm))
@@ -52,13 +46,12 @@ def simm6 : Operand<XLenVT>, ImmLeaf<XLenVT, [{return isInt<6>(Imm);}]> {
52
46
}];
53
47
}
54
48
55
- def simm6nonzero : Operand<XLenVT> ,
49
+ def simm6nonzero : RISCVOp ,
56
50
ImmLeaf<XLenVT, [{return (Imm != 0) && isInt<6>(Imm);}]> {
57
51
let ParserMatchClass = SImmAsmOperand<6, "NonZero">;
58
52
let EncoderMethod = "getImmOpValue";
59
53
let DecoderMethod = "decodeSImmNonZeroOperand<6>";
60
54
let OperandType = "OPERAND_SIMM6_NONZERO";
61
- let OperandNamespace = "RISCVOp";
62
55
let MCOperandPredicate = [{
63
56
int64_t Imm;
64
57
if (MCOp.evaluateAsConstantImm(Imm))
@@ -67,11 +60,10 @@ def simm6nonzero : Operand<XLenVT>,
67
60
}];
68
61
}
69
62
70
- def immzero : Operand<XLenVT> ,
63
+ def immzero : RISCVOp ,
71
64
ImmLeaf<XLenVT, [{return (Imm == 0);}]> {
72
65
let ParserMatchClass = ImmZeroAsmOperand;
73
66
let OperandType = "OPERAND_ZERO";
74
- let OperandNamespace = "RISCVOp";
75
67
}
76
68
77
69
def CLUIImmAsmOperand : AsmOperandClass {
@@ -86,15 +78,14 @@ def CLUIImmAsmOperand : AsmOperandClass {
86
78
// loaded in to bits 17-12 of the destination register and sign extended from
87
79
// bit 17. Therefore, this 6-bit immediate can represent values in the ranges
88
80
// [1, 31] and [0xfffe0, 0xfffff].
89
- def c_lui_imm : Operand<XLenVT> ,
81
+ def c_lui_imm : RISCVOp ,
90
82
ImmLeaf<XLenVT, [{return (Imm != 0) &&
91
83
(isUInt<5>(Imm) ||
92
84
(Imm >= 0xfffe0 && Imm <= 0xfffff));}]> {
93
85
let ParserMatchClass = CLUIImmAsmOperand;
94
86
let EncoderMethod = "getImmOpValue";
95
87
let DecoderMethod = "decodeCLUIImmOperand";
96
88
let OperandType = "OPERAND_CLUI_IMM";
97
- let OperandNamespace = "RISCVOp";
98
89
let MCOperandPredicate = [{
99
90
int64_t Imm;
100
91
if (MCOp.evaluateAsConstantImm(Imm))
@@ -105,13 +96,12 @@ def c_lui_imm : Operand<XLenVT>,
105
96
}
106
97
107
98
// A 7-bit unsigned immediate where the least significant two bits are zero.
108
- def uimm7_lsb00 : Operand<XLenVT> ,
99
+ def uimm7_lsb00 : RISCVOp ,
109
100
ImmLeaf<XLenVT, [{return isShiftedUInt<5, 2>(Imm);}]> {
110
101
let ParserMatchClass = UImmAsmOperand<7, "Lsb00">;
111
102
let EncoderMethod = "getImmOpValue";
112
103
let DecoderMethod = "decodeUImmOperand<7>";
113
104
let OperandType = "OPERAND_UIMM7_LSB00";
114
- let OperandNamespace = "RISCVOp";
115
105
let MCOperandPredicate = [{
116
106
int64_t Imm;
117
107
if (!MCOp.evaluateAsConstantImm(Imm))
@@ -121,13 +111,12 @@ def uimm7_lsb00 : Operand<XLenVT>,
121
111
}
122
112
123
113
// A 8-bit unsigned immediate where the least significant two bits are zero.
124
- def uimm8_lsb00 : Operand<XLenVT> ,
114
+ def uimm8_lsb00 : RISCVOp ,
125
115
ImmLeaf<XLenVT, [{return isShiftedUInt<6, 2>(Imm);}]> {
126
116
let ParserMatchClass = UImmAsmOperand<8, "Lsb00">;
127
117
let EncoderMethod = "getImmOpValue";
128
118
let DecoderMethod = "decodeUImmOperand<8>";
129
119
let OperandType = "OPERAND_UIMM8_LSB00";
130
- let OperandNamespace = "RISCVOp";
131
120
let MCOperandPredicate = [{
132
121
int64_t Imm;
133
122
if (!MCOp.evaluateAsConstantImm(Imm))
@@ -137,13 +126,12 @@ def uimm8_lsb00 : Operand<XLenVT>,
137
126
}
138
127
139
128
// A 8-bit unsigned immediate where the least significant three bits are zero.
140
- def uimm8_lsb000 : Operand<XLenVT> ,
129
+ def uimm8_lsb000 : RISCVOp ,
141
130
ImmLeaf<XLenVT, [{return isShiftedUInt<5, 3>(Imm);}]> {
142
131
let ParserMatchClass = UImmAsmOperand<8, "Lsb000">;
143
132
let EncoderMethod = "getImmOpValue";
144
133
let DecoderMethod = "decodeUImmOperand<8>";
145
134
let OperandType = "OPERAND_UIMM8_LSB000";
146
- let OperandNamespace = "RISCVOp";
147
135
let MCOperandPredicate = [{
148
136
int64_t Imm;
149
137
if (!MCOp.evaluateAsConstantImm(Imm))
@@ -170,13 +158,12 @@ def simm9_lsb0 : Operand<OtherVT>,
170
158
}
171
159
172
160
// A 9-bit unsigned immediate where the least significant three bits are zero.
173
- def uimm9_lsb000 : Operand<XLenVT> ,
161
+ def uimm9_lsb000 : RISCVOp ,
174
162
ImmLeaf<XLenVT, [{return isShiftedUInt<6, 3>(Imm);}]> {
175
163
let ParserMatchClass = UImmAsmOperand<9, "Lsb000">;
176
164
let EncoderMethod = "getImmOpValue";
177
165
let DecoderMethod = "decodeUImmOperand<9>";
178
166
let OperandType = "OPERAND_UIMM9_LSB000";
179
- let OperandNamespace = "RISCVOp";
180
167
let MCOperandPredicate = [{
181
168
int64_t Imm;
182
169
if (!MCOp.evaluateAsConstantImm(Imm))
@@ -187,14 +174,13 @@ def uimm9_lsb000 : Operand<XLenVT>,
187
174
188
175
// A 10-bit unsigned immediate where the least significant two bits are zero
189
176
// and the immediate can't be zero.
190
- def uimm10_lsb00nonzero : Operand<XLenVT> ,
177
+ def uimm10_lsb00nonzero : RISCVOp ,
191
178
ImmLeaf<XLenVT,
192
179
[{return isShiftedUInt<8, 2>(Imm) && (Imm != 0);}]> {
193
180
let ParserMatchClass = UImmAsmOperand<10, "Lsb00NonZero">;
194
181
let EncoderMethod = "getImmOpValue";
195
182
let DecoderMethod = "decodeUImmNonZeroOperand<10>";
196
183
let OperandType = "OPERAND_UIMM10_LSB00_NONZERO";
197
- let OperandNamespace = "RISCVOp";
198
184
let MCOperandPredicate = [{
199
185
int64_t Imm;
200
186
if (!MCOp.evaluateAsConstantImm(Imm))
@@ -204,14 +190,13 @@ def uimm10_lsb00nonzero : Operand<XLenVT>,
204
190
}
205
191
206
192
// A 10-bit signed immediate where the least significant four bits are zero.
207
- def simm10_lsb0000nonzero : Operand<XLenVT> ,
193
+ def simm10_lsb0000nonzero : RISCVOp ,
208
194
ImmLeaf<XLenVT,
209
195
[{return (Imm != 0) && isShiftedInt<6, 4>(Imm);}]> {
210
196
let ParserMatchClass = SImmAsmOperand<10, "Lsb0000NonZero">;
211
197
let EncoderMethod = "getImmOpValue";
212
198
let DecoderMethod = "decodeSImmNonZeroOperand<10>";
213
199
let OperandType = "OPERAND_SIMM10_LSB0000_NONZERO";
214
- let OperandNamespace = "RISCVOp";
215
200
let MCOperandPredicate = [{
216
201
int64_t Imm;
217
202
if (!MCOp.evaluateAsConstantImm(Imm))
@@ -243,11 +228,10 @@ def InsnCDirectiveOpcode : AsmOperandClass {
243
228
let PredicateMethod = "isImm";
244
229
}
245
230
246
- def uimm2_opcode : Operand<XLenVT> {
231
+ def uimm2_opcode : RISCVOp {
247
232
let ParserMatchClass = InsnCDirectiveOpcode;
248
233
let DecoderMethod = "decodeUImmOperand<2>";
249
234
let OperandType = "OPERAND_UIMM2";
250
- let OperandNamespace = "RISCVOp";
251
235
}
252
236
253
237
//===----------------------------------------------------------------------===//
0 commit comments