[llvm] MCExpr-ify amd_kernel_code_t (PR #91587)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 05:09:01 PDT 2024


================
@@ -1331,24 +1332,27 @@ void AMDGPUAsmPrinter::getAmdKernelCode(amd_kernel_code_t &Out,
   const GCNSubtarget &STM = MF.getSubtarget<GCNSubtarget>();
   MCContext &Ctx = MF.getContext();
 
-  AMDGPU::initDefaultAMDKernelCodeT(Out, &STM);
+  Out.initDefault(&STM, Ctx, /*InitMCExpr=*/false);
 
-  Out.compute_pgm_resource_registers =
-      CurrentProgramInfo.getComputePGMRSrc1(STM) |
-      (CurrentProgramInfo.getComputePGMRSrc2() << 32);
+  Out.compute_pgm_resource1_registers =
+      CurrentProgramInfo.getComputePGMRSrc1(STM, Ctx);
+  Out.compute_pgm_resource2_registers =
+      CurrentProgramInfo.getComputePGMRSrc2(Ctx);
   Out.code_properties |= AMD_CODE_PROPERTY_IS_PTR64;
 
-  if (getMCExprValue(CurrentProgramInfo.DynamicCallStack, Ctx))
-    Out.code_properties |= AMD_CODE_PROPERTY_IS_DYNAMIC_CALLSTACK;
+  {
+    const MCExpr *Shift = MCConstantExpr::create(
+        AMD_CODE_PROPERTY_IS_DYNAMIC_CALLSTACK_SHIFT, Ctx);
+    Out.is_dynamic_callstack = MCBinaryExpr::createShl(
+        CurrentProgramInfo.DynamicCallStack, Shift, Ctx);
----------------
arsenm wrote:

I don't understand why this is a shift; if you're tracking the boolean property, it's just an or? The shift is just the bit position in the encoded struct? 

https://github.com/llvm/llvm-project/pull/91587


More information about the llvm-commits mailing list