#include "AMDGPUAsmPrinter.h"
#include "AMDGPU.h"
#include "AMDGPUHSAMetadataStreamer.h"
#include "AMDGPUResourceUsageAnalysis.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUInstPrinter.h"
#include "MCTargetDesc/AMDGPUMCExpr.h"
#include "MCTargetDesc/AMDGPUMCKernelDescriptor.h"
#include "MCTargetDesc/AMDGPUTargetStreamer.h"
#include "R600AsmPrinter.h"
#include "SIMachineFunctionInfo.h"
#include "TargetInfo/AMDGPUTargetInfo.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "Utils/AMDKernelCodeTUtils.h"
#include "Utils/SIDefinesUtils.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/AMDHSAKernelDescriptor.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/TargetParser/TargetParser.h"
usingnamespacellvm;
usingnamespacellvm::AMDGPU;
static uint32_t getFPMode(SIModeRegisterDefaults Mode) { … }
static AsmPrinter *
createAMDGPUAsmPrinterPass(TargetMachine &tm,
std::unique_ptr<MCStreamer> &&Streamer) { … }
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUAsmPrinter() { … }
AMDGPUAsmPrinter::AMDGPUAsmPrinter(TargetMachine &TM,
std::unique_ptr<MCStreamer> Streamer)
: … { … }
StringRef AMDGPUAsmPrinter::getPassName() const { … }
const MCSubtargetInfo *AMDGPUAsmPrinter::getGlobalSTI() const { … }
AMDGPUTargetStreamer* AMDGPUAsmPrinter::getTargetStreamer() const { … }
void AMDGPUAsmPrinter::emitStartOfAsmFile(Module &M) { … }
void AMDGPUAsmPrinter::initTargetStreamer(Module &M) { … }
void AMDGPUAsmPrinter::emitEndOfAsmFile(Module &M) { … }
void AMDGPUAsmPrinter::emitFunctionBodyStart() { … }
void AMDGPUAsmPrinter::emitFunctionBodyEnd() { … }
void AMDGPUAsmPrinter::emitImplicitDef(const MachineInstr *MI) const { … }
void AMDGPUAsmPrinter::emitFunctionEntryLabel() { … }
void AMDGPUAsmPrinter::emitBasicBlockStart(const MachineBasicBlock &MBB) { … }
void AMDGPUAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) { … }
bool AMDGPUAsmPrinter::doInitialization(Module &M) { … }
bool AMDGPUAsmPrinter::doFinalization(Module &M) { … }
void AMDGPUAsmPrinter::emitCommonFunctionComments(
uint32_t NumVGPR, std::optional<uint32_t> NumAGPR, uint32_t TotalNumVGPR,
uint32_t NumSGPR, uint64_t ScratchSize, uint64_t CodeSize,
const AMDGPUMachineFunction *MFI) { … }
SmallString<128> AMDGPUAsmPrinter::getMCExprStr(const MCExpr *Value) { … }
void AMDGPUAsmPrinter::emitCommonFunctionComments(
const MCExpr *NumVGPR, const MCExpr *NumAGPR, const MCExpr *TotalNumVGPR,
const MCExpr *NumSGPR, const MCExpr *ScratchSize, uint64_t CodeSize,
const AMDGPUMachineFunction *MFI) { … }
const MCExpr *AMDGPUAsmPrinter::getAmdhsaKernelCodeProperties(
const MachineFunction &MF) const { … }
MCKernelDescriptor
AMDGPUAsmPrinter::getAmdhsaKernelDescriptor(const MachineFunction &MF,
const SIProgramInfo &PI) const { … }
bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) { … }
void AMDGPUAsmPrinter::initializeTargetID(const Module &M) { … }
uint64_t AMDGPUAsmPrinter::getFunctionCodeSize(const MachineFunction &MF) const { … }
void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
const MachineFunction &MF) { … }
static unsigned getRsrcReg(CallingConv::ID CallConv) { … }
void AMDGPUAsmPrinter::EmitProgramInfoSI(const MachineFunction &MF,
const SIProgramInfo &CurrentProgramInfo) { … }
static void EmitPALMetadataCommon(AMDGPUPALMetadata *MD,
const SIProgramInfo &CurrentProgramInfo,
CallingConv::ID CC, const GCNSubtarget &ST) { … }
void AMDGPUAsmPrinter::EmitPALMetadata(const MachineFunction &MF,
const SIProgramInfo &CurrentProgramInfo) { … }
void AMDGPUAsmPrinter::emitPALFunctionMetadata(const MachineFunction &MF) { … }
static amd_element_byte_size_t getElementByteSizeValue(unsigned Size) { … }
void AMDGPUAsmPrinter::getAmdKernelCode(AMDGPUMCKernelCodeT &Out,
const SIProgramInfo &CurrentProgramInfo,
const MachineFunction &MF) const { … }
bool AMDGPUAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
const char *ExtraCode, raw_ostream &O) { … }
void AMDGPUAsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const { … }
void AMDGPUAsmPrinter::emitResourceUsageRemarks(
const MachineFunction &MF, const SIProgramInfo &CurrentProgramInfo,
bool isModuleEntryFunction, bool hasMAIInsts) { … }