Skip to content

Commit 401308f

Browse files
authored
[RISCV] Use a tablegen class for AltFmtType. NFC (llvm#163251)
This should provide stronger type checking to prevent misuse.
1 parent 0376b86 commit 401308f

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

llvm/lib/Target/RISCV/RISCVInstrFormats.td

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,21 @@ def EltDepsVL : EltDeps<vl=1, mask=0>;
177177
def EltDepsMask : EltDeps<vl=0, mask=1>;
178178
def EltDepsVLMask : EltDeps<vl=1, mask=1>;
179179

180-
class EEW <bits<2> val> {
180+
class EEW<bits<2> val> {
181181
bits<2> Value = val;
182182
}
183183
def EEW1 : EEW<0>;
184184
def EEWSEWx1 : EEW<1>;
185185
def EEWSEWx2 : EEW<2>;
186186
def EEWSEWx4 : EEW<3>;
187187

188+
class AltFmtType<bits<2> val> {
189+
bits<2> Value = val;
190+
}
191+
def DONT_CARE_ALTFMT : AltFmtType<0>;
192+
def IS_NOT_ALTFMT : AltFmtType<1>;
193+
def IS_ALTFMT : AltFmtType<2>;
194+
188195
class RVInstCommon<dag outs, dag ins, string opcodestr, string argstr,
189196
list<dag> pattern, InstFormat format> : Instruction {
190197
let Namespace = "RISCV";
@@ -271,8 +278,8 @@ class RVInstCommon<dag outs, dag ins, string opcodestr, string argstr,
271278
// 0 -> Don't care about altfmt bit in VTYPE.
272279
// 1 -> Is not altfmt.
273280
// 2 -> Is altfmt(BF16).
274-
bits<2> AltFmtType = 0;
275-
let TSFlags{28-27} = AltFmtType;
281+
AltFmtType AltFmtType = DONT_CARE_ALTFMT;
282+
let TSFlags{28-27} = AltFmtType.Value;
276283

277284
// XSfmmbase
278285
bit HasTWidenOp = 0;

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ defvar TAIL_AGNOSTIC = 1;
128128
defvar TU_MU = 0;
129129
defvar TA_MU = 1;
130130
defvar TA_MA = 3;
131-
defvar DONT_CARE_ALTFMT = 0;
132-
defvar IS_NOT_ALTFMT = 1;
133-
defvar IS_ALTFMT = 2;
134131

135132
//===----------------------------------------------------------------------===//
136133
// Utilities.

0 commit comments

Comments
 (0)