|
22 | 22 | #include "AMDKernelCodeT.h"
|
23 | 23 | #include "GCNSubtarget.h"
|
24 | 24 | #include "MCTargetDesc/AMDGPUInstPrinter.h"
|
| 25 | +#include "MCTargetDesc/AMDGPUMCKernelDescriptor.h" |
25 | 26 | #include "MCTargetDesc/AMDGPUTargetStreamer.h"
|
26 | 27 | #include "R600AsmPrinter.h"
|
27 | 28 | #include "SIMachineFunctionInfo.h"
|
@@ -428,38 +429,43 @@ uint16_t AMDGPUAsmPrinter::getAmdhsaKernelCodeProperties(
|
428 | 429 | return KernelCodeProperties;
|
429 | 430 | }
|
430 | 431 |
|
431 |
| -amdhsa::kernel_descriptor_t AMDGPUAsmPrinter::getAmdhsaKernelDescriptor( |
432 |
| - const MachineFunction &MF, |
433 |
| - const SIProgramInfo &PI) const { |
| 432 | +MCKernelDescriptor |
| 433 | +AMDGPUAsmPrinter::getAmdhsaKernelDescriptor(const MachineFunction &MF, |
| 434 | + const SIProgramInfo &PI) const { |
434 | 435 | const GCNSubtarget &STM = MF.getSubtarget<GCNSubtarget>();
|
435 | 436 | const Function &F = MF.getFunction();
|
436 | 437 | const SIMachineFunctionInfo *Info = MF.getInfo<SIMachineFunctionInfo>();
|
| 438 | + MCContext &Ctx = MF.getContext(); |
437 | 439 |
|
438 |
| - amdhsa::kernel_descriptor_t KernelDescriptor; |
439 |
| - memset(&KernelDescriptor, 0x0, sizeof(KernelDescriptor)); |
| 440 | + MCKernelDescriptor KernelDescriptor; |
440 | 441 |
|
441 | 442 | assert(isUInt<32>(PI.ScratchSize));
|
442 | 443 | assert(isUInt<32>(PI.getComputePGMRSrc1(STM)));
|
443 | 444 | assert(isUInt<32>(PI.getComputePGMRSrc2()));
|
444 | 445 |
|
445 |
| - KernelDescriptor.group_segment_fixed_size = PI.LDSSize; |
446 |
| - KernelDescriptor.private_segment_fixed_size = PI.ScratchSize; |
| 446 | + KernelDescriptor.group_segment_fixed_size = |
| 447 | + MCConstantExpr::create(PI.LDSSize, Ctx); |
| 448 | + KernelDescriptor.private_segment_fixed_size = |
| 449 | + MCConstantExpr::create(PI.ScratchSize, Ctx); |
447 | 450 |
|
448 | 451 | Align MaxKernArgAlign;
|
449 |
| - KernelDescriptor.kernarg_size = STM.getKernArgSegmentSize(F, MaxKernArgAlign); |
| 452 | + KernelDescriptor.kernarg_size = MCConstantExpr::create( |
| 453 | + STM.getKernArgSegmentSize(F, MaxKernArgAlign), Ctx); |
450 | 454 |
|
451 |
| - KernelDescriptor.compute_pgm_rsrc1 = PI.getComputePGMRSrc1(STM); |
452 |
| - KernelDescriptor.compute_pgm_rsrc2 = PI.getComputePGMRSrc2(); |
453 |
| - KernelDescriptor.kernel_code_properties = getAmdhsaKernelCodeProperties(MF); |
| 455 | + KernelDescriptor.compute_pgm_rsrc1 = |
| 456 | + MCConstantExpr::create(PI.getComputePGMRSrc1(STM), Ctx); |
| 457 | + KernelDescriptor.compute_pgm_rsrc2 = |
| 458 | + MCConstantExpr::create(PI.getComputePGMRSrc2(), Ctx); |
| 459 | + KernelDescriptor.kernel_code_properties = |
| 460 | + MCConstantExpr::create(getAmdhsaKernelCodeProperties(MF), Ctx); |
454 | 461 |
|
455 | 462 | assert(STM.hasGFX90AInsts() || CurrentProgramInfo.ComputePGMRSrc3GFX90A == 0);
|
456 |
| - if (STM.hasGFX90AInsts()) |
457 |
| - KernelDescriptor.compute_pgm_rsrc3 = |
458 |
| - CurrentProgramInfo.ComputePGMRSrc3GFX90A; |
| 463 | + KernelDescriptor.compute_pgm_rsrc3 = MCConstantExpr::create( |
| 464 | + STM.hasGFX90AInsts() ? CurrentProgramInfo.ComputePGMRSrc3GFX90A : 0, Ctx); |
459 | 465 |
|
460 |
| - if (AMDGPU::hasKernargPreload(STM)) |
461 |
| - KernelDescriptor.kernarg_preload = |
462 |
| - static_cast<uint16_t>(Info->getNumKernargPreloadedSGPRs()); |
| 466 | + KernelDescriptor.kernarg_preload = MCConstantExpr::create( |
| 467 | + AMDGPU::hasKernargPreload(STM) ? Info->getNumKernargPreloadedSGPRs() : 0, |
| 468 | + Ctx); |
463 | 469 |
|
464 | 470 | return KernelDescriptor;
|
465 | 471 | }
|
|
0 commit comments