Skip to content

Commit 1479fe8

Browse files
committed
[X86][NFC] Rename variables and define a var for duplicated strings in X86InstrArithmetic.td
This patch is to extract the NFC in #76319 into a separate commit.
1 parent 51b988e commit 1479fe8

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

llvm/lib/Target/X86/X86InstrArithmetic.td

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def PLEA64r : PseudoI<(outs GR64:$dst), (ins anymem:$src), []>;
4747
// BinOpRR - Instructions that read "reg, reg".
4848
class BinOpRR<bits<8> o, string m, X86TypeInfo t, dag out, list<dag> p>
4949
: ITy<o, MRMDestReg, t, out, (ins t.RegClass:$src1, t.RegClass:$src2), m,
50-
"{$src2, $src1|$src1, $src2}", p>, Sched<[WriteALU]>;
50+
binop_args, p>, Sched<[WriteALU]>;
5151
// BinOpRR_F - Instructions that read "reg, reg" and write EFLAGS only.
5252
class BinOpRR_F<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node>
5353
: BinOpRR<o, m, t, (outs),
@@ -86,7 +86,7 @@ class BinOpRRF_RF_Rev<bits<8> o, string m, X86TypeInfo t>
8686
// BinOpRM - Instructions that read "reg, [mem]".
8787
class BinOpRM<bits<8> o, string m, X86TypeInfo t, dag out, list<dag> p>
8888
: ITy<o, MRMSrcMem, t, out, (ins t.RegClass:$src1, t.MemOperand:$src2), m,
89-
"{$src2, $src1|$src1, $src2}", p>,
89+
binop_args, p>,
9090
Sched<[WriteALU.Folded, WriteALU.ReadAfterFold]> {
9191
let mayLoad = 1;
9292
}
@@ -117,7 +117,7 @@ class BinOpRMF_RF<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node>
117117
// BinOpRI - Instructions that read "reg, imm".
118118
class BinOpRI<bits<8> o, string m, X86TypeInfo t, Format f, dag out, list<dag> p>
119119
: ITy<o, f, t, out, (ins t.RegClass:$src1, t.ImmOperand:$src2), m,
120-
"{$src2, $src1|$src1, $src2}", p>, Sched<[WriteALU]> {
120+
binop_args, p>, Sched<[WriteALU]> {
121121
let ImmT = t.ImmEncoding;
122122
}
123123
// BinOpRI_F - Instructions that read "reg, imm" and write EFLAGS only.
@@ -143,7 +143,7 @@ class BinOpRIF_RF<bits<8> o, string m, X86TypeInfo t, SDNode node, Format f>
143143
// BinOpRI8 - Instructions that read "reg, imm8".
144144
class BinOpRI8<bits<8> o, string m, X86TypeInfo t, Format f, dag out>
145145
: ITy<o, f, t, out, (ins t.RegClass:$src1, t.Imm8Operand:$src2), m,
146-
"{$src2, $src1|$src1, $src2}", []>, Sched<[WriteALU]> {
146+
binop_args, []>, Sched<[WriteALU]> {
147147
let ImmT = Imm8;
148148
}
149149
// BinOpRI8_F - Instructions that read "reg, imm8" and write EFLAGS only.
@@ -161,20 +161,20 @@ class BinOpRI8F_RF<bits<8> o, string m, X86TypeInfo t, Format f>
161161

162162
// BinOpMR - Instructions that read "[mem], reg".
163163
class BinOpMR<bits<8> o, string m, X86TypeInfo t, list<dag> p>
164-
: ITy<o, MRMDestMem, t, (outs), (ins t.MemOperand:$dst, t.RegClass:$src), m,
165-
"{$src, $dst|$dst, $src}", p> {
164+
: ITy<o, MRMDestMem, t, (outs), (ins t.MemOperand:$src1, t.RegClass:$src2), m,
165+
binop_args, p> {
166166
let mayLoad = 1;
167167
}
168168
// BinOpMR_F - Instructions that read "[mem], imm8" and write EFLAGS only.
169169
class BinOpMR_F<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node>
170170
: BinOpMR<o, m, t,
171-
[(set EFLAGS, (node (t.LoadNode addr:$dst), t.RegClass:$src))]>,
171+
[(set EFLAGS, (node (t.LoadNode addr:$src1), t.RegClass:$src2))]>,
172172
Sched<[WriteALU.Folded, ReadDefault, ReadDefault, ReadDefault,
173173
ReadDefault, ReadDefault, WriteALU.ReadAfterFold]>, DefEFLAGS;
174174
// BinOpMR_MF - Instructions that read "[mem], reg" and write "[mem]", EFLAGS.
175175
class BinOpMR_MF<bits<8> o, string m, X86TypeInfo t, SDNode node>
176176
: BinOpMR<o, m, t,
177-
[(store (node (load addr:$dst), t.RegClass:$src), addr:$dst),
177+
[(store (node (load addr:$src1), t.RegClass:$src2), addr:$src1),
178178
(implicit EFLAGS)]>,
179179
Sched<[WriteALURMW,
180180
// base, scale, index, offset, segment
@@ -187,8 +187,8 @@ class BinOpMR_MF<bits<8> o, string m, X86TypeInfo t, SDNode node>
187187
// read/write EFLAGS.
188188
class BinOpMRF_MF<bits<8> o, string m, X86TypeInfo t, SDNode node>
189189
: BinOpMR<o, m, t,
190-
[(store (node (load addr:$dst), t.RegClass:$src, EFLAGS),
191-
addr:$dst), (implicit EFLAGS)]>,
190+
[(store (node (load addr:$src1), t.RegClass:$src2, EFLAGS),
191+
addr:$src1), (implicit EFLAGS)]>,
192192
Sched<[WriteADCRMW,
193193
// base, scale, index, offset, segment
194194
ReadDefault, ReadDefault, ReadDefault,
@@ -201,39 +201,39 @@ class BinOpMRF_MF<bits<8> o, string m, X86TypeInfo t, SDNode node>
201201

202202
// BinOpMI - Instructions that read "[mem], imm".
203203
class BinOpMI<bits<8> o, string m, X86TypeInfo t, Format f, list<dag> p>
204-
: ITy<o, f, t, (outs), (ins t.MemOperand:$dst, t.ImmOperand:$src), m,
205-
"{$src, $dst|$dst, $src}", p> {
204+
: ITy<o, f, t, (outs), (ins t.MemOperand:$src1, t.ImmOperand:$src2), m,
205+
binop_args, p> {
206206
let ImmT = t.ImmEncoding;
207207
let mayLoad = 1;
208208
}
209209
// BinOpMI_F - Instructions that read "[mem], imm" and write EFLAGS only.
210210
class BinOpMI_F<bits<8> o, string m, X86TypeInfo t, SDPatternOperator node,
211211
Format f>
212212
: BinOpMI<o, m, t, f,
213-
[(set EFLAGS, (node (t.LoadNode addr:$dst), t.ImmOperator:$src))]>,
213+
[(set EFLAGS, (node (t.LoadNode addr:$src1), t.ImmOperator:$src2))]>,
214214
Sched<[WriteALU.Folded]>, DefEFLAGS;
215215
// BinOpMI_MF - Instructions that read "[mem], imm" and write "[mem]", EFLAGS.
216216
class BinOpMI_MF<bits<8> o, string m, X86TypeInfo t, SDNode node, Format f>
217217
: BinOpMI<o, m, t, f,
218-
[(store (node (t.VT (load addr:$dst)),
219-
t.ImmOperator:$src), addr:$dst), (implicit EFLAGS)]>,
218+
[(store (node (t.VT (load addr:$src1)),
219+
t.ImmOperator:$src2), addr:$src1), (implicit EFLAGS)]>,
220220
Sched<[WriteALURMW]>, DefEFLAGS {
221221
let mayStore = 1;
222222
}
223223
// BinOpMIF_MF - Instructions that read "[mem], imm", write "[mem]" and
224224
// read/write EFLAGS.
225225
class BinOpMIF_MF<bits<8> o, string m, X86TypeInfo t, SDNode node, Format f>
226226
: BinOpMI<o, m, t, f,
227-
[(store (node (t.VT (load addr:$dst)),
228-
t.ImmOperator:$src, EFLAGS), addr:$dst), (implicit EFLAGS)]>,
227+
[(store (node (t.VT (load addr:$src1)),
228+
t.ImmOperator:$src2, EFLAGS), addr:$src1), (implicit EFLAGS)]>,
229229
Sched<[WriteADCRMW]>, DefEFLAGS, UseEFLAGS {
230230
let mayStore = 1;
231231
}
232232

233233
// BinOpMI8 - Instructions that read "[mem], imm8".
234234
class BinOpMI8<string m, X86TypeInfo t, Format f>
235-
: ITy<0x83, f, t, (outs), (ins t.MemOperand:$dst, t.Imm8Operand:$src), m,
236-
"{$src, $dst|$dst, $src}", []> {
235+
: ITy<0x83, f, t, (outs), (ins t.MemOperand:$src1, t.Imm8Operand:$src2), m,
236+
binop_args, []> {
237237
let ImmT = Imm8;
238238
let mayLoad = 1;
239239
}

llvm/lib/Target/X86/X86InstrUtils.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,3 +967,5 @@ class ITy<bits<8> opcode, Format f, X86TypeInfo typeinfo, dag outs, dag ins,
967967
let hasSideEffects = 0;
968968
let hasREX_W = typeinfo.HasREX_W;
969969
}
970+
971+
defvar binop_args = "{$src2, $src1|$src1, $src2}";

0 commit comments

Comments
 (0)