LLVM 23.0.0git
AMDGPUTargetStreamer.cpp
Go to the documentation of this file.
1//===-- AMDGPUTargetStreamer.cpp - Mips Target Streamer Methods -----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file provides AMDGPU specific target streamer methods.
10//
11//===----------------------------------------------------------------------===//
12
14#include "AMDGPUMCExpr.h"
16#include "AMDGPUMCTargetDesc.h"
17#include "AMDGPUPTNote.h"
22#include "llvm/MC/MCAsmInfo.h"
23#include "llvm/MC/MCAssembler.h"
24#include "llvm/MC/MCContext.h"
33
34using namespace llvm;
35using namespace llvm::AMDGPU;
36
37//===----------------------------------------------------------------------===//
38// AMDGPUTargetStreamer
39//===----------------------------------------------------------------------===//
40
42 ForceGenericVersion("amdgpu-force-generic-version",
43 cl::desc("Force a specific generic_v<N> flag to be "
44 "added. For testing purposes only."),
46
48 msgpack::Document HSAMetadataDoc;
49 if (!HSAMetadataDoc.fromYAML(HSAMetadataString))
50 return false;
51 return EmitHSAMetadata(HSAMetadataDoc, false);
52}
53
56
57 // clang-format off
58 switch (ElfMach) {
59 case ELF::EF_AMDGPU_MACH_R600_R600: AK = GK_R600; break;
60 case ELF::EF_AMDGPU_MACH_R600_R630: AK = GK_R630; break;
70 case ELF::EF_AMDGPU_MACH_R600_SUMO: AK = GK_SUMO; break;
131 case ELF::EF_AMDGPU_MACH_NONE: AK = GK_NONE; break;
132 default: AK = GK_NONE; break;
133 }
134 // clang-format on
135
136 StringRef GPUName = getArchNameAMDGCN(AK);
137 if (GPUName != "")
138 return GPUName;
139 return getArchNameR600(AK);
140}
141
144 if (AK == AMDGPU::GPUKind::GK_NONE)
145 AK = parseArchR600(GPU);
146
147 // clang-format off
148 switch (AK) {
222 }
223 // clang-format on
224
225 llvm_unreachable("unknown GPU");
226}
227
228//===----------------------------------------------------------------------===//
229// AMDGPUTargetAsmStreamer
230//===----------------------------------------------------------------------===//
231
235
236// A hook for emitting stuff at the end.
237// We use it for emitting the accumulated PAL metadata as directives.
238// The PAL metadata is reset after it is emitted.
240 std::string S;
242 OS << S;
243
244 // Reset the pal metadata so its data will not affect a compilation that
245 // reuses this object.
247}
248
250 OS << "\t.amdgcn_target \"" << *getTargetID() << "\"\n";
251}
252
254 unsigned COV) {
256 OS << "\t.amdhsa_code_object_version " << COV << '\n';
257}
258
260 auto FoldAndPrint = [&](const MCExpr *Expr, raw_ostream &OS,
261 const MCAsmInfo *MAI) {
263 };
264
265 OS << "\t.amd_kernel_code_t\n";
266 Header.EmitKernelCodeT(OS, getContext(), FoldAndPrint);
267 OS << "\t.end_amd_kernel_code_t\n";
268}
269
271 unsigned Type) {
272 switch (Type) {
273 default: llvm_unreachable("Invalid AMDGPU symbol type");
275 OS << "\t.amdgpu_hsa_kernel " << SymbolName << '\n' ;
276 break;
277 }
278}
279
281 Align Alignment) {
282 OS << "\t.amdgpu_lds " << Symbol->getName() << ", " << Size << ", "
283 << Alignment.value() << '\n';
284}
285
287 const MCSymbol *NumVGPR, const MCSymbol *NumAGPR,
288 const MCSymbol *NumExplicitSGPR, const MCSymbol *NumNamedBarrier,
289 const MCSymbol *PrivateSegmentSize, const MCSymbol *UsesVCC,
290 const MCSymbol *UsesFlatScratch, const MCSymbol *HasDynamicallySizedStack,
291 const MCSymbol *HasRecursion, const MCSymbol *HasIndirectCall) {
292#define PRINT_RES_INFO(ARG) \
293 OS << "\t.set "; \
294 ARG->print(OS, getContext().getAsmInfo()); \
295 OS << ", "; \
296 getContext().getAsmInfo()->printExpr(OS, *ARG->getVariableValue()); \
297 Streamer.addBlankLine();
298
299 PRINT_RES_INFO(NumVGPR);
300 PRINT_RES_INFO(NumAGPR);
301 PRINT_RES_INFO(NumExplicitSGPR);
302 PRINT_RES_INFO(NumNamedBarrier);
303 PRINT_RES_INFO(PrivateSegmentSize);
304 PRINT_RES_INFO(UsesVCC);
305 PRINT_RES_INFO(UsesFlatScratch);
306 PRINT_RES_INFO(HasDynamicallySizedStack);
307 PRINT_RES_INFO(HasRecursion);
308 PRINT_RES_INFO(HasIndirectCall);
309#undef PRINT_RES_INFO
310}
311
313 const MCSymbol *MaxVGPR, const MCSymbol *MaxAGPR, const MCSymbol *MaxSGPR,
314 const MCSymbol *MaxNamedBarrier) {
315#define PRINT_RES_INFO(ARG) \
316 OS << "\t.set "; \
317 ARG->print(OS, getContext().getAsmInfo()); \
318 OS << ", "; \
319 getContext().getAsmInfo()->printExpr(OS, *ARG->getVariableValue()); \
320 Streamer.addBlankLine();
321
322 PRINT_RES_INFO(MaxVGPR);
323 PRINT_RES_INFO(MaxAGPR);
324 PRINT_RES_INFO(MaxSGPR);
325 PRINT_RES_INFO(MaxNamedBarrier);
326#undef PRINT_RES_INFO
327}
328
330 OS << "\t.amd_amdgpu_isa \"" << getTargetID() << "\"\n";
331 return true;
332}
333
335 msgpack::Document &HSAMetadataDoc, bool Strict) {
337 if (!Verifier.verify(HSAMetadataDoc.getRoot()))
338 return false;
339
340 std::string HSAMetadataString;
341 raw_string_ostream StrOS(HSAMetadataString);
342 HSAMetadataDoc.toYAML(StrOS);
343
344 OS << '\t' << HSAMD::V3::AssemblerDirectiveBegin << '\n';
345 OS << StrOS.str() << '\n';
346 OS << '\t' << HSAMD::V3::AssemblerDirectiveEnd << '\n';
347 return true;
348}
349
351 const uint32_t Encoded_s_code_end = 0xbf9f0000;
352 const uint32_t Encoded_s_nop = 0xbf800000;
353 uint32_t Encoded_pad = Encoded_s_code_end;
354
355 // Instruction cache line size in bytes.
356 const unsigned Log2CacheLineSize = AMDGPU::isGFX11Plus(STI) ? 7 : 6;
357 const unsigned CacheLineSize = 1u << Log2CacheLineSize;
358
359 // Extra padding amount in bytes to support prefetch mode 3.
360 unsigned FillSize = 3 * CacheLineSize;
361
362 if (AMDGPU::isGFX90A(STI)) {
363 Encoded_pad = Encoded_s_nop;
364 FillSize = 16 * CacheLineSize;
365 }
366
367 OS << "\t.p2alignl " << Log2CacheLineSize << ", " << Encoded_pad << '\n';
368 OS << "\t.fill " << (FillSize / 4) << ", 4, " << Encoded_pad << '\n';
369 return true;
370}
371
373 const MCSubtargetInfo &STI, StringRef KernelName,
374 const MCKernelDescriptor &KD, const MCExpr *NextVGPR,
375 const MCExpr *NextSGPR, const MCExpr *ReserveVCC,
376 const MCExpr *ReserveFlatScr) {
377 IsaVersion IVersion = getIsaVersion(STI.getCPU());
378 const MCAsmInfo *MAI = getContext().getAsmInfo();
379
380 OS << "\t.amdhsa_kernel " << KernelName << '\n';
381
382 auto PrintField = [&](const MCExpr *Expr, uint32_t Shift, uint32_t Mask,
384 OS << "\t\t" << Directive << ' ';
385 const MCExpr *ShiftedAndMaskedExpr =
386 MCKernelDescriptor::bits_get(Expr, Shift, Mask, getContext());
387 const MCExpr *New = foldAMDGPUMCExpr(ShiftedAndMaskedExpr, getContext());
388 printAMDGPUMCExpr(New, OS, MAI);
389 OS << '\n';
390 };
391
392 auto EmitMCExpr = [&](const MCExpr *Value) {
394 printAMDGPUMCExpr(NewExpr, OS, MAI);
395 };
396
397 OS << "\t\t.amdhsa_group_segment_fixed_size ";
398 EmitMCExpr(KD.group_segment_fixed_size);
399 OS << '\n';
400
401 OS << "\t\t.amdhsa_private_segment_fixed_size ";
402 EmitMCExpr(KD.private_segment_fixed_size);
403 OS << '\n';
404
405 OS << "\t\t.amdhsa_kernarg_size ";
406 EmitMCExpr(KD.kernarg_size);
407 OS << '\n';
408
409 if (isGFX1250Plus(STI)) {
411 amdhsa::COMPUTE_PGM_RSRC2_GFX125_USER_SGPR_COUNT_SHIFT,
412 amdhsa::COMPUTE_PGM_RSRC2_GFX125_USER_SGPR_COUNT,
413 ".amdhsa_user_sgpr_count");
414 } else {
416 amdhsa::COMPUTE_PGM_RSRC2_GFX6_GFX120_USER_SGPR_COUNT_SHIFT,
417 amdhsa::COMPUTE_PGM_RSRC2_GFX6_GFX120_USER_SGPR_COUNT,
418 ".amdhsa_user_sgpr_count");
419 }
420
424 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_PRIVATE_SEGMENT_BUFFER_SHIFT,
425 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_PRIVATE_SEGMENT_BUFFER,
426 ".amdhsa_user_sgpr_private_segment_buffer");
428 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_PTR_SHIFT,
429 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_PTR,
430 ".amdhsa_user_sgpr_dispatch_ptr");
432 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_QUEUE_PTR_SHIFT,
433 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_QUEUE_PTR,
434 ".amdhsa_user_sgpr_queue_ptr");
436 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_KERNARG_SEGMENT_PTR_SHIFT,
437 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_KERNARG_SEGMENT_PTR,
438 ".amdhsa_user_sgpr_kernarg_segment_ptr");
440 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_ID_SHIFT,
441 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_ID,
442 ".amdhsa_user_sgpr_dispatch_id");
445 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_FLAT_SCRATCH_INIT_SHIFT,
446 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_FLAT_SCRATCH_INIT,
447 ".amdhsa_user_sgpr_flat_scratch_init");
448 if (hasKernargPreload(STI)) {
449 PrintField(KD.kernarg_preload, amdhsa::KERNARG_PRELOAD_SPEC_LENGTH_SHIFT,
450 amdhsa::KERNARG_PRELOAD_SPEC_LENGTH,
451 ".amdhsa_user_sgpr_kernarg_preload_length");
452 PrintField(KD.kernarg_preload, amdhsa::KERNARG_PRELOAD_SPEC_OFFSET_SHIFT,
453 amdhsa::KERNARG_PRELOAD_SPEC_OFFSET,
454 ".amdhsa_user_sgpr_kernarg_preload_offset");
455 }
458 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_PRIVATE_SEGMENT_SIZE_SHIFT,
459 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_PRIVATE_SEGMENT_SIZE,
460 ".amdhsa_user_sgpr_private_segment_size");
461 if (IVersion.Major >= 10)
463 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32_SHIFT,
464 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32,
465 ".amdhsa_wavefront_size32");
468 amdhsa::KERNEL_CODE_PROPERTY_USES_DYNAMIC_STACK_SHIFT,
469 amdhsa::KERNEL_CODE_PROPERTY_USES_DYNAMIC_STACK,
470 ".amdhsa_uses_dynamic_stack");
472 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_PRIVATE_SEGMENT_SHIFT,
473 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_PRIVATE_SEGMENT,
475 ? ".amdhsa_enable_private_segment"
476 : ".amdhsa_system_sgpr_private_segment_wavefront_offset"));
478 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_X_SHIFT,
479 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_X,
480 ".amdhsa_system_sgpr_workgroup_id_x");
482 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_Y_SHIFT,
483 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_Y,
484 ".amdhsa_system_sgpr_workgroup_id_y");
486 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_Z_SHIFT,
487 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_Z,
488 ".amdhsa_system_sgpr_workgroup_id_z");
490 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_INFO_SHIFT,
491 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_INFO,
492 ".amdhsa_system_sgpr_workgroup_info");
494 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_VGPR_WORKITEM_ID_SHIFT,
495 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_VGPR_WORKITEM_ID,
496 ".amdhsa_system_vgpr_workitem_id");
497
498 // These directives are required.
499 OS << "\t\t.amdhsa_next_free_vgpr ";
500 EmitMCExpr(NextVGPR);
501 OS << '\n';
502
503 OS << "\t\t.amdhsa_next_free_sgpr ";
504 EmitMCExpr(NextSGPR);
505 OS << '\n';
506
507 if (AMDGPU::isGFX90A(STI)) {
508 // MCExpr equivalent of taking the (accum_offset + 1) * 4.
509 const MCExpr *accum_bits = MCKernelDescriptor::bits_get(
511 amdhsa::COMPUTE_PGM_RSRC3_GFX90A_ACCUM_OFFSET_SHIFT,
512 amdhsa::COMPUTE_PGM_RSRC3_GFX90A_ACCUM_OFFSET, getContext());
513 accum_bits = MCBinaryExpr::createAdd(
514 accum_bits, MCConstantExpr::create(1, getContext()), getContext());
515 accum_bits = MCBinaryExpr::createMul(
516 accum_bits, MCConstantExpr::create(4, getContext()), getContext());
517 OS << "\t\t.amdhsa_accum_offset ";
518 const MCExpr *New = foldAMDGPUMCExpr(accum_bits, getContext());
519 printAMDGPUMCExpr(New, OS, MAI);
520 OS << '\n';
521 }
522
523 if (isGFX1250Plus(STI))
525 amdhsa::COMPUTE_PGM_RSRC3_GFX125_NAMED_BAR_CNT_SHIFT,
526 amdhsa::COMPUTE_PGM_RSRC3_GFX125_NAMED_BAR_CNT,
527 ".amdhsa_named_barrier_count");
528
529 OS << "\t\t.amdhsa_reserve_vcc ";
530 EmitMCExpr(ReserveVCC);
531 OS << '\n';
532
533 if (IVersion.Major >= 7 && !hasArchitectedFlatScratch(STI)) {
534 OS << "\t\t.amdhsa_reserve_flat_scratch ";
535 EmitMCExpr(ReserveFlatScr);
536 OS << '\n';
537 }
538
539 switch (CodeObjectVersion) {
540 default:
541 break;
544 if (getTargetID()->isXnackSupported())
545 OS << "\t\t.amdhsa_reserve_xnack_mask " << getTargetID()->isXnackOnOrAny() << '\n';
546 break;
547 }
548
550 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_ROUND_MODE_32_SHIFT,
551 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_ROUND_MODE_32,
552 ".amdhsa_float_round_mode_32");
554 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_ROUND_MODE_16_64_SHIFT,
555 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_ROUND_MODE_16_64,
556 ".amdhsa_float_round_mode_16_64");
558 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_DENORM_MODE_32_SHIFT,
559 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_DENORM_MODE_32,
560 ".amdhsa_float_denorm_mode_32");
562 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_DENORM_MODE_16_64_SHIFT,
563 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_DENORM_MODE_16_64,
564 ".amdhsa_float_denorm_mode_16_64");
565 if (STI.hasFeature(AMDGPU::FeatureDX10ClampAndIEEEMode)) {
567 amdhsa::COMPUTE_PGM_RSRC1_GFX6_GFX11_ENABLE_DX10_CLAMP_SHIFT,
568 amdhsa::COMPUTE_PGM_RSRC1_GFX6_GFX11_ENABLE_DX10_CLAMP,
569 ".amdhsa_dx10_clamp");
571 amdhsa::COMPUTE_PGM_RSRC1_GFX6_GFX11_ENABLE_IEEE_MODE_SHIFT,
572 amdhsa::COMPUTE_PGM_RSRC1_GFX6_GFX11_ENABLE_IEEE_MODE,
573 ".amdhsa_ieee_mode");
574 }
575 if (IVersion.Major >= 9) {
577 amdhsa::COMPUTE_PGM_RSRC1_GFX9_PLUS_FP16_OVFL_SHIFT,
578 amdhsa::COMPUTE_PGM_RSRC1_GFX9_PLUS_FP16_OVFL,
579 ".amdhsa_fp16_overflow");
580 }
581 if (AMDGPU::isGFX90A(STI))
583 amdhsa::COMPUTE_PGM_RSRC3_GFX90A_TG_SPLIT_SHIFT,
584 amdhsa::COMPUTE_PGM_RSRC3_GFX90A_TG_SPLIT, ".amdhsa_tg_split");
585 if (AMDGPU::supportsWGP(STI))
587 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_WGP_MODE_SHIFT,
588 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_WGP_MODE,
589 ".amdhsa_workgroup_processor_mode");
590 if (IVersion.Major >= 10) {
592 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_MEM_ORDERED_SHIFT,
593 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_MEM_ORDERED,
594 ".amdhsa_memory_ordered");
596 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_FWD_PROGRESS_SHIFT,
597 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_FWD_PROGRESS,
598 ".amdhsa_forward_progress");
599 }
600 if (IVersion.Major >= 10 && IVersion.Major < 12) {
602 amdhsa::COMPUTE_PGM_RSRC3_GFX10_GFX11_SHARED_VGPR_COUNT_SHIFT,
603 amdhsa::COMPUTE_PGM_RSRC3_GFX10_GFX11_SHARED_VGPR_COUNT,
604 ".amdhsa_shared_vgpr_count");
605 }
606 if (IVersion.Major == 11) {
608 amdhsa::COMPUTE_PGM_RSRC3_GFX11_INST_PREF_SIZE_SHIFT,
609 amdhsa::COMPUTE_PGM_RSRC3_GFX11_INST_PREF_SIZE,
610 ".amdhsa_inst_pref_size");
611 }
612 if (IVersion.Major >= 12) {
614 amdhsa::COMPUTE_PGM_RSRC3_GFX12_PLUS_INST_PREF_SIZE_SHIFT,
615 amdhsa::COMPUTE_PGM_RSRC3_GFX12_PLUS_INST_PREF_SIZE,
616 ".amdhsa_inst_pref_size");
618 amdhsa::COMPUTE_PGM_RSRC1_GFX12_PLUS_ENABLE_WG_RR_EN_SHIFT,
619 amdhsa::COMPUTE_PGM_RSRC1_GFX12_PLUS_ENABLE_WG_RR_EN,
620 ".amdhsa_round_robin_scheduling");
621 }
624 amdhsa::
625 COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_INVALID_OPERATION_SHIFT,
626 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_INVALID_OPERATION,
627 ".amdhsa_exception_fp_ieee_invalid_op");
630 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_FP_DENORMAL_SOURCE_SHIFT,
631 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_FP_DENORMAL_SOURCE,
632 ".amdhsa_exception_fp_denorm_src");
635 amdhsa::
636 COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_DIVISION_BY_ZERO_SHIFT,
637 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_DIVISION_BY_ZERO,
638 ".amdhsa_exception_fp_ieee_div_zero");
641 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_OVERFLOW_SHIFT,
642 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_OVERFLOW,
643 ".amdhsa_exception_fp_ieee_overflow");
646 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_UNDERFLOW_SHIFT,
647 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_UNDERFLOW,
648 ".amdhsa_exception_fp_ieee_underflow");
651 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_INEXACT_SHIFT,
652 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_INEXACT,
653 ".amdhsa_exception_fp_ieee_inexact");
656 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_INT_DIVIDE_BY_ZERO_SHIFT,
657 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_INT_DIVIDE_BY_ZERO,
658 ".amdhsa_exception_int_div_zero");
659
660 OS << "\t.end_amdhsa_kernel\n";
661}
662
663//===----------------------------------------------------------------------===//
664// AMDGPUTargetELFStreamer
665//===----------------------------------------------------------------------===//
666
670
672 return static_cast<MCELFStreamer &>(Streamer);
673}
674
675// A hook for emitting stuff at the end.
676// We use it for emitting the accumulated PAL metadata as a .note record.
677// The PAL metadata is reset after it is emitted.
680 W.setELFHeaderEFlags(getEFlags());
681 W.setOverrideABIVersion(
682 getELFABIVersion(STI.getTargetTriple(), CodeObjectVersion));
683
684 std::string Blob;
685 const char *Vendor = getPALMetadata()->getVendor();
686 unsigned Type = getPALMetadata()->getType();
687 getPALMetadata()->toBlob(Type, Blob);
688 if (Blob.empty())
689 return;
690 EmitNote(Vendor, MCConstantExpr::create(Blob.size(), getContext()), Type,
691 [&](MCELFStreamer &OS) { OS.emitBytes(Blob); });
692
693 // Reset the pal metadata so its data will not affect a compilation that
694 // reuses this object.
696}
697
698void AMDGPUTargetELFStreamer::EmitNote(
699 StringRef Name, const MCExpr *DescSZ, unsigned NoteType,
700 function_ref<void(MCELFStreamer &)> EmitDesc) {
701 auto &S = getStreamer();
702 auto &Context = S.getContext();
703
704 auto NameSZ = Name.size() + 1;
705
706 unsigned NoteFlags = 0;
707 // TODO Apparently, this is currently needed for OpenCL as mentioned in
708 // https://reviews.llvm.org/D74995
709 if (isHsaAbi(STI))
710 NoteFlags = ELF::SHF_ALLOC;
711
712 S.pushSection();
713 S.switchSection(
714 Context.getELFSection(ElfNote::SectionName, ELF::SHT_NOTE, NoteFlags));
715 S.emitInt32(NameSZ); // namesz
716 S.emitValue(DescSZ, 4); // descz
717 S.emitInt32(NoteType); // type
718 S.emitBytes(Name); // name
719 S.emitValueToAlignment(Align(4), 0, 1, 0); // padding 0
720 EmitDesc(S); // desc
721 S.emitValueToAlignment(Align(4), 0, 1, 0); // padding 0
722 S.popSection();
723}
724
725unsigned AMDGPUTargetELFStreamer::getEFlags() {
726 switch (STI.getTargetTriple().getArch()) {
727 default:
728 llvm_unreachable("Unsupported Arch");
729 case Triple::r600:
730 return getEFlagsR600();
731 case Triple::amdgcn:
732 return getEFlagsAMDGCN();
733 }
734}
735
736unsigned AMDGPUTargetELFStreamer::getEFlagsR600() {
737 assert(STI.getTargetTriple().getArch() == Triple::r600);
738
739 return getElfMach(STI.getCPU());
740}
741
742unsigned AMDGPUTargetELFStreamer::getEFlagsAMDGCN() {
743 assert(STI.getTargetTriple().isAMDGCN());
744
745 switch (STI.getTargetTriple().getOS()) {
746 default:
747 // TODO: Why are some tests have "mingw" listed as OS?
748 // llvm_unreachable("Unsupported OS");
750 return getEFlagsUnknownOS();
751 case Triple::AMDHSA:
752 return getEFlagsAMDHSA();
753 case Triple::AMDPAL:
754 return getEFlagsAMDPAL();
755 case Triple::Mesa3D:
756 return getEFlagsMesa3D();
757 }
758}
759
760unsigned AMDGPUTargetELFStreamer::getEFlagsUnknownOS() {
761 // TODO: Why are some tests have "mingw" listed as OS?
762 // assert(STI.getTargetTriple().getOS() == Triple::UnknownOS);
763
764 return getEFlagsV3();
765}
766
767unsigned AMDGPUTargetELFStreamer::getEFlagsAMDHSA() {
768 assert(isHsaAbi(STI));
769
770 if (CodeObjectVersion >= 6)
771 return getEFlagsV6();
772 return getEFlagsV4();
773}
774
775unsigned AMDGPUTargetELFStreamer::getEFlagsAMDPAL() {
776 assert(STI.getTargetTriple().getOS() == Triple::AMDPAL);
777
778 return getEFlagsV3();
779}
780
781unsigned AMDGPUTargetELFStreamer::getEFlagsMesa3D() {
782 assert(STI.getTargetTriple().getOS() == Triple::Mesa3D);
783
784 return getEFlagsV3();
785}
786
787unsigned AMDGPUTargetELFStreamer::getEFlagsV3() {
788 unsigned EFlagsV3 = 0;
789
790 // mach.
791 EFlagsV3 |= getElfMach(STI.getCPU());
792
793 // xnack.
794 if (getTargetID()->isXnackOnOrAny())
796 // sramecc.
797 if (getTargetID()->isSramEccOnOrAny())
799
800 return EFlagsV3;
801}
802
803unsigned AMDGPUTargetELFStreamer::getEFlagsV4() {
804 unsigned EFlagsV4 = 0;
805
806 // mach.
807 EFlagsV4 |= getElfMach(STI.getCPU());
808
809 // xnack.
810 switch (getTargetID()->getXnackSetting()) {
813 break;
816 break;
819 break;
822 break;
823 }
824 // sramecc.
825 switch (getTargetID()->getSramEccSetting()) {
828 break;
831 break;
834 break;
837 break;
838 }
839
840 return EFlagsV4;
841}
842
843unsigned AMDGPUTargetELFStreamer::getEFlagsV6() {
844 unsigned Flags = getEFlagsV4();
845
846 unsigned Version = ForceGenericVersion;
847 if (!Version) {
848 switch (parseArchAMDGCN(STI.getCPU())) {
851 break;
854 break;
857 break;
860 break;
863 break;
866 break;
869 break;
870 default:
871 break;
872 }
873 }
874
875 // Versions start at 1.
876 if (Version) {
878 report_fatal_error("Cannot encode generic code object version " +
879 Twine(Version) +
880 " - no ELF flag can represent this version!");
882 }
883
884 return Flags;
885}
886
888
890 MCStreamer &OS = getStreamer();
891 OS.pushSection();
892 Header.EmitKernelCodeT(OS, getContext());
893 OS.popSection();
894}
895
897 unsigned Type) {
898 auto *Symbol = static_cast<MCSymbolELF *>(
900 Symbol->setType(Type);
901}
902
904 Align Alignment) {
905 auto *SymbolELF = static_cast<MCSymbolELF *>(Symbol);
906 SymbolELF->setType(ELF::STT_OBJECT);
907
908 if (!SymbolELF->isBindingSet())
909 SymbolELF->setBinding(ELF::STB_GLOBAL);
910
911 if (SymbolELF->declareCommon(Size, Alignment)) {
912 report_fatal_error("Symbol: " + Symbol->getName() +
913 " redeclared as different type");
914 }
915
916 SymbolELF->setIndex(ELF::SHN_AMDGPU_LDS);
917 SymbolELF->setSize(MCConstantExpr::create(Size, getContext()));
918}
919
921 // Create two labels to mark the beginning and end of the desc field
922 // and a MCExpr to calculate the size of the desc field.
923 auto &Context = getContext();
924 auto *DescBegin = Context.createTempSymbol();
925 auto *DescEnd = Context.createTempSymbol();
926 auto *DescSZ = MCBinaryExpr::createSub(
927 MCSymbolRefExpr::create(DescEnd, Context),
928 MCSymbolRefExpr::create(DescBegin, Context), Context);
929
931 [&](MCELFStreamer &OS) {
932 OS.emitLabel(DescBegin);
933
934 SmallString<32> Str;
935 raw_svector_ostream StrOS(Str);
936 StrOS << *getTargetID();
937
938 OS.emitBytes(StrOS.str());
939 OS.emitLabel(DescEnd);
940 });
941 return true;
942}
943
945 bool Strict) {
947 if (!Verifier.verify(HSAMetadataDoc.getRoot()))
948 return false;
949
950 std::string HSAMetadataString;
951 HSAMetadataDoc.writeToBlob(HSAMetadataString);
952
953 // Create two labels to mark the beginning and end of the desc field
954 // and a MCExpr to calculate the size of the desc field.
955 auto &Context = getContext();
956 auto *DescBegin = Context.createTempSymbol();
957 auto *DescEnd = Context.createTempSymbol();
958 auto *DescSZ = MCBinaryExpr::createSub(
959 MCSymbolRefExpr::create(DescEnd, Context),
960 MCSymbolRefExpr::create(DescBegin, Context), Context);
961
963 [&](MCELFStreamer &OS) {
964 OS.emitLabel(DescBegin);
965 OS.emitBytes(HSAMetadataString);
966 OS.emitLabel(DescEnd);
967 });
968 return true;
969}
970
972 const uint32_t Encoded_s_code_end = 0xbf9f0000;
973 const uint32_t Encoded_s_nop = 0xbf800000;
974 uint32_t Encoded_pad = Encoded_s_code_end;
975
976 // Instruction cache line size in bytes.
977 const unsigned Log2CacheLineSize = AMDGPU::isGFX11Plus(STI) ? 7 : 6;
978 const unsigned CacheLineSize = 1u << Log2CacheLineSize;
979
980 // Extra padding amount in bytes to support prefetch mode 3.
981 unsigned FillSize = 3 * CacheLineSize;
982
983 if (AMDGPU::isGFX90A(STI)) {
984 Encoded_pad = Encoded_s_nop;
985 FillSize = 16 * CacheLineSize;
986 }
987
988 MCStreamer &OS = getStreamer();
989 OS.pushSection();
990 OS.emitValueToAlignment(Align(CacheLineSize), Encoded_pad, 4);
991 for (unsigned I = 0; I < FillSize; I += 4)
992 OS.emitInt32(Encoded_pad);
993 OS.popSection();
994 return true;
995}
996
998 const MCSubtargetInfo &STI, StringRef KernelName,
999 const MCKernelDescriptor &KernelDescriptor, const MCExpr *NextVGPR,
1000 const MCExpr *NextSGPR, const MCExpr *ReserveVCC,
1001 const MCExpr *ReserveFlatScr) {
1002 auto &Streamer = getStreamer();
1003 auto &Context = Streamer.getContext();
1004
1005 auto *KernelCodeSymbol =
1006 static_cast<MCSymbolELF *>(Context.getOrCreateSymbol(Twine(KernelName)));
1007 auto *KernelDescriptorSymbol = static_cast<MCSymbolELF *>(
1008 Context.getOrCreateSymbol(Twine(KernelName) + Twine(".kd")));
1009
1010 // Copy kernel descriptor symbol's binding, other and visibility from the
1011 // kernel code symbol.
1012 KernelDescriptorSymbol->setBinding(KernelCodeSymbol->getBinding());
1013 KernelDescriptorSymbol->setOther(KernelCodeSymbol->getOther());
1014 KernelDescriptorSymbol->setVisibility(KernelCodeSymbol->getVisibility());
1015 // Kernel descriptor symbol's type and size are fixed.
1016 KernelDescriptorSymbol->setType(ELF::STT_OBJECT);
1017 KernelDescriptorSymbol->setSize(
1019
1020 // The visibility of the kernel code symbol must be protected or less to allow
1021 // static relocations from the kernel descriptor to be used.
1022 if (KernelCodeSymbol->getVisibility() == ELF::STV_DEFAULT)
1023 KernelCodeSymbol->setVisibility(ELF::STV_PROTECTED);
1024
1025 Streamer.emitLabel(KernelDescriptorSymbol);
1026 Streamer.emitValue(
1027 KernelDescriptor.group_segment_fixed_size,
1029 Streamer.emitValue(
1030 KernelDescriptor.private_segment_fixed_size,
1032 Streamer.emitValue(KernelDescriptor.kernarg_size,
1034
1035 for (uint32_t i = 0; i < sizeof(amdhsa::kernel_descriptor_t::reserved0); ++i)
1036 Streamer.emitInt8(0u);
1037
1038 // FIXME: Remove the use of VK_AMDGPU_REL64 in the expression below. The
1039 // expression being created is:
1040 // (start of kernel code) - (start of kernel descriptor)
1041 // It implies R_AMDGPU_REL64, but ends up being R_AMDGPU_ABS64.
1042 Streamer.emitValue(
1045 Context),
1046 MCSymbolRefExpr::create(KernelDescriptorSymbol, Context), Context),
1048 for (uint32_t i = 0; i < sizeof(amdhsa::kernel_descriptor_t::reserved1); ++i)
1049 Streamer.emitInt8(0u);
1050 Streamer.emitValue(KernelDescriptor.compute_pgm_rsrc3,
1052 Streamer.emitValue(KernelDescriptor.compute_pgm_rsrc1,
1054 Streamer.emitValue(KernelDescriptor.compute_pgm_rsrc2,
1056 Streamer.emitValue(
1057 KernelDescriptor.kernel_code_properties,
1059 Streamer.emitValue(KernelDescriptor.kernarg_preload,
1061 for (uint32_t i = 0; i < sizeof(amdhsa::kernel_descriptor_t::reserved3); ++i)
1062 Streamer.emitInt8(0u);
1063}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDHSA kernel descriptor MCExpr struct for use in MC layer.
Provides AMDGPU specific target descriptions.
This is a verifier for AMDGPU HSA metadata, which can verify both well-typed metadata and untyped met...
AMDGPU metadata definitions and in-memory representations.
Enums and constants for AMDGPU PT_NOTE sections.
static cl::opt< unsigned > ForceGenericVersion("amdgpu-force-generic-version", cl::desc("Force a specific generic_v<N> flag to be " "added. For testing purposes only."), cl::ReallyHidden, cl::init(0))
#define PRINT_RES_INFO(ARG)
AMDHSA kernel descriptor definitions.
MC layer struct for AMDGPUMCKernelCodeT, provides MCExpr functionality where required.
#define I(x, y, z)
Definition MD5.cpp:57
verify safepoint Safepoint IR Verifier
static cl::opt< unsigned > CacheLineSize("cache-line-size", cl::init(0), cl::Hidden, cl::desc("Use this to override the target cache line size when " "specified by the user."))
const char * getVendor() const
void toBlob(unsigned Type, std::string &S)
void toString(std::string &S)
AMDGPUTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS)
bool EmitHSAMetadata(msgpack::Document &HSAMetadata, bool Strict) override
void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override
void EmitDirectiveAMDHSACodeObjectVersion(unsigned COV) override
void EmitMCResourceMaximums(const MCSymbol *MaxVGPR, const MCSymbol *MaxAGPR, const MCSymbol *MaxSGPR, const MCSymbol *MaxNamedBarrier) override
void EmitAMDKernelCodeT(AMDGPU::AMDGPUMCKernelCodeT &Header) override
void EmitAmdhsaKernelDescriptor(const MCSubtargetInfo &STI, StringRef KernelName, const AMDGPU::MCKernelDescriptor &KernelDescriptor, const MCExpr *NextVGPR, const MCExpr *NextSGPR, const MCExpr *ReserveVCC, const MCExpr *ReserveFlatScr) override
void EmitMCResourceInfo(const MCSymbol *NumVGPR, const MCSymbol *NumAGPR, const MCSymbol *NumExplicitSGPR, const MCSymbol *NumNamedBarrier, const MCSymbol *PrivateSegmentSize, const MCSymbol *UsesVCC, const MCSymbol *UsesFlatScratch, const MCSymbol *HasDynamicallySizedStack, const MCSymbol *HasRecursion, const MCSymbol *HasIndirectCall) override
bool EmitCodeEnd(const MCSubtargetInfo &STI) override
void emitAMDGPULDS(MCSymbol *Sym, unsigned Size, Align Alignment) override
bool EmitCodeEnd(const MCSubtargetInfo &STI) override
void EmitAMDKernelCodeT(AMDGPU::AMDGPUMCKernelCodeT &Header) override
bool EmitHSAMetadata(msgpack::Document &HSAMetadata, bool Strict) override
AMDGPUTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
void emitAMDGPULDS(MCSymbol *Sym, unsigned Size, Align Alignment) override
void EmitAmdhsaKernelDescriptor(const MCSubtargetInfo &STI, StringRef KernelName, const AMDGPU::MCKernelDescriptor &KernelDescriptor, const MCExpr *NextVGPR, const MCExpr *NextSGPR, const MCExpr *ReserveVCC, const MCExpr *ReserveFlatScr) override
void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override
virtual bool EmitHSAMetadata(msgpack::Document &HSAMetadata, bool Strict)
Emit HSA Metadata.
AMDGPUPALMetadata * getPALMetadata()
virtual void EmitDirectiveAMDHSACodeObjectVersion(unsigned COV)
virtual bool EmitHSAMetadataV3(StringRef HSAMetadataString)
static unsigned getElfMach(StringRef GPU)
static StringRef getArchNameFromElfMach(unsigned ElfMach)
const std::optional< AMDGPU::IsaInfo::AMDGPUTargetID > & getTargetID() const
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:64
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:343
static const MCBinaryExpr * createMul(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition MCExpr.h:398
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition MCExpr.h:428
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition MCExpr.cpp:212
const MCAsmInfo * getAsmInfo() const
Definition MCContext.h:412
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
ELFObjectWriter & getWriter()
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
Streaming machine code generation interface.
Definition MCStreamer.h:221
virtual bool popSection()
Restore the current and previous section from the section stack.
MCContext & getContext() const
Definition MCStreamer.h:322
virtual void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
void pushSection()
Save the current and previous section on the section stack.
Definition MCStreamer.h:449
void emitInt32(uint64_t Value)
Definition MCStreamer.h:756
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
const Triple & getTargetTriple() const
StringRef getCPU() const
void setBinding(unsigned Binding) const
void setType(unsigned Type) const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:214
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition Triple.h:420
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
LLVM Value Representation.
Definition Value.h:75
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
An efficient, type-erasing, non-owning reference to a callable.
Simple in-memory representation of a document of msgpack objects with ability to find and create arra...
DocNode & getRoot()
Get ref to the document's root element.
LLVM_ABI void toYAML(raw_ostream &OS)
Convert MsgPack Document to YAML text.
LLVM_ABI void writeToBlob(std::string &Blob)
Write a MsgPack document to a binary MsgPack blob.
LLVM_ABI bool fromYAML(StringRef S)
Read YAML text into the MsgPack document. Returns false on failure.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
A raw_ostream that writes to an std::string.
std::string & str()
Returns the string's reference.
A raw_ostream that writes to an SmallVector or SmallString.
StringRef str() const
Return a StringRef for the vector contents.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const char NoteNameV2[]
const char SectionName[]
const char NoteNameV3[]
static constexpr unsigned GFX12_5
static constexpr unsigned GFX9_4
static constexpr unsigned GFX10_1
static constexpr unsigned GFX10_3
static constexpr unsigned GFX11
static constexpr unsigned GFX9
static constexpr unsigned GFX12
constexpr char AssemblerDirectiveBegin[]
HSA metadata beginning assembler directive.
constexpr char AssemblerDirectiveEnd[]
HSA metadata ending assembler directive.
LLVM_ABI StringRef getArchNameR600(GPUKind AK)
GPUKind
GPU kinds supported by the AMDGPU target.
void printAMDGPUMCExpr(const MCExpr *Expr, raw_ostream &OS, const MCAsmInfo *MAI)
bool isHsaAbi(const MCSubtargetInfo &STI)
LLVM_ABI IsaVersion getIsaVersion(StringRef GPU)
bool isGFX90A(const MCSubtargetInfo &STI)
LLVM_ABI GPUKind parseArchAMDGCN(StringRef CPU)
bool hasArchitectedFlatScratch(const MCSubtargetInfo &STI)
bool isGFX11Plus(const MCSubtargetInfo &STI)
const MCExpr * foldAMDGPUMCExpr(const MCExpr *Expr, MCContext &Ctx)
LLVM_ABI StringRef getArchNameAMDGCN(GPUKind AK)
unsigned hasKernargPreload(const MCSubtargetInfo &STI)
bool supportsWGP(const MCSubtargetInfo &STI)
bool isGFX1250Plus(const MCSubtargetInfo &STI)
uint8_t getELFABIVersion(const Triple &T, unsigned CodeObjectVersion)
LLVM_ABI GPUKind parseArchR600(StringRef CPU)
@ NT_AMDGPU_METADATA
Definition ELF.h:1988
@ SHN_AMDGPU_LDS
Definition ELF.h:1971
@ SHF_ALLOC
Definition ELF.h:1250
@ SHT_NOTE
Definition ELF.h:1155
@ STB_GLOBAL
Definition ELF.h:1407
@ STT_AMDGPU_HSA_KERNEL
Definition ELF.h:1432
@ STT_OBJECT
Definition ELF.h:1419
@ EF_AMDGPU_GENERIC_VERSION_MAX
Definition ELF.h:926
@ EF_AMDGPU_FEATURE_XNACK_ANY_V4
Definition ELF.h:903
@ EF_AMDGPU_MACH_AMDGCN_GFX703
Definition ELF.h:811
@ EF_AMDGPU_MACH_AMDGCN_GFX1035
Definition ELF.h:835
@ EF_AMDGPU_FEATURE_SRAMECC_V3
Definition ELF.h:894
@ EF_AMDGPU_MACH_AMDGCN_GFX1031
Definition ELF.h:829
@ EF_AMDGPU_GENERIC_VERSION_OFFSET
Definition ELF.h:924
@ EF_AMDGPU_MACH_R600_CAYMAN
Definition ELF.h:793
@ EF_AMDGPU_FEATURE_SRAMECC_UNSUPPORTED_V4
Definition ELF.h:914
@ EF_AMDGPU_MACH_AMDGCN_GFX704
Definition ELF.h:812
@ EF_AMDGPU_MACH_AMDGCN_GFX902
Definition ELF.h:819
@ EF_AMDGPU_MACH_AMDGCN_GFX810
Definition ELF.h:817
@ EF_AMDGPU_MACH_AMDGCN_GFX950
Definition ELF.h:853
@ EF_AMDGPU_MACH_AMDGCN_GFX1036
Definition ELF.h:843
@ EF_AMDGPU_MACH_AMDGCN_GFX1102
Definition ELF.h:845
@ EF_AMDGPU_MACH_R600_RV730
Definition ELF.h:782
@ EF_AMDGPU_MACH_R600_RV710
Definition ELF.h:781
@ EF_AMDGPU_MACH_AMDGCN_GFX908
Definition ELF.h:822
@ EF_AMDGPU_MACH_AMDGCN_GFX1011
Definition ELF.h:826
@ EF_AMDGPU_MACH_R600_CYPRESS
Definition ELF.h:786
@ EF_AMDGPU_MACH_AMDGCN_GFX1032
Definition ELF.h:830
@ EF_AMDGPU_MACH_R600_R600
Definition ELF.h:776
@ EF_AMDGPU_MACH_AMDGCN_GFX1250
Definition ELF.h:847
@ EF_AMDGPU_MACH_R600_TURKS
Definition ELF.h:794
@ EF_AMDGPU_MACH_R600_JUNIPER
Definition ELF.h:787
@ EF_AMDGPU_FEATURE_SRAMECC_OFF_V4
Definition ELF.h:918
@ EF_AMDGPU_FEATURE_XNACK_UNSUPPORTED_V4
Definition ELF.h:901
@ EF_AMDGPU_MACH_AMDGCN_GFX12_5_GENERIC
Definition ELF.h:865
@ EF_AMDGPU_MACH_AMDGCN_GFX601
Definition ELF.h:807
@ EF_AMDGPU_MACH_AMDGCN_GFX942
Definition ELF.h:850
@ EF_AMDGPU_MACH_AMDGCN_GFX1152
Definition ELF.h:859
@ EF_AMDGPU_MACH_R600_R630
Definition ELF.h:777
@ EF_AMDGPU_MACH_R600_REDWOOD
Definition ELF.h:788
@ EF_AMDGPU_MACH_R600_RV770
Definition ELF.h:783
@ EF_AMDGPU_FEATURE_XNACK_OFF_V4
Definition ELF.h:905
@ EF_AMDGPU_MACH_AMDGCN_GFX600
Definition ELF.h:806
@ EF_AMDGPU_FEATURE_XNACK_V3
Definition ELF.h:889
@ EF_AMDGPU_MACH_AMDGCN_GFX602
Definition ELF.h:832
@ EF_AMDGPU_MACH_AMDGCN_GFX1101
Definition ELF.h:844
@ EF_AMDGPU_MACH_AMDGCN_GFX1100
Definition ELF.h:839
@ EF_AMDGPU_MACH_AMDGCN_GFX1310
Definition ELF.h:854
@ EF_AMDGPU_MACH_AMDGCN_GFX1033
Definition ELF.h:831
@ EF_AMDGPU_MACH_AMDGCN_GFX801
Definition ELF.h:814
@ EF_AMDGPU_MACH_AMDGCN_GFX705
Definition ELF.h:833
@ EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC
Definition ELF.h:867
@ EF_AMDGPU_MACH_AMDGCN_GFX1153
Definition ELF.h:862
@ EF_AMDGPU_MACH_AMDGCN_GFX1170
Definition ELF.h:866
@ EF_AMDGPU_MACH_AMDGCN_GFX1010
Definition ELF.h:825
@ EF_AMDGPU_MACH_R600_RV670
Definition ELF.h:779
@ EF_AMDGPU_MACH_AMDGCN_GFX701
Definition ELF.h:809
@ EF_AMDGPU_MACH_AMDGCN_GFX10_3_GENERIC
Definition ELF.h:857
@ EF_AMDGPU_MACH_AMDGCN_GFX1012
Definition ELF.h:827
@ EF_AMDGPU_MACH_AMDGCN_GFX1151
Definition ELF.h:848
@ EF_AMDGPU_MACH_AMDGCN_GFX1030
Definition ELF.h:828
@ EF_AMDGPU_MACH_R600_CEDAR
Definition ELF.h:785
@ EF_AMDGPU_MACH_AMDGCN_GFX1200
Definition ELF.h:846
@ EF_AMDGPU_MACH_AMDGCN_GFX700
Definition ELF.h:808
@ EF_AMDGPU_MACH_AMDGCN_GFX11_GENERIC
Definition ELF.h:858
@ EF_AMDGPU_MACH_AMDGCN_GFX803
Definition ELF.h:816
@ EF_AMDGPU_MACH_AMDGCN_GFX802
Definition ELF.h:815
@ EF_AMDGPU_MACH_AMDGCN_GFX90C
Definition ELF.h:824
@ EF_AMDGPU_FEATURE_XNACK_ON_V4
Definition ELF.h:907
@ EF_AMDGPU_MACH_AMDGCN_GFX900
Definition ELF.h:818
@ EF_AMDGPU_MACH_AMDGCN_GFX909
Definition ELF.h:823
@ EF_AMDGPU_MACH_AMDGCN_GFX906
Definition ELF.h:821
@ EF_AMDGPU_MACH_NONE
Definition ELF.h:771
@ EF_AMDGPU_MACH_AMDGCN_GFX9_GENERIC
Definition ELF.h:855
@ EF_AMDGPU_MACH_AMDGCN_GFX1103
Definition ELF.h:842
@ EF_AMDGPU_MACH_R600_CAICOS
Definition ELF.h:792
@ EF_AMDGPU_MACH_AMDGCN_GFX90A
Definition ELF.h:837
@ EF_AMDGPU_MACH_AMDGCN_GFX1034
Definition ELF.h:836
@ EF_AMDGPU_MACH_AMDGCN_GFX1013
Definition ELF.h:840
@ EF_AMDGPU_MACH_AMDGCN_GFX12_GENERIC
Definition ELF.h:863
@ EF_AMDGPU_MACH_AMDGCN_GFX10_1_GENERIC
Definition ELF.h:856
@ EF_AMDGPU_MACH_AMDGCN_GFX904
Definition ELF.h:820
@ EF_AMDGPU_MACH_AMDGCN_GFX1251
Definition ELF.h:864
@ EF_AMDGPU_MACH_R600_RS880
Definition ELF.h:778
@ EF_AMDGPU_MACH_AMDGCN_GFX805
Definition ELF.h:834
@ EF_AMDGPU_MACH_AMDGCN_GFX1201
Definition ELF.h:852
@ EF_AMDGPU_MACH_AMDGCN_GFX1150
Definition ELF.h:841
@ EF_AMDGPU_MACH_R600_SUMO
Definition ELF.h:789
@ EF_AMDGPU_MACH_R600_BARTS
Definition ELF.h:791
@ EF_AMDGPU_FEATURE_SRAMECC_ANY_V4
Definition ELF.h:916
@ EF_AMDGPU_FEATURE_SRAMECC_ON_V4
Definition ELF.h:920
@ EF_AMDGPU_MACH_AMDGCN_GFX702
Definition ELF.h:810
@ NT_AMD_HSA_ISA_NAME
Definition ELF.h:1981
@ STV_PROTECTED
Definition ELF.h:1439
@ STV_DEFAULT
Definition ELF.h:1436
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
FunctionAddr VTableAddr uintptr_t uintptr_t Version
Definition InstrProf.h:302
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
Instruction set architecture version.
static const MCExpr * bits_get(const MCExpr *Src, uint32_t Shift, uint32_t Mask, MCContext &Ctx)
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
Definition Alignment.h:77