37 using namespace llvm::AMDGPU;
53 OS <<
"\t.hsa_code_object_version " <<
63 OS <<
"\t.hsa_code_object_isa " <<
65 ",\"" << VendorName <<
"\",\"" << ArchName <<
"\"\n";
71 OS <<
"\t.amd_kernel_code_t\n";
73 OS <<
"\t.end_amd_kernel_code_t\n";
81 OS <<
"\t.amdgpu_hsa_kernel " << SymbolName <<
'\n' ;
88 OS <<
"\t.amdgpu_hsa_module_global " << GlobalName <<
'\n';
93 OS <<
"\t.amdgpu_hsa_program_global " << GlobalName <<
'\n';
97 OS <<
"\t.amdgpu_runtime_metadata\n";
99 OS <<
"\n\t.end_amdgpu_runtime_metadata\n";
103 OS <<
"\t.amdgpu_runtime_metadata";
105 OS <<
"\t.end_amdgpu_runtime_metadata\n";
120 AMDGPUTargetELFStreamer::EmitAMDGPUNote(
const MCExpr* DescSZ,
124 auto &
Context = S.getContext();
129 S.SwitchSection(
Context.getELFSection(
131 S.EmitIntValue(NameSZ, 4);
132 S.EmitValue(DescSZ, 4);
133 S.EmitIntValue(Type, 4);
135 S.EmitValueToAlignment(4, 0, 1, 0);
137 S.EmitValueToAlignment(4, 0, 1, 0);
161 uint16_t VendorNameSize = VendorName.
size() + 1;
162 uint16_t ArchNameSize = ArchName.
size() + 1;
164 unsigned DescSZ =
sizeof(VendorNameSize) +
sizeof(ArchNameSize) +
165 sizeof(Major) +
sizeof(Minor) +
sizeof(Stepping) +
166 VendorNameSize + ArchNameSize;
223 auto *DescBegin =
Context.createTempSymbol();
224 auto *DescEnd =
Context.createTempSymbol();
void EmitBytes(StringRef Data) override
Emit the bytes in Data into the output.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
void EmitRuntimeMetadata(Module &M) override
void EmitRuntimeMetadata(Module &M) override
A Module instance is used to store all the information related to an LLVM module. ...
void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) override
virtual void EmitBytes(StringRef Data)
Emit the bytes in Data into the output.
Target specific streamer interface.
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...
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.
void EmitLabel(MCSymbol *Symbol) override
Emit a label for Symbol into the current section.
void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) override
MCContext & getContext() const
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...
void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) override
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
This file contains the declarations for the subclasses of Constant, which represent the different fla...
AMDGPUTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS)
void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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
void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
std::string getRuntimeMDYAMLString(Module &M)
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.
print Print MemDeps of function
StringRef - Represent a constant reference to a string, i.e.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
void setBinding(unsigned Binding) const