1 //===-- AMDGPUTargetStreamer.h - AMDGPU Target Streamer --------*- C++ -*--===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLVM_LIB_TARGET_R600_MCTARGETDESC_AMDGPUTARGETSTREAMER_H 11 #define LLVM_LIB_TARGET_R600_MCTARGETDESC_AMDGPUTARGETSTREAMER_H 12 13 #include "AMDKernelCodeT.h" 14 #include "llvm/MC/MCStreamer.h" 15 #include "llvm/MC/MCSymbol.h" 16 #include "llvm/Support/Debug.h" 17 namespace llvm { 18 19 class MCELFStreamer; 20 21 class AMDGPUTargetStreamer : public MCTargetStreamer { 22 public: 23 AMDGPUTargetStreamer(MCStreamer &S); 24 virtual void EmitDirectiveHSACodeObjectVersion(uint32_t Major, 25 uint32_t Minor) = 0; 26 27 virtual void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor, 28 uint32_t Stepping, 29 StringRef VendorName, 30 StringRef ArchName) = 0; 31 32 virtual void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) = 0; 33 34 virtual void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) = 0; 35 36 virtual void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) = 0; 37 38 virtual void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) = 0; 39 }; 40 41 class AMDGPUTargetAsmStreamer : public AMDGPUTargetStreamer { 42 formatted_raw_ostream &OS; 43 public: 44 AMDGPUTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS); 45 void EmitDirectiveHSACodeObjectVersion(uint32_t Major, 46 uint32_t Minor) override; 47 48 void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor, 49 uint32_t Stepping, StringRef VendorName, 50 StringRef ArchName) override; 51 52 void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override; 53 54 void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override; 55 56 void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) override; 57 58 void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) override; 59 }; 60 61 class AMDGPUTargetELFStreamer : public AMDGPUTargetStreamer { 62 63 enum NoteType { 64 NT_AMDGPU_HSA_CODE_OBJECT_VERSION = 1, 65 NT_AMDGPU_HSA_HSAIL = 2, 66 NT_AMDGPU_HSA_ISA = 3, 67 NT_AMDGPU_HSA_PRODUCER = 4, 68 NT_AMDGPU_HSA_PRODUCER_OPTIONS = 5, 69 NT_AMDGPU_HSA_EXTENSION = 6, 70 NT_AMDGPU_HSA_HLDEBUG_DEBUG = 101, 71 NT_AMDGPU_HSA_HLDEBUG_TARGET = 102 72 }; 73 74 MCStreamer &Streamer; 75 76 public: 77 AMDGPUTargetELFStreamer(MCStreamer &S); 78 79 MCELFStreamer &getStreamer(); 80 81 void EmitDirectiveHSACodeObjectVersion(uint32_t Major, 82 uint32_t Minor) override; 83 84 void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor, 85 uint32_t Stepping, StringRef VendorName, 86 StringRef ArchName) override; 87 88 void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override; 89 90 void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override; 91 92 void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) override; 93 94 void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) override; 95 }; 96 97 } 98 #endif 99