#include "AMDGPUTargetStreamer.h"
#include "AMDGPUMCExpr.h"
#include "AMDGPUMCKernelDescriptor.h"
#include "AMDGPUPTNote.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "Utils/AMDKernelCodeTUtils.h"
#include "llvm/BinaryFormat/AMDGPUMetadataVerifier.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/AMDGPUMetadata.h"
#include "llvm/Support/AMDHSAKernelDescriptor.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/TargetParser/TargetParser.h"
usingnamespacellvm;
usingnamespacellvm::AMDGPU;
static cl::opt<unsigned>
ForceGenericVersion("amdgpu-force-generic-version",
cl::desc("Force a specific generic_v<N> flag to be "
"added. For testing purposes only."),
cl::ReallyHidden, cl::init(0));
bool AMDGPUTargetStreamer::EmitHSAMetadataV3(StringRef HSAMetadataString) { … }
StringRef AMDGPUTargetStreamer::getArchNameFromElfMach(unsigned ElfMach) { … }
unsigned AMDGPUTargetStreamer::getElfMach(StringRef GPU) { … }
AMDGPUTargetAsmStreamer::AMDGPUTargetAsmStreamer(MCStreamer &S,
formatted_raw_ostream &OS)
: … { … }
void AMDGPUTargetAsmStreamer::finish() { … }
void AMDGPUTargetAsmStreamer::EmitDirectiveAMDGCNTarget() { … }
void AMDGPUTargetAsmStreamer::EmitDirectiveAMDHSACodeObjectVersion(
unsigned COV) { … }
void AMDGPUTargetAsmStreamer::EmitAMDKernelCodeT(AMDGPUMCKernelCodeT &Header) { … }
void AMDGPUTargetAsmStreamer::EmitAMDGPUSymbolType(StringRef SymbolName,
unsigned Type) { … }
void AMDGPUTargetAsmStreamer::emitAMDGPULDS(MCSymbol *Symbol, unsigned Size,
Align Alignment) { … }
void AMDGPUTargetAsmStreamer::EmitMCResourceInfo(
const MCSymbol *NumVGPR, const MCSymbol *NumAGPR,
const MCSymbol *NumExplicitSGPR, const MCSymbol *PrivateSegmentSize,
const MCSymbol *UsesVCC, const MCSymbol *UsesFlatScratch,
const MCSymbol *HasDynamicallySizedStack, const MCSymbol *HasRecursion,
const MCSymbol *HasIndirectCall) { … }
void AMDGPUTargetAsmStreamer::EmitMCResourceMaximums(const MCSymbol *MaxVGPR,
const MCSymbol *MaxAGPR,
const MCSymbol *MaxSGPR) { … }
bool AMDGPUTargetAsmStreamer::EmitISAVersion() { … }
bool AMDGPUTargetAsmStreamer::EmitHSAMetadata(
msgpack::Document &HSAMetadataDoc, bool Strict) { … }
bool AMDGPUTargetAsmStreamer::EmitKernargPreloadHeader(
const MCSubtargetInfo &STI, bool TrapEnabled) { … }
bool AMDGPUTargetAsmStreamer::EmitCodeEnd(const MCSubtargetInfo &STI) { … }
void AMDGPUTargetAsmStreamer::EmitAmdhsaKernelDescriptor(
const MCSubtargetInfo &STI, StringRef KernelName,
const MCKernelDescriptor &KD, const MCExpr *NextVGPR,
const MCExpr *NextSGPR, const MCExpr *ReserveVCC,
const MCExpr *ReserveFlatScr) { … }
AMDGPUTargetELFStreamer::AMDGPUTargetELFStreamer(MCStreamer &S,
const MCSubtargetInfo &STI)
: … { … }
MCELFStreamer &AMDGPUTargetELFStreamer::getStreamer() { … }
void AMDGPUTargetELFStreamer::finish() { … }
void AMDGPUTargetELFStreamer::EmitNote(
StringRef Name, const MCExpr *DescSZ, unsigned NoteType,
function_ref<void(MCELFStreamer &)> EmitDesc) { … }
unsigned AMDGPUTargetELFStreamer::getEFlags() { … }
unsigned AMDGPUTargetELFStreamer::getEFlagsR600() { … }
unsigned AMDGPUTargetELFStreamer::getEFlagsAMDGCN() { … }
unsigned AMDGPUTargetELFStreamer::getEFlagsUnknownOS() { … }
unsigned AMDGPUTargetELFStreamer::getEFlagsAMDHSA() { … }
unsigned AMDGPUTargetELFStreamer::getEFlagsAMDPAL() { … }
unsigned AMDGPUTargetELFStreamer::getEFlagsMesa3D() { … }
unsigned AMDGPUTargetELFStreamer::getEFlagsV3() { … }
unsigned AMDGPUTargetELFStreamer::getEFlagsV4() { … }
unsigned AMDGPUTargetELFStreamer::getEFlagsV6() { … }
void AMDGPUTargetELFStreamer::EmitDirectiveAMDGCNTarget() { … }
void AMDGPUTargetELFStreamer::EmitAMDKernelCodeT(AMDGPUMCKernelCodeT &Header) { … }
void AMDGPUTargetELFStreamer::EmitAMDGPUSymbolType(StringRef SymbolName,
unsigned Type) { … }
void AMDGPUTargetELFStreamer::emitAMDGPULDS(MCSymbol *Symbol, unsigned Size,
Align Alignment) { … }
bool AMDGPUTargetELFStreamer::EmitISAVersion() { … }
bool AMDGPUTargetELFStreamer::EmitHSAMetadata(msgpack::Document &HSAMetadataDoc,
bool Strict) { … }
bool AMDGPUTargetELFStreamer::EmitKernargPreloadHeader(
const MCSubtargetInfo &STI, bool TrapEnabled) { … }
bool AMDGPUTargetELFStreamer::EmitCodeEnd(const MCSubtargetInfo &STI) { … }
void AMDGPUTargetELFStreamer::EmitAmdhsaKernelDescriptor(
const MCSubtargetInfo &STI, StringRef KernelName,
const MCKernelDescriptor &KernelDescriptor, const MCExpr *NextVGPR,
const MCExpr *NextSGPR, const MCExpr *ReserveVCC,
const MCExpr *ReserveFlatScr) { … }