@@ -156,28 +156,9 @@ def OPC_SYSTEM : RISCVOpcode<"SYSTEM", 0b1110011>;
156
156
def OPC_OP_P : RISCVOpcode<"OP_P", 0b1110111>;
157
157
def OPC_CUSTOM_3 : RISCVOpcode<"CUSTOM_3", 0b1111011>;
158
158
159
- class RVInst<dag outs, dag ins, string opcodestr, string argstr,
160
- list<dag> pattern, InstFormat format>
161
- : Instruction {
162
- field bits<32> Inst;
163
- // SoftFail is a field the disassembler can use to provide a way for
164
- // instructions to not match without killing the whole decode process. It is
165
- // mainly used for ARM, but Tablegen expects this field to exist or it fails
166
- // to build the decode table.
167
- field bits<32> SoftFail = 0;
168
- let Size = 4;
169
-
170
- bits<7> Opcode = 0;
171
-
172
- let Inst{6-0} = Opcode;
173
-
159
+ class RVInstCommon<InstFormat format> : Instruction {
174
160
let Namespace = "RISCV";
175
161
176
- dag OutOperandList = outs;
177
- dag InOperandList = ins;
178
- let AsmString = opcodestr # "\t" # argstr;
179
- let Pattern = pattern;
180
-
181
162
let TSFlags{4-0} = format.Value;
182
163
183
164
// Defaults
@@ -227,6 +208,27 @@ class RVInst<dag outs, dag ins, string opcodestr, string argstr,
227
208
let TSFlags{20} = UsesVXRM;
228
209
}
229
210
211
+ class RVInst<dag outs, dag ins, string opcodestr, string argstr,
212
+ list<dag> pattern, InstFormat format>
213
+ : RVInstCommon<format> {
214
+ field bits<32> Inst;
215
+ // SoftFail is a field the disassembler can use to provide a way for
216
+ // instructions to not match without killing the whole decode process. It is
217
+ // mainly used for ARM, but Tablegen expects this field to exist or it fails
218
+ // to build the decode table.
219
+ field bits<32> SoftFail = 0;
220
+ let Size = 4;
221
+
222
+ bits<7> Opcode = 0;
223
+
224
+ let Inst{6-0} = Opcode;
225
+
226
+ dag OutOperandList = outs;
227
+ dag InOperandList = ins;
228
+ let AsmString = opcodestr # "\t" # argstr;
229
+ let Pattern = pattern;
230
+ }
231
+
230
232
// Pseudo instructions
231
233
class Pseudo<dag outs, dag ins, list<dag> pattern, string opcodestr = "", string argstr = "">
232
234
: RVInst<outs, ins, opcodestr, argstr, pattern, InstFormatPseudo> {
0 commit comments