Skip to content

Commit 21d5017

Browse files
authored
[AMDGPU] Refactor FLAT_Load_Pseudo class (#146539)
NFC. Refactor it to make it easier to inherit from.
1 parent b697b80 commit 21d5017

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

llvm/lib/Target/AMDGPU/FLATInstructions.td

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,21 +208,26 @@ class GlobalSaddrTable <bit is_saddr, string Name = ""> {
208208
// TODO: Is exec allowed for saddr? The disabled value 0x7f is the
209209
// same encoding value as exec_hi, so it isn't possible to use that if
210210
// saddr is 32-bit (which isn't handled here yet).
211-
class FLAT_Load_Pseudo <string opName, RegisterClass regClass,
212-
bit HasTiedOutput = 0,
213-
bit HasSaddr = 0, bit EnableSaddr = 0,
214-
RegisterOperand vdata_op = getLdStRegisterOperand<regClass>.ret> : FLAT_Pseudo<
215-
opName,
216-
(outs vdata_op:$vdst),
217-
!con(
211+
class FLAT_Load_Pseudo<
212+
string opName, RegisterClass regClass, bit HasTiedOutput = 0,
213+
bit HasSaddr = 0, bit EnableSaddr = 0>
214+
: FLAT_Pseudo<opName, (outs), (ins), ""> {
215+
216+
defvar vdata_op = getLdStRegisterOperand<regClass>.ret;
217+
let OutOperandList = (outs vdata_op:$vdst);
218+
let InOperandList = !con(
218219
!if(EnableSaddr,
219-
(ins SReg_64_XEXEC_XNULL:$saddr, VGPR_32:$vaddr),
220-
(ins VReg_64:$vaddr)),
221-
(ins flat_offset:$offset),
222-
// FIXME: Operands with default values do not work with following non-optional operands.
223-
!if(HasTiedOutput, (ins CPol:$cpol, vdata_op:$vdst_in),
224-
(ins CPol_0:$cpol))),
225-
" $vdst, $vaddr"#!if(HasSaddr, !if(EnableSaddr, ", $saddr", ", off"), "")#"$offset$cpol"> {
220+
(ins SReg_64_XEXEC_XNULL:$saddr, VGPR_32:$vaddr),
221+
(ins VReg_64:$vaddr)),
222+
(ins flat_offset:$offset),
223+
// FIXME: Operands with default values do not work with following
224+
// non-optional operands.
225+
!if(HasTiedOutput, (ins CPol:$cpol, vdata_op:$vdst_in),
226+
(ins CPol_0:$cpol)));
227+
let AsmOperands = " $vdst, $vaddr"
228+
# !if(HasSaddr, !if(EnableSaddr, ", $saddr", ", off"), "")
229+
# "$offset$cpol";
230+
226231
let has_data = 0;
227232
let mayLoad = 1;
228233
let has_saddr = HasSaddr;

0 commit comments

Comments
 (0)