1
//===-- AMDGPUAsmPrinter.h - Print AMDGPU assembly code ---------*- C++ -*-===//
3
// The LLVM Compiler Infrastructure
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
8
//===----------------------------------------------------------------------===//
11
/// \brief AMDGPU Assembly printer class.
13
//===----------------------------------------------------------------------===//
15
#ifndef LLVM_LIB_TARGET_R600_AMDGPUASMPRINTER_H
16
#define LLVM_LIB_TARGET_R600_AMDGPUASMPRINTER_H
18
#include "llvm/CodeGen/AsmPrinter.h"
23
class AMDGPUAsmPrinter : public AsmPrinter {
25
struct SIProgramInfo {
46
// Fields set in PGM_RSRC1 pm4 packet.
57
uint64_t ComputePGMRSrc1;
59
// Fields set in PGM_RSRC2 pm4 packet.
61
uint32_t ScratchBlocks;
63
uint64_t ComputePGMRSrc2;
70
// Bonus information for debugging.
75
void getSIProgramInfo(SIProgramInfo &Out, const MachineFunction &MF) const;
76
void findNumUsedRegistersSI(const MachineFunction &MF,
78
unsigned &NumVGPR) const;
80
/// \brief Emit register usage information so that the GPU driver
81
/// can correctly setup the GPU state.
82
void EmitProgramInfoR600(const MachineFunction &MF);
83
void EmitProgramInfoSI(const MachineFunction &MF, const SIProgramInfo &KernelInfo);
84
void EmitAmdKernelCodeT(const MachineFunction &MF,
85
const SIProgramInfo &KernelInfo) const;
88
explicit AMDGPUAsmPrinter(TargetMachine &TM,
89
std::unique_ptr<MCStreamer> Streamer);
91
bool runOnMachineFunction(MachineFunction &MF) override;
93
const char *getPassName() const override {
94
return "AMDGPU Assembly Printer";
97
/// Implemented in AMDGPUMCInstLower.cpp
98
void EmitInstruction(const MachineInstr *MI) override;
100
void EmitFunctionBodyStart() override;
102
void EmitEndOfAsmFile(Module &M) override;
104
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
105
unsigned AsmVariant, const char *ExtraCode,
106
raw_ostream &O) override;
109
std::vector<std::string> DisasmLines, HexLines;
110
size_t DisasmLineMaxLen;
113
} // End anonymous llvm