2015-06-27 05:15:07 +08:00
|
|
|
//===-- AMDGPUTargetStreamer.h - AMDGPU Target Streamer --------*- C++ -*--===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-03-11 16:00:27 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUTARGETSTREAMER_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUTARGETSTREAMER_H
|
2015-08-16 15:55:08 +08:00
|
|
|
|
2015-06-27 05:58:31 +08:00
|
|
|
#include "AMDKernelCodeT.h"
|
2015-06-27 05:15:07 +08:00
|
|
|
#include "llvm/MC/MCStreamer.h"
|
2016-03-11 16:00:27 +08:00
|
|
|
|
2015-06-27 05:15:07 +08:00
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MCELFStreamer;
|
2016-03-11 16:00:27 +08:00
|
|
|
class MCSymbol;
|
2015-06-27 05:15:07 +08:00
|
|
|
|
|
|
|
class AMDGPUTargetStreamer : public MCTargetStreamer {
|
|
|
|
public:
|
|
|
|
AMDGPUTargetStreamer(MCStreamer &S);
|
|
|
|
virtual void EmitDirectiveHSACodeObjectVersion(uint32_t Major,
|
|
|
|
uint32_t Minor) = 0;
|
|
|
|
|
|
|
|
virtual void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor,
|
|
|
|
uint32_t Stepping,
|
|
|
|
StringRef VendorName,
|
|
|
|
StringRef ArchName) = 0;
|
2015-06-27 05:58:31 +08:00
|
|
|
|
|
|
|
virtual void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) = 0;
|
2015-11-06 19:45:14 +08:00
|
|
|
|
|
|
|
virtual void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) = 0;
|
2015-12-03 03:47:57 +08:00
|
|
|
|
|
|
|
virtual void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) = 0;
|
|
|
|
|
|
|
|
virtual void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) = 0;
|
2015-06-27 05:15:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class AMDGPUTargetAsmStreamer : public AMDGPUTargetStreamer {
|
|
|
|
formatted_raw_ostream &OS;
|
|
|
|
public:
|
|
|
|
AMDGPUTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
|
|
|
|
void EmitDirectiveHSACodeObjectVersion(uint32_t Major,
|
|
|
|
uint32_t Minor) override;
|
|
|
|
|
|
|
|
void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor,
|
|
|
|
uint32_t Stepping, StringRef VendorName,
|
|
|
|
StringRef ArchName) override;
|
2015-06-27 05:58:31 +08:00
|
|
|
|
|
|
|
void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override;
|
2015-11-06 19:45:14 +08:00
|
|
|
|
|
|
|
void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override;
|
2015-12-03 03:47:57 +08:00
|
|
|
|
|
|
|
void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) override;
|
|
|
|
|
|
|
|
void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) override;
|
2015-06-27 05:15:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class AMDGPUTargetELFStreamer : public AMDGPUTargetStreamer {
|
|
|
|
|
|
|
|
enum NoteType {
|
|
|
|
NT_AMDGPU_HSA_CODE_OBJECT_VERSION = 1,
|
|
|
|
NT_AMDGPU_HSA_HSAIL = 2,
|
|
|
|
NT_AMDGPU_HSA_ISA = 3,
|
|
|
|
NT_AMDGPU_HSA_PRODUCER = 4,
|
|
|
|
NT_AMDGPU_HSA_PRODUCER_OPTIONS = 5,
|
|
|
|
NT_AMDGPU_HSA_EXTENSION = 6,
|
|
|
|
NT_AMDGPU_HSA_HLDEBUG_DEBUG = 101,
|
|
|
|
NT_AMDGPU_HSA_HLDEBUG_TARGET = 102
|
|
|
|
};
|
|
|
|
|
|
|
|
MCStreamer &Streamer;
|
|
|
|
|
|
|
|
public:
|
|
|
|
AMDGPUTargetELFStreamer(MCStreamer &S);
|
|
|
|
|
|
|
|
MCELFStreamer &getStreamer();
|
|
|
|
|
|
|
|
void EmitDirectiveHSACodeObjectVersion(uint32_t Major,
|
|
|
|
uint32_t Minor) override;
|
|
|
|
|
|
|
|
void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor,
|
|
|
|
uint32_t Stepping, StringRef VendorName,
|
|
|
|
StringRef ArchName) override;
|
2015-06-27 05:58:31 +08:00
|
|
|
|
|
|
|
void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override;
|
|
|
|
|
2015-11-06 19:45:14 +08:00
|
|
|
void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override;
|
2015-12-03 03:47:57 +08:00
|
|
|
|
|
|
|
void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) override;
|
|
|
|
|
|
|
|
void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) override;
|
2015-06-27 05:15:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2015-08-16 15:55:08 +08:00
|
|
|
#endif
|