//===-- AMDGPUAsmUtils.cpp - AsmParser/InstPrinter common -----------------===// // // 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 // //===----------------------------------------------------------------------===// #include "AMDGPUAsmUtils.h" #include "AMDGPUBaseInfo.h" #include "SIDefines.h" namespace llvm::AMDGPU { //===----------------------------------------------------------------------===// // Custom Operands. // // A table of custom operands shall describe "primary" operand names first // followed by aliases if any. It is not required but recommended to arrange // operands so that operand encoding match operand position in the table. This // will make getNameFromOperandTable() a bit more efficient. Unused slots in the // table shall have an empty name. // //===----------------------------------------------------------------------===// /// Map from the encoding of a sendmsg/hwreg asm operand to it's name. template <size_t N> static StringRef getNameFromOperandTable(const CustomOperand (&Table)[N], unsigned Encoding, const MCSubtargetInfo &STI) { … } /// Map from a symbolic name for a sendmsg/hwreg asm operand to it's encoding. template <size_t N> static int64_t getEncodingFromOperandTable(const CustomOperand (&Table)[N], StringRef Name, const MCSubtargetInfo &STI) { … } namespace DepCtr { // NOLINTBEGIN const CustomOperandVal DepCtrInfo[] = …; // NOLINTEND const int DEP_CTR_SIZE = …; } // namespace DepCtr namespace SendMsg { // Disable lint checking here since it makes these tables unreadable. // NOLINTBEGIN // clang-format off static constexpr CustomOperand MsgOperands[] = …; static constexpr CustomOperand SysMsgOperands[] = …; static constexpr CustomOperand StreamMsgOperands[] = …; // clang-format on // NOLINTEND int64_t getMsgId(StringRef Name, const MCSubtargetInfo &STI) { … } StringRef getMsgName(uint64_t Encoding, const MCSubtargetInfo &STI) { … } int64_t getMsgOpId(int64_t MsgId, StringRef Name, const MCSubtargetInfo &STI) { … } StringRef getMsgOpName(int64_t MsgId, uint64_t Encoding, const MCSubtargetInfo &STI) { … } } // namespace SendMsg namespace Hwreg { // Disable lint checking for this block since it makes the table unreadable. // NOLINTBEGIN // clang-format off static constexpr CustomOperand Operands[] = …; // clang-format on // NOLINTEND int64_t getHwregId(StringRef Name, const MCSubtargetInfo &STI) { … } StringRef getHwreg(uint64_t Encoding, const MCSubtargetInfo &STI) { … } } // namespace Hwreg namespace MTBUFFormat { StringLiteral const DfmtSymbolic[] = …; StringLiteral const NfmtSymbolicGFX10[] = …; StringLiteral const NfmtSymbolicSICI[] = …; StringLiteral const NfmtSymbolicVI[] = …; StringLiteral const UfmtSymbolicGFX10[] = …; unsigned const DfmtNfmt2UFmtGFX10[] = …; StringLiteral const UfmtSymbolicGFX11[] = …; unsigned const DfmtNfmt2UFmtGFX11[] = …; } // namespace MTBUFFormat namespace Swizzle { // clang-format off // This must be in sync with llvm::AMDGPU::Swizzle::Id enum members, see SIDefines.h. const char *const IdSymbolic[] = …; // clang-format on } // namespace Swizzle namespace VGPRIndexMode { // This must be in sync with llvm::AMDGPU::VGPRIndexMode::Id enum members, see SIDefines.h. const char* const IdSymbolic[] = …; } // namespace VGPRIndexMode namespace UCVersion { ArrayRef<GFXVersion> getGFXVersions() { … } } // namespace UCVersion } // namespace llvm::AMDGPU