LCOV - code coverage report
Current view: top level - lib/Target/AMDGPU/MCTargetDesc - AMDGPUTargetStreamer.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 5 5 100.0 %
Date: 2018-06-17 00:07:59 Functions: 2 4 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_AMDGPU_MCTARGETDESC_AMDGPUTARGETSTREAMER_H
      11             : #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUTARGETSTREAMER_H
      12             : 
      13             : #include "AMDKernelCodeT.h"
      14             : #include "llvm/MC/MCStreamer.h"
      15             : #include "llvm/MC/MCSubtargetInfo.h"
      16             : #include "llvm/Support/AMDGPUMetadata.h"
      17             : #include "llvm/Support/AMDHSAKernelDescriptor.h"
      18             : 
      19             : namespace llvm {
      20             : #include "AMDGPUPTNote.h"
      21             : 
      22             : class DataLayout;
      23             : class Function;
      24             : class MCELFStreamer;
      25             : class MCSymbol;
      26             : class MDNode;
      27             : class Module;
      28             : class Type;
      29             : 
      30        2199 : class AMDGPUTargetStreamer : public MCTargetStreamer {
      31             : protected:
      32         254 :   MCContext &getContext() const { return Streamer.getContext(); }
      33             : 
      34             :   /// \returns Equivalent EF_AMDGPU_MACH_* value for given \p GPU name.
      35             :   unsigned getMACH(StringRef GPU) const;
      36             : 
      37             : public:
      38             :   /// \returns Equivalent GPU name for an EF_AMDGPU_MACH_* value.
      39             :   static const char *getMachName(unsigned Mach);
      40             : 
      41        2208 :   AMDGPUTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
      42             : 
      43             :   virtual void EmitDirectiveHSACodeObjectVersion(uint32_t Major,
      44             :                                                  uint32_t Minor) = 0;
      45             : 
      46             :   virtual void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor,
      47             :                                              uint32_t Stepping,
      48             :                                              StringRef VendorName,
      49             :                                              StringRef ArchName) = 0;
      50             : 
      51             :   virtual void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) = 0;
      52             : 
      53             :   virtual void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) = 0;
      54             : 
      55             :   /// \returns True on success, false on failure.
      56             :   virtual bool EmitISAVersion(StringRef IsaVersionString) = 0;
      57             : 
      58             :   /// \returns True on success, false on failure.
      59             :   virtual bool EmitHSAMetadata(StringRef HSAMetadataString);
      60             : 
      61             :   /// \returns True on success, false on failure.
      62             :   virtual bool EmitHSAMetadata(const AMDGPU::HSAMD::Metadata &HSAMetadata) = 0;
      63             : 
      64             :   /// \returns True on success, false on failure.
      65             :   virtual bool EmitPALMetadata(const AMDGPU::PALMD::Metadata &PALMetadata) = 0;
      66             : 
      67             :   virtual void EmitAmdhsaKernelDescriptor(
      68             :       StringRef KernelName,
      69             :       const amdhsa::kernel_descriptor_t &KernelDescriptor) = 0;
      70             : };
      71             : 
      72        4118 : class AMDGPUTargetAsmStreamer final : public AMDGPUTargetStreamer {
      73             :   formatted_raw_ostream &OS;
      74             : public:
      75             :   AMDGPUTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
      76             :   void EmitDirectiveHSACodeObjectVersion(uint32_t Major,
      77             :                                          uint32_t Minor) override;
      78             : 
      79             :   void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor,
      80             :                                      uint32_t Stepping, StringRef VendorName,
      81             :                                      StringRef ArchName) override;
      82             : 
      83             :   void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override;
      84             : 
      85             :   void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override;
      86             : 
      87             :   /// \returns True on success, false on failure.
      88             :   bool EmitISAVersion(StringRef IsaVersionString) override;
      89             : 
      90             :   /// \returns True on success, false on failure.
      91             :   bool EmitHSAMetadata(const AMDGPU::HSAMD::Metadata &HSAMetadata) override;
      92             : 
      93             :   /// \returns True on success, false on failure.
      94             :   bool EmitPALMetadata(const AMDGPU::PALMD::Metadata &PALMetadata) override;
      95             : 
      96             :   void EmitAmdhsaKernelDescriptor(
      97             :       StringRef KernelName,
      98             :       const amdhsa::kernel_descriptor_t &KernelDescriptor) override;
      99             : };
     100             : 
     101         280 : class AMDGPUTargetELFStreamer final : public AMDGPUTargetStreamer {
     102             :   MCStreamer &Streamer;
     103             : 
     104             :   void EmitAMDGPUNote(const MCExpr *DescSize, unsigned NoteType,
     105             :                       function_ref<void(MCELFStreamer &)> EmitDesc);
     106             : 
     107             : public:
     108             :   AMDGPUTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
     109             : 
     110             :   MCELFStreamer &getStreamer();
     111             : 
     112             :   void EmitDirectiveHSACodeObjectVersion(uint32_t Major,
     113             :                                          uint32_t Minor) override;
     114             : 
     115             :   void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor,
     116             :                                      uint32_t Stepping, StringRef VendorName,
     117             :                                      StringRef ArchName) override;
     118             : 
     119             :   void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override;
     120             : 
     121             :   void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override;
     122             : 
     123             :   /// \returns True on success, false on failure.
     124             :   bool EmitISAVersion(StringRef IsaVersionString) override;
     125             : 
     126             :   /// \returns True on success, false on failure.
     127             :   bool EmitHSAMetadata(const AMDGPU::HSAMD::Metadata &HSAMetadata) override;
     128             : 
     129             :   /// \returns True on success, false on failure.
     130             :   bool EmitPALMetadata(const AMDGPU::PALMD::Metadata &PALMetadata) override;
     131             : 
     132             :   void EmitAmdhsaKernelDescriptor(
     133             :       StringRef KernelName,
     134             :       const amdhsa::kernel_descriptor_t &KernelDescriptor) override;
     135             : };
     136             : 
     137             : }
     138             : #endif

Generated by: LCOV version 1.13