[llvm] [AMDGPU] MCExpr-ify MC layer kernel descriptor (PR #80855)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 00:44:10 PST 2024
================
@@ -420,38 +421,41 @@ uint16_t AMDGPUAsmPrinter::getAmdhsaKernelCodeProperties(
return KernelCodeProperties;
}
-amdhsa::kernel_descriptor_t AMDGPUAsmPrinter::getAmdhsaKernelDescriptor(
- const MachineFunction &MF,
- const SIProgramInfo &PI) const {
+MCKernelDescriptor
+AMDGPUAsmPrinter::getAmdhsaKernelDescriptor(const MachineFunction &MF,
+ const SIProgramInfo &PI) const {
const GCNSubtarget &STM = MF.getSubtarget<GCNSubtarget>();
const Function &F = MF.getFunction();
const SIMachineFunctionInfo *Info = MF.getInfo<SIMachineFunctionInfo>();
- amdhsa::kernel_descriptor_t KernelDescriptor;
- memset(&KernelDescriptor, 0x0, sizeof(KernelDescriptor));
+ auto CreateExpr = [&MF](int64_t Value) {
+ return MCConstantExpr::create(Value, MF.getContext());
+ };
----------------
Pierre-vh wrote:
I suggested to use a lambda to reduce the noise, otherwise you end up with very verbose lines that have a ton of duplicate information (`MCConstantExpr::create(X, MF.getContext())` where only `X` changes)
https://github.com/llvm/llvm-project/pull/80855
More information about the llvm-commits
mailing list