File: AMDKernelCodeTUtils.h

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (93 lines) | stat: -rw-r--r-- 3,375 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//===- AMDGPUKernelCodeTUtils.h - helpers for amd_kernel_code_t -*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
/// \file AMDKernelCodeTUtils.h
/// MC layer struct for AMDGPUMCKernelCodeT, provides MCExpr functionality where
/// required.
///
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCKERNELCODET_H
#define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCKERNELCODET_H

#include "AMDKernelCodeT.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"

namespace llvm {
class MCAsmParser;
class MCContext;
class MCExpr;
class MCStreamer;
class MCSubtargetInfo;
class raw_ostream;
class MCAsmInfo;
namespace AMDGPU {

struct AMDGPUMCKernelCodeT {
  AMDGPUMCKernelCodeT() = default;

  // Names of most (if not all) members should match the ones used for table
  // driven (array) generation in AMDKernelCodeTInfo.h.
  uint32_t amd_kernel_code_version_major = 0;
  uint32_t amd_kernel_code_version_minor = 0;
  uint16_t amd_machine_kind = 0;
  uint16_t amd_machine_version_major = 0;
  uint16_t amd_machine_version_minor = 0;
  uint16_t amd_machine_version_stepping = 0;
  int64_t kernel_code_entry_byte_offset = 0;
  int64_t kernel_code_prefetch_byte_offset = 0;
  uint64_t kernel_code_prefetch_byte_size = 0;
  uint64_t reserved0 = 0;
  uint64_t compute_pgm_resource_registers = 0;
  uint32_t code_properties = 0;
  uint32_t workgroup_group_segment_byte_size = 0;
  uint32_t gds_segment_byte_size = 0;
  uint64_t kernarg_segment_byte_size = 0;
  uint32_t workgroup_fbarrier_count = 0;
  uint16_t reserved_vgpr_first = 0;
  uint16_t reserved_vgpr_count = 0;
  uint16_t reserved_sgpr_first = 0;
  uint16_t reserved_sgpr_count = 0;
  uint16_t debug_wavefront_private_segment_offset_sgpr = 0;
  uint16_t debug_private_segment_buffer_sgpr = 0;
  uint8_t kernarg_segment_alignment = 0;
  uint8_t group_segment_alignment = 0;
  uint8_t private_segment_alignment = 0;
  uint8_t wavefront_size = 0;
  int32_t call_convention = 0;
  uint8_t reserved3[12] = {0};
  uint64_t runtime_loader_kernel_symbol = 0;
  uint64_t control_directives[16] = {0};

  const MCExpr *compute_pgm_resource1_registers = nullptr;
  const MCExpr *compute_pgm_resource2_registers = nullptr;

  const MCExpr *is_dynamic_callstack = nullptr;
  const MCExpr *wavefront_sgpr_count = nullptr;
  const MCExpr *workitem_vgpr_count = nullptr;
  const MCExpr *workitem_private_segment_byte_size = nullptr;

  void initDefault(const MCSubtargetInfo *STI, MCContext &Ctx,
                   bool InitMCExpr = true);
  void validate(const MCSubtargetInfo *STI, MCContext &Ctx);

  const MCExpr *&getMCExprForIndex(int Index);

  using PrintHelper =
      function_ref<void(const MCExpr *, raw_ostream &, const MCAsmInfo *)>;
  bool ParseKernelCodeT(StringRef ID, MCAsmParser &MCParser, raw_ostream &Err);
  void EmitKernelCodeT(raw_ostream &OS, MCContext &Ctx, PrintHelper Helper);
  void EmitKernelCodeT(MCStreamer &OS, MCContext &Ctx);
};

} // end namespace AMDGPU
} // end namespace llvm

#endif // LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCKERNELCODET_H