1 //===--- AMDGPUHSAMetadataStreamer.h ----------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief AMDGPU HSA Metadata Streamer.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUHSAMETADATASTREAMER_H
17 #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUHSAMETADATASTREAMER_H
20 #include "AMDKernelCodeT.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/Support/AMDGPUMetadata.h"
36 class MetadataStreamer final {
41 void dump(StringRef HSAMetadataString) const;
43 void verify(StringRef HSAMetadataString) const;
45 AccessQualifier getAccessQualifier(StringRef AccQual) const;
47 AddressSpaceQualifier getAddressSpaceQualifer(unsigned AddressSpace) const;
49 ValueKind getValueKind(Type *Ty, StringRef TypeQual,
50 StringRef BaseTypeName) const;
52 ValueType getValueType(Type *Ty, StringRef TypeName) const;
54 std::string getTypeName(Type *Ty, bool Signed) const;
56 std::vector<uint32_t> getWorkGroupDimensions(MDNode *Node) const;
60 void emitPrintf(const Module &Mod);
62 void emitKernelLanguage(const Function &Func);
64 void emitKernelAttrs(const Function &Func);
66 void emitKernelArgs(const Function &Func);
68 void emitKernelArg(const Argument &Arg);
70 void emitKernelArg(const DataLayout &DL, Type *Ty, ValueKind ValueKind,
71 StringRef Name = "", StringRef TypeName = "",
72 StringRef BaseTypeName = "", StringRef AccQual = "",
73 StringRef TypeQual = "");
76 MetadataStreamer() = default;
77 ~MetadataStreamer() = default;
79 const Metadata &getHSAMetadata() const {
83 void begin(const Module &Mod);
87 void emitKernel(const Function &Func,
88 const Kernel::CodeProps::Metadata &CodeProps,
89 const Kernel::DebugProps::Metadata &DebugProps);
92 } // end namespace HSAMD
93 } // end namespace AMDGPU
94 } // end namespace llvm
96 #endif // LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUHSAMETADATASTREAMER_H