diff --git a/llvm/lib/Target/RISCV/RISCVInstrFormats.td b/llvm/lib/Target/RISCV/RISCVInstrFormats.td --- a/llvm/lib/Target/RISCV/RISCVInstrFormats.td +++ b/llvm/lib/Target/RISCV/RISCVInstrFormats.td @@ -156,28 +156,9 @@ def OPC_OP_P : RISCVOpcode<"OP_P", 0b1110111>; def OPC_CUSTOM_3 : RISCVOpcode<"CUSTOM_3", 0b1111011>; -class RVInst pattern, InstFormat format> - : Instruction { - field bits<32> Inst; - // SoftFail is a field the disassembler can use to provide a way for - // instructions to not match without killing the whole decode process. It is - // mainly used for ARM, but Tablegen expects this field to exist or it fails - // to build the decode table. - field bits<32> SoftFail = 0; - let Size = 4; - - bits<7> Opcode = 0; - - let Inst{6-0} = Opcode; - +class RVInstCommon : Instruction { let Namespace = "RISCV"; - dag OutOperandList = outs; - dag InOperandList = ins; - let AsmString = opcodestr # "\t" # argstr; - let Pattern = pattern; - let TSFlags{4-0} = format.Value; // Defaults @@ -227,6 +208,27 @@ let TSFlags{20} = UsesVXRM; } +class RVInst pattern, InstFormat format> + : RVInstCommon { + field bits<32> Inst; + // SoftFail is a field the disassembler can use to provide a way for + // instructions to not match without killing the whole decode process. It is + // mainly used for ARM, but Tablegen expects this field to exist or it fails + // to build the decode table. + field bits<32> SoftFail = 0; + let Size = 4; + + bits<7> Opcode = 0; + + let Inst{6-0} = Opcode; + + dag OutOperandList = outs; + dag InOperandList = ins; + let AsmString = opcodestr # "\t" # argstr; + let Pattern = pattern; +} + // Pseudo instructions class Pseudo pattern, string opcodestr = "", string argstr = ""> : RVInst { diff --git a/llvm/lib/Target/RISCV/RISCVInstrFormatsC.td b/llvm/lib/Target/RISCV/RISCVInstrFormatsC.td --- a/llvm/lib/Target/RISCV/RISCVInstrFormatsC.td +++ b/llvm/lib/Target/RISCV/RISCVInstrFormatsC.td @@ -12,7 +12,7 @@ class RVInst16 pattern, InstFormat format> - : Instruction { + : RVInstCommon { field bits<16> Inst; // SoftFail is a field the disassembler can use to provide a way for // instructions to not match without killing the whole decode process. It is @@ -23,14 +23,10 @@ bits<2> Opcode = 0; - let Namespace = "RISCV"; - dag OutOperandList = outs; dag InOperandList = ins; let AsmString = opcodestr # "\t" # argstr; let Pattern = pattern; - - let TSFlags{4-0} = format.Value; } class RVInst16CR funct4, bits<2> opcode, dag outs, dag ins,