llvm/llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp

//===-- AMDGPUPALMetadata.cpp - Accumulate and print AMDGPU PAL metadata  -===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
/// \file
///
/// This class has methods called by AMDGPUAsmPrinter to accumulate and print
/// the PAL metadata.
//
//===----------------------------------------------------------------------===//
//

#include "AMDGPUPALMetadata.h"
#include "AMDGPUPTNote.h"
#include "SIDefines.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/Support/AMDGPUMetadata.h"
#include "llvm/Support/EndianStream.h"

usingnamespacellvm;
usingnamespacellvm::AMDGPU;

// Read the PAL metadata from IR metadata, where it was put by the frontend.
void AMDGPUPALMetadata::readFromIR(Module &M) {}

// Set PAL metadata from a binary blob from the applicable .note record.
// Returns false if bad format.  Blob must remain valid for the lifetime of the
// Metadata.
bool AMDGPUPALMetadata::setFromBlob(unsigned Type, StringRef Blob) {}

// Set PAL metadata from legacy (array of key=value pairs) blob.
bool AMDGPUPALMetadata::setFromLegacyBlob(StringRef Blob) {}

// Set PAL metadata from msgpack blob.
bool AMDGPUPALMetadata::setFromMsgPackBlob(StringRef Blob) {}

// Given the calling convention, calculate the register number for rsrc1. In
// principle the register number could change in future hardware, but we know
// it is the same for gfx6-9 (except that LS and ES don't exist on gfx9), so
// we can use fixed values.
static unsigned getRsrc1Reg(CallingConv::ID CC) {}

// Calculate the PAL metadata key for *S_SCRATCH_SIZE. It can be used
// with a constant offset to access any non-register shader-specific PAL
// metadata key.
static unsigned getScratchSizeKey(CallingConv::ID CC) {}

// Set the rsrc1 register in the metadata for a particular shader stage.
// In fact this ORs the value into any previous setting of the register.
void AMDGPUPALMetadata::setRsrc1(CallingConv::ID CC, unsigned Val) {}

void AMDGPUPALMetadata::setRsrc1(CallingConv::ID CC, const MCExpr *Val,
                                 MCContext &Ctx) {}

// Set the rsrc2 register in the metadata for a particular shader stage.
// In fact this ORs the value into any previous setting of the register.
void AMDGPUPALMetadata::setRsrc2(CallingConv::ID CC, unsigned Val) {}

void AMDGPUPALMetadata::setRsrc2(CallingConv::ID CC, const MCExpr *Val,
                                 MCContext &Ctx) {}

// Set the SPI_PS_INPUT_ENA register in the metadata.
// In fact this ORs the value into any previous setting of the register.
void AMDGPUPALMetadata::setSpiPsInputEna(unsigned Val) {}

// Set the SPI_PS_INPUT_ADDR register in the metadata.
// In fact this ORs the value into any previous setting of the register.
void AMDGPUPALMetadata::setSpiPsInputAddr(unsigned Val) {}

// Get a register from the metadata, or 0 if not currently set.
unsigned AMDGPUPALMetadata::getRegister(unsigned Reg) {}

// Set a register in the metadata.
// In fact this ORs the value into any previous setting of the register.
void AMDGPUPALMetadata::setRegister(unsigned Reg, unsigned Val) {}

// Set a register in the metadata.
// In fact this ORs the value into any previous setting of the register.
void AMDGPUPALMetadata::setRegister(unsigned Reg, const MCExpr *Val,
                                    MCContext &Ctx) {}

// Set the entry point name for one shader.
void AMDGPUPALMetadata::setEntryPoint(unsigned CC, StringRef Name) {}

// Set the number of used vgprs in the metadata. This is an optional
// advisory record for logging etc; wave dispatch actually uses the rsrc1
// register for the shader stage to determine the number of vgprs to
// allocate.
void AMDGPUPALMetadata::setNumUsedVgprs(CallingConv::ID CC, unsigned Val) {}

void AMDGPUPALMetadata::setNumUsedVgprs(CallingConv::ID CC, const MCExpr *Val,
                                        MCContext &Ctx) {}

// Set the number of used agprs in the metadata.
void AMDGPUPALMetadata::setNumUsedAgprs(CallingConv::ID CC, unsigned Val) {}

void AMDGPUPALMetadata::setNumUsedAgprs(unsigned CC, const MCExpr *Val) {}

// Set the number of used sgprs in the metadata. This is an optional advisory
// record for logging etc; wave dispatch actually uses the rsrc1 register for
// the shader stage to determine the number of sgprs to allocate.
void AMDGPUPALMetadata::setNumUsedSgprs(CallingConv::ID CC, unsigned Val) {}

void AMDGPUPALMetadata::setNumUsedSgprs(unsigned CC, const MCExpr *Val,
                                        MCContext &Ctx) {}

// Set the scratch size in the metadata.
void AMDGPUPALMetadata::setScratchSize(CallingConv::ID CC, unsigned Val) {}

void AMDGPUPALMetadata::setScratchSize(unsigned CC, const MCExpr *Val,
                                       MCContext &Ctx) {}

// Set the stack frame size of a function in the metadata.
void AMDGPUPALMetadata::setFunctionScratchSize(StringRef FnName, unsigned Val) {}

// Set the amount of LDS used in bytes in the metadata.
void AMDGPUPALMetadata::setFunctionLdsSize(StringRef FnName, unsigned Val) {}

// Set the number of used vgprs in the metadata.
void AMDGPUPALMetadata::setFunctionNumUsedVgprs(StringRef FnName,
                                                unsigned Val) {}

void AMDGPUPALMetadata::setFunctionNumUsedVgprs(StringRef FnName,
                                                const MCExpr *Val) {}

// Set the number of used vgprs in the metadata.
void AMDGPUPALMetadata::setFunctionNumUsedSgprs(StringRef FnName,
                                                unsigned Val) {}

void AMDGPUPALMetadata::setFunctionNumUsedSgprs(StringRef FnName,
                                                const MCExpr *Val) {}

// Set the hardware register bit in PAL metadata to enable wave32 on the
// shader of the given calling convention.
void AMDGPUPALMetadata::setWave32(unsigned CC) {}

// Convert a register number to name, for display by toString().
// Returns nullptr if none.
static const char *getRegisterName(unsigned RegNum) {}

// Convert the accumulated PAL metadata into an asm directive.
void AMDGPUPALMetadata::toString(std::string &String) {}

// Convert the accumulated PAL metadata into a binary blob for writing as
// a .note record of the specified AMD type. Returns an empty blob if
// there is no PAL metadata,
void AMDGPUPALMetadata::toBlob(unsigned Type, std::string &Blob) {}

void AMDGPUPALMetadata::toLegacyBlob(std::string &Blob) {}

void AMDGPUPALMetadata::toMsgPackBlob(std::string &Blob) {}

// Set PAL metadata from YAML text. Returns false if failed.
bool AMDGPUPALMetadata::setFromString(StringRef S) {}

// Reference (create if necessary) the node for the registers map.
msgpack::DocNode &AMDGPUPALMetadata::refRegisters() {}

// Get (create if necessary) the registers map.
msgpack::MapDocNode AMDGPUPALMetadata::getRegisters() {}

// Reference (create if necessary) the node for the shader functions map.
msgpack::DocNode &AMDGPUPALMetadata::refShaderFunctions() {}

// Get (create if necessary) the shader functions map.
msgpack::MapDocNode AMDGPUPALMetadata::getShaderFunctions() {}

// Get (create if necessary) a function in the shader functions map.
msgpack::MapDocNode AMDGPUPALMetadata::getShaderFunction(StringRef Name) {}

msgpack::DocNode &AMDGPUPALMetadata::refComputeRegisters() {}

msgpack::MapDocNode AMDGPUPALMetadata::getComputeRegisters() {}

msgpack::DocNode &AMDGPUPALMetadata::refGraphicsRegisters() {}

msgpack::MapDocNode AMDGPUPALMetadata::getGraphicsRegisters() {}

// Return the PAL metadata hardware shader stage name.
static const char *getStageName(CallingConv::ID CC) {}

msgpack::DocNode &AMDGPUPALMetadata::refHwStage() {}

// Get (create if necessary) the .hardware_stages entry for the given calling
// convention.
msgpack::MapDocNode AMDGPUPALMetadata::getHwStage(unsigned CC) {}

// Get .note record vendor name of metadata blob to be emitted.
const char *AMDGPUPALMetadata::getVendor() const {}

// Get .note record type of metadata blob to be emitted:
// ELF::NT_AMD_PAL_METADATA (legacy key=val format), or
// ELF::NT_AMDGPU_METADATA (MsgPack format), or
// 0 (no PAL metadata).
unsigned AMDGPUPALMetadata::getType() const {}

// Return whether the blob type is legacy PAL metadata.
bool AMDGPUPALMetadata::isLegacy() const {}

// Set legacy PAL metadata format.
void AMDGPUPALMetadata::setLegacy() {}

// Erase all PAL metadata.
void AMDGPUPALMetadata::reset() {}

bool AMDGPUPALMetadata::resolvedAllMCExpr() {}

unsigned AMDGPUPALMetadata::getPALVersion(unsigned idx) {}

unsigned AMDGPUPALMetadata::getPALMajorVersion() {}

unsigned AMDGPUPALMetadata::getPALMinorVersion() {}

// Set the field in a given .hardware_stages entry
void AMDGPUPALMetadata::setHwStage(unsigned CC, StringRef field, unsigned Val) {}

void AMDGPUPALMetadata::setHwStage(unsigned CC, StringRef field, bool Val) {}

void AMDGPUPALMetadata::setHwStage(unsigned CC, StringRef field,
                                   msgpack::Type Type, const MCExpr *Val) {}

void AMDGPUPALMetadata::setComputeRegisters(StringRef field, unsigned Val) {}

void AMDGPUPALMetadata::setComputeRegisters(StringRef field, bool Val) {}

msgpack::DocNode *AMDGPUPALMetadata::refComputeRegister(StringRef field) {}

bool AMDGPUPALMetadata::checkComputeRegisters(StringRef field, unsigned Val) {}

bool AMDGPUPALMetadata::checkComputeRegisters(StringRef field, bool Val) {}

void AMDGPUPALMetadata::setGraphicsRegisters(StringRef field, unsigned Val) {}

void AMDGPUPALMetadata::setGraphicsRegisters(StringRef field, bool Val) {}

void AMDGPUPALMetadata::setGraphicsRegisters(StringRef field1, StringRef field2,
                                             unsigned Val) {}

void AMDGPUPALMetadata::setGraphicsRegisters(StringRef field1, StringRef field2,
                                             bool Val) {}