Skip to content

Commit de6abb4

Browse files
committed
[AIEX] NFC: Share more common code in AIEBaseInst
1 parent eb110ab commit de6abb4

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

llvm/lib/Target/AIE/AIE2InstrFormats.td

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ include "AIE2GenInstrFormats.td"
1616
// Pseudo instructions
1717
class Pseudo<dag outs, dag ins, string opcodestr = "",
1818
string argstr = "">
19-
: AIE2Inst<outs, ins, opcodestr, argstr> {
20-
let isPseudo = 1;
21-
let isCodeGenOnly = 1;
22-
let isComposite = 0;
23-
}
19+
: AIE2Inst<outs, ins, opcodestr, argstr>, AIEPseudoInstrAttributes {}
2420

2521
// MultiSlot Pseudo instruction: Use this to define Pseudo for multi slot instructions
2622
// This instruction could be materialized to different VLIW slots.

llvm/lib/Target/AIE/AIE2Slots.td

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ let Namespace = "AIE2" in
6666

6767

6868
class AIE2Inst<dag outs, dag ins, string opcodestr, string argstr>
69-
: AIEBaseInst <outs, ins, []> {
70-
field bits<32> dontcare = 0;
71-
let Namespace = "AIE2";
72-
let AsmString = opcodestr # "\t" # argstr;
73-
}
69+
: AIEBaseInst <outs, ins, [], opcodestr, argstr, "AIE2"> {}
7470

7571
class AIE2SlotInst<InstSlot slot,
7672
dag outs, dag ins, string opcodestr, string argstr>

llvm/lib/Target/AIE/AIEBaseInstrFormats.td

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,25 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
class AIEBaseInst<dag outs, dag ins, list<dag> pattern>
15+
class AIEBaseInst<dag outs, dag ins, list<dag> pattern, string opcodestr, string argstr, string namespace>
1616
: Instruction, InstFormat {
1717
let Size = 4;
1818
dag OutOperandList = outs;
1919
dag InOperandList = ins;
2020
let Pattern = pattern;
21-
let isComposite = 0;
21+
let isComposite = false;
22+
let Namespace = namespace;
23+
let AsmString = opcodestr # "\t" # argstr;
24+
25+
// A scratchpad of bits that is used in the encoding to say "these bits do not
26+
// matter for encoding or decoding".
27+
field bits<32> dontcare = 0;
28+
}
29+
30+
// Attributes for Pseudo instructions
31+
class AIEPseudoInstrAttributes {
32+
field bit isPseudo;
33+
field bit isCodeGenOnly;
34+
let isPseudo = true;
35+
let isCodeGenOnly = true;
2236
}

llvm/lib/Target/AIE/AIEInstrFormats.td

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,14 @@ def OPC_ALU_R_R_ABS : AIEOpcode_ALU_R_R<0b1000>;
138138

139139
class AIEInst<dag outs, dag ins, string opcodestr, string argstr,
140140
list<dag> pattern>
141-
: AIEBaseInst<outs, ins, pattern>
142-
{
143-
let Namespace = "AIE";
144-
145-
let AsmString = opcodestr # "\t" # argstr;
146-
141+
: AIEBaseInst<outs, ins, pattern, opcodestr, argstr, "AIE"> {
147142
// Default value of the slot
148143
let Slot = unknown_slot;
149144
}
150145

151146
// Pseudo instructions
152147
class Pseudo<dag outs, dag ins, list<dag> pattern, string opcodestr = "", string argstr = "">
153-
: AIEInst<outs, ins, opcodestr, argstr, pattern> {
154-
let isPseudo = 1;
155-
let isCodeGenOnly = 1;
156-
}
148+
: AIEInst<outs, ins, opcodestr, argstr, pattern>, AIEPseudoInstrAttributes {}
157149

158150
//////////////////////////
159151
// Instruction classes

0 commit comments

Comments
 (0)