Skip to content

Commit e7c86f4

Browse files
committed
[RISCV] Use inheritance to reduce some repeated code in tablegen. NFC
The VLX and VSX searchable tables, share the same format so we can have a common base class for them.
1 parent d7350ef commit e7c86f4

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def RISCVVIntrinsicsTable : GenericTable {
413413
let PrimaryKeyName = "getRISCVVIntrinsicInfo";
414414
}
415415

416-
class RISCVVLX<bit M, bit O, bits<7> S, bits<3> L, bits<3> IL> {
416+
class RISCVVLX_VSX<bit M, bit O, bits<7> S, bits<3> L, bits<3> IL> {
417417
bits<1> Masked = M;
418418
bits<1> Ordered = O;
419419
bits<7> SEW = S;
@@ -422,28 +422,24 @@ class RISCVVLX<bit M, bit O, bits<7> S, bits<3> L, bits<3> IL> {
422422
Pseudo Pseudo = !cast<Pseudo>(NAME);
423423
}
424424

425-
def RISCVVLXTable : GenericTable {
426-
let FilterClass = "RISCVVLX";
425+
class RISCVVLX<bit M, bit O, bits<7> S, bits<3> L, bits<3> IL> :
426+
RISCVVLX_VSX<M, O, S, L, IL>;
427+
class RISCVVSX<bit M, bit O, bits<7> S, bits<3> L, bits<3> IL> :
428+
RISCVVLX_VSX<M, O, S, L, IL>;
429+
430+
class RISCVVLX_VSXTable : GenericTable {
427431
let CppTypeName = "VLX_VSXPseudo";
428432
let Fields = ["Masked", "Ordered", "SEW", "LMUL", "IndexLMUL", "Pseudo"];
429433
let PrimaryKey = ["Masked", "Ordered", "SEW", "LMUL", "IndexLMUL"];
430-
let PrimaryKeyName = "getVLXPseudo";
431434
}
432435

433-
class RISCVVSX<bit M, bit O, bits<7> S, bits<3> L, bits<3> IL> {
434-
bits<1> Masked = M;
435-
bits<1> Ordered = O;
436-
bits<7> SEW = S;
437-
bits<3> LMUL = L;
438-
bits<3> IndexLMUL = IL;
439-
Pseudo Pseudo = !cast<Pseudo>(NAME);
436+
def RISCVVLXTable : RISCVVLX_VSXTable {
437+
let FilterClass = "RISCVVLX";
438+
let PrimaryKeyName = "getVLXPseudo";
440439
}
441440

442-
def RISCVVSXTable : GenericTable {
441+
def RISCVVSXTable : RISCVVLX_VSXTable {
443442
let FilterClass = "RISCVVSX";
444-
let CppTypeName = "VLX_VSXPseudo";
445-
let Fields = ["Masked", "Ordered", "SEW", "LMUL", "IndexLMUL", "Pseudo"];
446-
let PrimaryKey = ["Masked", "Ordered", "SEW", "LMUL", "IndexLMUL"];
447443
let PrimaryKeyName = "getVSXPseudo";
448444
}
449445

0 commit comments

Comments
 (0)