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-02-21 06:32:55 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             : 
      18             : namespace llvm {
      19             : #include "AMDGPUPTNote.h"
      20             : 
      21             : class DataLayout;
      22             : class Function;
      23             : class MCELFStreamer;
      24             : class MCSymbol;
      25             : class MDNode;
      26             : class Module;
      27             : class Type;
      28             : 
      29        2057 : class AMDGPUTargetStreamer : public MCTargetStreamer {
      30             : protected:
      31         233 :   MCContext &getContext() const { return Streamer.getContext(); }
      32             : 
      33             :   /// \returns Equivalent EF_AMDGPU_MACH_* value for given \p GPU name.
      34             :   unsigned getMACH(StringRef GPU) const;
      35             : 
      36             : public:
      37        2066 :   AMDGPUTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
      38             : 
      39             :   virtual void EmitDirectiveHSACodeObjectVersion(uint32_t Major,
      40             :                                                  uint32_t Minor) = 0;
      41             : 
      42             :   virtual void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor,
      43             :                                              uint32_t Stepping,
      44             :                                              StringRef VendorName,
      45             :                                              StringRef ArchName) = 0;
      46             : 
      47             :   virtual void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) = 0;
      48             : 
      49             :   virtual void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) = 0;
      50             : 
      51             :   /// \returns True on success, false on failure.
      52             :   virtual bool EmitISAVersion(StringRef IsaVersionString) = 0;
      53             : 
      54             :   /// \returns True on success, false on failure.
      55             :   virtual bool EmitHSAMetadata(StringRef HSAMetadataString);
      56             : 
      57             :   /// \returns True on success, false on failure.
      58             :   virtual bool EmitHSAMetadata(const AMDGPU::HSAMD::Metadata &HSAMetadata) = 0;
      59             : 
      60             :   /// \returns True on success, false on failure.
      61             :   virtual bool EmitPALMetadata(const AMDGPU::PALMD::Metadata &PALMetadata) = 0;
      62             : };
      63             : 
      64        3850 : class AMDGPUTargetAsmStreamer final : public AMDGPUTargetStreamer {
      65             :   formatted_raw_ostream &OS;
      66             : public:
      67             :   AMDGPUTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
      68             :   void EmitDirectiveHSACodeObjectVersion(uint32_t Major,
      69             :                                          uint32_t Minor) override;
      70             : 
      71             :   void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor,
      72             :                                      uint32_t Stepping, StringRef VendorName,
      73             :                                      StringRef ArchName) override;
      74             : 
      75             :   void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override;
      76             : 
      77             :   void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override;
      78             : 
      79             :   /// \returns True on success, false on failure.
      80             :   bool EmitISAVersion(StringRef IsaVersionString) override;
      81             : 
      82             :   /// \returns True on success, false on failure.
      83             :   bool EmitHSAMetadata(const AMDGPU::HSAMD::Metadata &HSAMetadata) override;
      84             : 
      85             :   /// \returns True on success, false on failure.
      86             :   bool EmitPALMetadata(const AMDGPU::PALMD::Metadata &PALMetadata) override;
      87             : };
      88             : 
      89         264 : class AMDGPUTargetELFStreamer final : public AMDGPUTargetStreamer {
      90             :   MCStreamer &Streamer;
      91             : 
      92             :   void EmitAMDGPUNote(const MCExpr *DescSize, unsigned NoteType,
      93             :                       function_ref<void(MCELFStreamer &)> EmitDesc);
      94             : 
      95             : public:
      96             :   AMDGPUTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
      97             : 
      98             :   MCELFStreamer &getStreamer();
      99             : 
     100             :   void EmitDirectiveHSACodeObjectVersion(uint32_t Major,
     101             :                                          uint32_t Minor) override;
     102             : 
     103             :   void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor,
     104             :                                      uint32_t Stepping, StringRef VendorName,
     105             :                                      StringRef ArchName) override;
     106             : 
     107             :   void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override;
     108             : 
     109             :   void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override;
     110             : 
     111             :   /// \returns True on success, false on failure.
     112             :   bool EmitISAVersion(StringRef IsaVersionString) override;
     113             : 
     114             :   /// \returns True on success, false on failure.
     115             :   bool EmitHSAMetadata(const AMDGPU::HSAMD::Metadata &HSAMetadata) override;
     116             : 
     117             :   /// \returns True on success, false on failure.
     118             :   bool EmitPALMetadata(const AMDGPU::PALMD::Metadata &PALMetadata) override;
     119             : };
     120             : 
     121             : }
     122             : #endif

Generated by: LCOV version 1.13