36 using namespace llvm::AMDGPU;
70 OS <<
"\t.hsa_code_object_version " <<
80 OS <<
"\t.hsa_code_object_isa " <<
82 ",\"" << VendorName <<
"\",\"" << ArchName <<
"\"\n";
88 OS <<
"\t.amd_kernel_code_t\n";
90 OS <<
"\t.end_amd_kernel_code_t\n";
98 OS <<
"\t.amdgpu_hsa_kernel " << SymbolName <<
'\n' ;
105 if (!VerifiedYamlString)
109 OS << VerifiedYamlString.get();
126 void AMDGPUTargetELFStreamer::EmitAMDGPUNote(
130 auto &
Context = S.getContext();
135 S.SwitchSection(
Context.getELFSection(
137 S.EmitIntValue(NameSZ, 4);
138 S.EmitValue(DescSZ, 4);
139 S.EmitIntValue(Type, 4);
141 S.EmitValueToAlignment(4, 0, 1, 0);
143 S.EmitValueToAlignment(4, 0, 1, 0);
167 uint16_t VendorNameSize = VendorName.
size() + 1;
168 uint16_t ArchNameSize = ArchName.
size() + 1;
170 unsigned DescSZ =
sizeof(VendorNameSize) +
sizeof(ArchNameSize) +
171 sizeof(Major) +
sizeof(Minor) +
sizeof(Stepping) +
172 VendorNameSize + ArchNameSize;
209 if (!VerifiedYamlString)
215 auto *DescBegin =
Context.createTempSymbol();
216 auto *DescEnd =
Context.createTempSymbol();
void EmitBytes(StringRef Data) override
Emit the bytes in Data into the output.
virtual void EmitStartOfCodeObjectMetadata(const Module &Mod)
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
A Module instance is used to store all the information related to an LLVM module. ...
virtual void EmitBytes(StringRef Data)
Emit the bytes in Data into the output.
Target specific streamer interface.
An efficient, type-erasing, non-owning reference to a callable.
void PushSection()
Save the current and previous section on the section stack.
void setType(unsigned Type) const
void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor, uint32_t Stepping, StringRef VendorName, StringRef ArchName) override
void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor, uint32_t Stepping, StringRef VendorName, StringRef ArchName) override
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
AMDGPU::CodeObject::MetadataStreamer CodeObjectMetadataStreamer
AMD Kernel Code Object (amd_kernel_code_t).
MCContext & getContext() const
Base class for the full range of assembler expressions which are needed for parsing.
MCContext & getContext() const
constexpr char MetadataAssemblerDirectiveBegin[]
Code object metadata beginning assembler directive.
virtual bool EmitCodeObjectMetadata(StringRef YamlString)=0
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers...
constexpr char MetadataAssemblerDirectiveEnd[]
Code object metadata ending assembler directive.
Streaming machine code generation interface.
The instances of the Type class are immutable: once they are created, they are never changed...
void EmitDirectiveHSACodeObjectVersion(uint32_t Major, uint32_t Minor) override
bool EmitCodeObjectMetadata(StringRef YamlString) override
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool EmitCodeObjectMetadata(StringRef YamlString) override
AMDGPUTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS)
virtual void EmitKernelCodeObjectMetadata(const Function &Func, const amd_kernel_code_t &KernelCode)
MCELFStreamer & getStreamer()
void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override
Enums and constants for AMDGPU PT_NOTE sections.
AMDGPUTargetStreamer(MCStreamer &S)
AMDGPUTargetELFStreamer(MCStreamer &S)
Module.h This file contains the declarations for the Module class.
void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override
void EmitDirectiveHSACodeObjectVersion(uint32_t Major, uint32_t Minor) override
llvm_unreachable("Unknown RegBank!")
void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override
void dumpAmdKernelCode(const amd_kernel_code_t *C, raw_ostream &OS, const char *tab)
bool PopSection()
Restore the current and previous section from the section stack.
StringRef - Represent a constant reference to a string, i.e.
virtual void EmitEndOfCodeObjectMetadata()
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)