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 {
|
2016-12-19 19:43:15 +08:00
|
|
|
#include "AMDGPUPTNote.h"
|
2015-06-27 05:15:07 +08:00
|
|
|
|
2016-11-11 05:18:49 +08:00
|
|
|
class DataLayout;
|
2017-02-08 22:05:23 +08:00
|
|
|
class FeatureBitset;
|
2016-11-11 05:18:49 +08:00
|
|
|
class Function;
|
2015-06-27 05:15:07 +08:00
|
|
|
class MCELFStreamer;
|
2016-03-11 16:00:27 +08:00
|
|
|
class MCSymbol;
|
2016-11-11 05:18:49 +08:00
|
|
|
class MDNode;
|
|
|
|
class Module;
|
|
|
|
class Type;
|
2015-06-27 05:15:07 +08:00
|
|
|
|
|
|
|
class AMDGPUTargetStreamer : public MCTargetStreamer {
|
2016-12-19 19:43:15 +08:00
|
|
|
protected:
|
|
|
|
MCContext &getContext() const { return Streamer.getContext(); }
|
|
|
|
|
2015-06-27 05:15:07 +08:00
|
|
|
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;
|
2016-11-11 05:18:49 +08:00
|
|
|
|
2017-02-08 22:05:23 +08:00
|
|
|
virtual void EmitRuntimeMetadata(const FeatureBitset &Features,
|
|
|
|
const Module &M) = 0;
|
2016-12-19 19:43:15 +08:00
|
|
|
|
2017-02-27 15:55:17 +08:00
|
|
|
/// \returns False on success, true on failure.
|
|
|
|
virtual bool EmitRuntimeMetadata(const FeatureBitset &Features,
|
|
|
|
StringRef Metadata) = 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;
|
2016-12-15 01:16:52 +08:00
|
|
|
|
2017-02-08 22:05:23 +08:00
|
|
|
void EmitRuntimeMetadata(const FeatureBitset &Features,
|
|
|
|
const Module &M) override;
|
2016-12-19 19:43:15 +08:00
|
|
|
|
2017-02-27 15:55:17 +08:00
|
|
|
/// \returns False on success, true on failure.
|
|
|
|
bool EmitRuntimeMetadata(const FeatureBitset &Features,
|
|
|
|
StringRef Metadata) override;
|
2015-06-27 05:15:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class AMDGPUTargetELFStreamer : public AMDGPUTargetStreamer {
|
|
|
|
MCStreamer &Streamer;
|
|
|
|
|
2017-01-13 22:39:03 +08:00
|
|
|
void EmitAMDGPUNote(const MCExpr *DescSize, AMDGPU::PT_NOTE::NoteType Type,
|
|
|
|
function_ref<void(MCELFStreamer &)> EmitDesc);
|
2016-12-19 19:43:15 +08:00
|
|
|
|
2015-06-27 05:15:07 +08:00
|
|
|
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;
|
2016-12-15 01:16:52 +08:00
|
|
|
|
2017-02-08 22:05:23 +08:00
|
|
|
void EmitRuntimeMetadata(const FeatureBitset &Features,
|
|
|
|
const Module &M) override;
|
2016-12-19 19:43:15 +08:00
|
|
|
|
2017-02-27 15:55:17 +08:00
|
|
|
/// \returns False on success, true on failure.
|
|
|
|
bool EmitRuntimeMetadata(const FeatureBitset &Features,
|
|
|
|
StringRef Metadata) override;
|
2015-06-27 05:15:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2015-08-16 15:55:08 +08:00
|
|
|
#endif
|