From 2e335019ae6f786d51e89739190f4910dd034464 Mon Sep 17 00:00:00 2001 From: Joseph Nash Date: Tue, 1 Jul 2025 10:21:24 -0400 Subject: [PATCH] [AMDGPU] Refactor FLAT_Load_Pseudo class NFC. Refactor it to make it easier to inherit from. --- llvm/lib/Target/AMDGPU/FLATInstructions.td | 33 +++++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/FLATInstructions.td b/llvm/lib/Target/AMDGPU/FLATInstructions.td index dc6dbcef1f033..9ae98de039e34 100644 --- a/llvm/lib/Target/AMDGPU/FLATInstructions.td +++ b/llvm/lib/Target/AMDGPU/FLATInstructions.td @@ -208,21 +208,26 @@ class GlobalSaddrTable { // TODO: Is exec allowed for saddr? The disabled value 0x7f is the // same encoding value as exec_hi, so it isn't possible to use that if // saddr is 32-bit (which isn't handled here yet). -class FLAT_Load_Pseudo .ret> : FLAT_Pseudo< - opName, - (outs vdata_op:$vdst), - !con( +class FLAT_Load_Pseudo< + string opName, RegisterClass regClass, bit HasTiedOutput = 0, + bit HasSaddr = 0, bit EnableSaddr = 0> + : FLAT_Pseudo { + + defvar vdata_op = getLdStRegisterOperand.ret; + let OutOperandList = (outs vdata_op:$vdst); + let InOperandList = !con( !if(EnableSaddr, - (ins SReg_64_XEXEC_XNULL:$saddr, VGPR_32:$vaddr), - (ins VReg_64:$vaddr)), - (ins flat_offset:$offset), - // FIXME: Operands with default values do not work with following non-optional operands. - !if(HasTiedOutput, (ins CPol:$cpol, vdata_op:$vdst_in), - (ins CPol_0:$cpol))), - " $vdst, $vaddr"#!if(HasSaddr, !if(EnableSaddr, ", $saddr", ", off"), "")#"$offset$cpol"> { + (ins SReg_64_XEXEC_XNULL:$saddr, VGPR_32:$vaddr), + (ins VReg_64:$vaddr)), + (ins flat_offset:$offset), + // FIXME: Operands with default values do not work with following + // non-optional operands. + !if(HasTiedOutput, (ins CPol:$cpol, vdata_op:$vdst_in), + (ins CPol_0:$cpol))); + let AsmOperands = " $vdst, $vaddr" + # !if(HasSaddr, !if(EnableSaddr, ", $saddr", ", off"), "") + # "$offset$cpol"; + let has_data = 0; let mayLoad = 1; let has_saddr = HasSaddr;