Skip to content

Commit f3fed53

Browse files
committed
[RISCV] Use the opcodestr and argstr arguments of Pseudo to simplify tablegen code. NFC
We can replace several "let AsmString =".
1 parent 049d6a3 commit f3fed53

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.td

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,10 +1545,9 @@ def : Pat<(brind (add GPRJALR:$rs1, simm12:$imm12)),
15451545
// Define isCodeGenOnly = 0 to support parsing assembly "call" instruction.
15461546
let isCall = 1, isBarrier = 1, isCodeGenOnly = 0, Size = 8, hasSideEffects = 0,
15471547
mayStore = 0, mayLoad = 0 in
1548-
def PseudoCALLReg : Pseudo<(outs GPR:$rd), (ins call_symbol:$func), []>,
1549-
Sched<[WriteIALU, WriteJalr, ReadJalr]> {
1550-
let AsmString = "call\t$rd, $func";
1551-
}
1548+
def PseudoCALLReg : Pseudo<(outs GPR:$rd), (ins call_symbol:$func), [],
1549+
"call", "$rd, $func">,
1550+
Sched<[WriteIALU, WriteJalr, ReadJalr]>;
15521551

15531552
// PseudoCALL is a pseudo instruction which will eventually expand to auipc
15541553
// and jalr while encoding. This is desirable, as an auipc+jalr pair with
@@ -1557,10 +1556,9 @@ def PseudoCALLReg : Pseudo<(outs GPR:$rd), (ins call_symbol:$func), []>,
15571556
// Define AsmString to print "call" when compile with -S flag.
15581557
// Define isCodeGenOnly = 0 to support parsing assembly "call" instruction.
15591558
let isCall = 1, Defs = [X1], isCodeGenOnly = 0, Size = 8 in
1560-
def PseudoCALL : Pseudo<(outs), (ins call_symbol:$func), []>,
1561-
Sched<[WriteIALU, WriteJalr, ReadJalr]> {
1562-
let AsmString = "call\t$func";
1563-
}
1559+
def PseudoCALL : Pseudo<(outs), (ins call_symbol:$func), [],
1560+
"call", "$func">,
1561+
Sched<[WriteIALU, WriteJalr, ReadJalr]>;
15641562

15651563
def : Pat<(riscv_call tglobaladdr:$func), (PseudoCALL tglobaladdr:$func)>;
15661564
def : Pat<(riscv_call texternalsym:$func), (PseudoCALL texternalsym:$func)>;
@@ -1582,10 +1580,9 @@ def PseudoRET : Pseudo<(outs), (ins), [(riscv_ret_glue)]>,
15821580
// Define AsmString to print "tail" when compile with -S flag.
15831581
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [X2],
15841582
Size = 8, isCodeGenOnly = 0 in
1585-
def PseudoTAIL : Pseudo<(outs), (ins call_symbol:$dst), []>,
1586-
Sched<[WriteIALU, WriteJalr, ReadJalr]> {
1587-
let AsmString = "tail\t$dst";
1588-
}
1583+
def PseudoTAIL : Pseudo<(outs), (ins call_symbol:$dst), [],
1584+
"tail", "$dst">,
1585+
Sched<[WriteIALU, WriteJalr, ReadJalr]>;
15891586

15901587
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [X2] in
15911588
def PseudoTAILIndirect : Pseudo<(outs), (ins GPRTC:$rs1),
@@ -1599,10 +1596,9 @@ def : Pat<(riscv_tail (iPTR texternalsym:$dst)),
15991596

16001597
let isCall = 0, isBarrier = 1, isBranch = 1, isTerminator = 1, Size = 8,
16011598
isCodeGenOnly = 0, hasSideEffects = 0, mayStore = 0, mayLoad = 0 in
1602-
def PseudoJump : Pseudo<(outs GPR:$rd), (ins pseudo_jump_symbol:$target), []>,
1603-
Sched<[WriteIALU, WriteJalr, ReadJalr]> {
1604-
let AsmString = "jump\t$target, $rd";
1605-
}
1599+
def PseudoJump : Pseudo<(outs GPR:$rd), (ins pseudo_jump_symbol:$target), [],
1600+
"jump", "$target, $rd">,
1601+
Sched<[WriteIALU, WriteJalr, ReadJalr]>;
16061602

16071603
let hasSideEffects = 0, mayLoad = 0, mayStore = 0, Size = 8, isCodeGenOnly = 0,
16081604
isAsmParserOnly = 1 in

0 commit comments

Comments
 (0)