brintos

brintos / llvm-project-archived public Read only

0
0
Text · 13.4 KiB · 564d6ee Raw
255 lines · c
1//===-- AMDGPUInstPrinter.h - AMDGPU MC Inst -> ASM interface ---*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9/// \file10//===----------------------------------------------------------------------===//11 12#ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUINSTPRINTER_H13#define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUINSTPRINTER_H14 15#include "llvm/MC/MCInstPrinter.h"16 17namespace llvm {18class MCInstrDesc;19 20class AMDGPUInstPrinter : public MCInstPrinter {21public:22  AMDGPUInstPrinter(const MCAsmInfo &MAI,23                    const MCInstrInfo &MII, const MCRegisterInfo &MRI)24    : MCInstPrinter(MAI, MII, MRI) {}25 26  // Autogenerated by tblgen27  std::pair<const char *, uint64_t>28  getMnemonic(const MCInst &MI) const override;29  void printInstruction(const MCInst *MI, uint64_t Address,30                        const MCSubtargetInfo &STI, raw_ostream &O);31  static const char *getRegisterName(MCRegister Reg);32 33  void printRegName(raw_ostream &OS, MCRegister Reg) override;34  void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,35                 const MCSubtargetInfo &STI, raw_ostream &O) override;36  static void printRegOperand(MCRegister Reg, raw_ostream &O,37                              const MCRegisterInfo &MRI);38  void printRegOperand(MCRegister Reg, unsigned Opc, unsigned OpNo,39                       raw_ostream &O, const MCRegisterInfo &MRI);40 41private:42  void printU16ImmOperand(const MCInst *MI, unsigned OpNo,43                          const MCSubtargetInfo &STI, raw_ostream &O);44  void printU16ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);45  void printU32ImmOperand(const MCInst *MI, unsigned OpNo,46                          const MCSubtargetInfo &STI, raw_ostream &O);47  void printFP64ImmOperand(const MCInst *MI, unsigned OpNo,48                           const MCSubtargetInfo &STI, raw_ostream &O);49  void printNamedBit(const MCInst *MI, unsigned OpNo, raw_ostream &O,50                     StringRef BitName);51  void printOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,52                   raw_ostream &O);53  void printFlatOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,54                       raw_ostream &O);55 56  void printSMRDOffset8(const MCInst *MI, unsigned OpNo,57                       const MCSubtargetInfo &STI, raw_ostream &O);58  void printSMEMOffset(const MCInst *MI, unsigned OpNo,59                       const MCSubtargetInfo &STI, raw_ostream &O);60  void printSMRDLiteralOffset(const MCInst *MI, unsigned OpNo,61                              const MCSubtargetInfo &STI, raw_ostream &O);62  void printCPol(const MCInst *MI, unsigned OpNo,63                 const MCSubtargetInfo &STI, raw_ostream &O);64  void printTH(const MCInst *MI, int64_t TH, int64_t Scope, raw_ostream &O);65  void printScope(int64_t Scope, raw_ostream &O);66  void printDim(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,67                raw_ostream &O);68  void printR128A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,69                 raw_ostream &O);70  void printFORMAT(const MCInst *MI, unsigned OpNo,71                   const MCSubtargetInfo &STI, raw_ostream &O);72  void printSymbolicFormat(const MCInst *MI,73                           const MCSubtargetInfo &STI, raw_ostream &O);74 75  void printRegOperand(MCRegister Reg, raw_ostream &O);76  void printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,77                   raw_ostream &O);78  void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,79                      raw_ostream &O);80  void printAVLdSt32Align2RegOp(const MCInst *MI, unsigned OpNo,81                                const MCSubtargetInfo &STI, raw_ostream &O);82 83  void printImmediateInt16(uint32_t Imm, const MCSubtargetInfo &STI,84                           raw_ostream &O);85  void printImmediateBF16(uint32_t Imm, const MCSubtargetInfo &STI,86                          raw_ostream &O);87  void printImmediateF16(uint32_t Imm, const MCSubtargetInfo &STI,88                         raw_ostream &O);89  void printImmediateV216(uint32_t Imm, uint8_t OpType,90                          const MCSubtargetInfo &STI, raw_ostream &O);91  bool printImmediateFloat32(uint32_t Imm, const MCSubtargetInfo &STI,92                             raw_ostream &O);93  void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,94                        raw_ostream &O);95  void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,96                        raw_ostream &O, bool IsFP);97  void printLiteral64(uint64_t Imm, raw_ostream &O, bool IsFP);98  void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,99                    raw_ostream &O);100  void printRegularOperand(const MCInst *MI, unsigned OpNo,101                           const MCSubtargetInfo &STI, raw_ostream &O);102  void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,103                    const MCSubtargetInfo &STI, raw_ostream &O) {104    printOperand(MI, OpNum, STI, O);105  }106  void printOperandAndFPInputMods(const MCInst *MI, unsigned OpNo,107                                  const MCSubtargetInfo &STI, raw_ostream &O);108  void printOperandAndIntInputMods(const MCInst *MI, unsigned OpNo,109                                   const MCSubtargetInfo &STI, raw_ostream &O);110  void printDPP8(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,111                 raw_ostream &O);112  void printDPPCtrl(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,113                    raw_ostream &O);114  void printDppBoundCtrl(const MCInst *MI, unsigned OpNo,115                         const MCSubtargetInfo &STI, raw_ostream &O);116  void printDppFI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,117                  raw_ostream &O);118  void printSDWASel(const MCInst *MI, unsigned OpNo, raw_ostream &O);119  void printSDWADstSel(const MCInst *MI, unsigned OpNo,120                       const MCSubtargetInfo &STI, raw_ostream &O);121  void printSDWASrc0Sel(const MCInst *MI, unsigned OpNo,122                        const MCSubtargetInfo &STI, raw_ostream &O);123  void printSDWASrc1Sel(const MCInst *MI, unsigned OpNo,124                        const MCSubtargetInfo &STI, raw_ostream &O);125  void printSDWADstUnused(const MCInst *MI, unsigned OpNo,126                          const MCSubtargetInfo &STI, raw_ostream &O);127  void printPackedModifier(const MCInst *MI, StringRef Name, unsigned Mod,128                           raw_ostream &O);129  void printOpSel(const MCInst *MI, unsigned OpNo,130                  const MCSubtargetInfo &STI, raw_ostream &O);131  void printOpSelHi(const MCInst *MI, unsigned OpNo,132                  const MCSubtargetInfo &STI, raw_ostream &O);133  void printNegLo(const MCInst *MI, unsigned OpNo,134                  const MCSubtargetInfo &STI, raw_ostream &O);135  void printNegHi(const MCInst *MI, unsigned OpNo,136                  const MCSubtargetInfo &STI, raw_ostream &O);137  void printIndexKey8bit(const MCInst *MI, unsigned OpNo,138                         const MCSubtargetInfo &STI, raw_ostream &O);139  void printIndexKey16bit(const MCInst *MI, unsigned OpNo,140                          const MCSubtargetInfo &STI, raw_ostream &O);141  void printIndexKey32bit(const MCInst *MI, unsigned OpNo,142                          const MCSubtargetInfo &STI, raw_ostream &O);143  void printMatrixFMT(const MCInst *MI, unsigned OpNo,144                      const MCSubtargetInfo &STI, raw_ostream &O, char AorB);145  void printMatrixAFMT(const MCInst *MI, unsigned OpNo,146                       const MCSubtargetInfo &STI, raw_ostream &O);147  void printMatrixBFMT(const MCInst *MI, unsigned OpNo,148                       const MCSubtargetInfo &STI, raw_ostream &O);149  void printMatrixScale(const MCInst *MI, unsigned OpNo,150                        const MCSubtargetInfo &STI, raw_ostream &O, char AorB);151  void printMatrixAScale(const MCInst *MI, unsigned OpNo,152                         const MCSubtargetInfo &STI, raw_ostream &O);153  void printMatrixBScale(const MCInst *MI, unsigned OpNo,154                         const MCSubtargetInfo &STI, raw_ostream &O);155  void printMatrixScaleFmt(const MCInst *MI, unsigned OpNo,156                           const MCSubtargetInfo &STI, raw_ostream &O,157                           char AorB);158  void printMatrixAScaleFmt(const MCInst *MI, unsigned OpNo,159                            const MCSubtargetInfo &STI, raw_ostream &O);160  void printMatrixBScaleFmt(const MCInst *MI, unsigned OpNo,161                            const MCSubtargetInfo &STI, raw_ostream &O);162  void printInterpSlot(const MCInst *MI, unsigned OpNo,163                       const MCSubtargetInfo &STI, raw_ostream &O);164  void printInterpAttr(const MCInst *MI, unsigned OpNo,165                       const MCSubtargetInfo &STI, raw_ostream &O);166  void printInterpAttrChan(const MCInst *MI, unsigned OpNo,167                           const MCSubtargetInfo &STI, raw_ostream &O);168 169  void printGPRIdxMode(const MCInst *MI, unsigned OpNo,170                       const MCSubtargetInfo &STI, raw_ostream &O);171  void printMemOperand(const MCInst *MI, unsigned OpNo,172                       const MCSubtargetInfo &STI, raw_ostream &O);173  void printBLGP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,174                 raw_ostream &O);175  bool needsImpliedVcc(const MCInstrDesc &Desc, unsigned OpNo) const;176  void printDefaultVccOperand(bool FirstOperand, const MCSubtargetInfo &STI,177                              raw_ostream &O);178 179  void printExpSrcN(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,180                    raw_ostream &O, unsigned N);181  void printExpSrc0(const MCInst *MI, unsigned OpNo,182                    const MCSubtargetInfo &STI, raw_ostream &O);183  void printExpSrc1(const MCInst *MI, unsigned OpNo,184                    const MCSubtargetInfo &STI, raw_ostream &O);185  void printExpSrc2(const MCInst *MI, unsigned OpNo,186                    const MCSubtargetInfo &STI, raw_ostream &O);187  void printExpSrc3(const MCInst *MI, unsigned OpNo,188                    const MCSubtargetInfo &STI, raw_ostream &O);189  void printExpTgt(const MCInst *MI, unsigned OpNo,190                   const MCSubtargetInfo &STI, raw_ostream &O);191  void printNamedInt(const MCInst *MI, unsigned OpNo,192                     const MCSubtargetInfo &STI, raw_ostream &O,193                     StringRef Prefix, bool PrintInHex, bool AlwaysPrint);194 195  void printScaleSel(const MCInst *MI, unsigned OpNo,196                     const MCSubtargetInfo &STI, raw_ostream &O);197  void printBitOp3(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,198                   raw_ostream &O);199 200public:201  static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,202                         StringRef Asm, StringRef Default = "");203  static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,204                         char Asm);205protected:206  void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,207                raw_ostream &O);208  void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,209                  raw_ostream &O);210  void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,211                   raw_ostream &O);212  void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,213                    raw_ostream &O);214  void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,215                 raw_ostream &O);216  void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,217                raw_ostream &O);218  void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,219                 raw_ostream &O);220  void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,221                raw_ostream &O);222  void printUpdateExecMask(const MCInst *MI, unsigned OpNo,223                           const MCSubtargetInfo &STI, raw_ostream &O);224  void printUpdatePred(const MCInst *MI, unsigned OpNo,225                       const MCSubtargetInfo &STI, raw_ostream &O);226  void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,227                  raw_ostream &O);228  void printBankSwizzle(const MCInst *MI, unsigned OpNo,229                        const MCSubtargetInfo &STI, raw_ostream &O);230  void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,231                 raw_ostream &O);232  void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,233               raw_ostream &O);234  void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,235                   raw_ostream &O);236  void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,237                    raw_ostream &O);238  void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,239                    raw_ostream &O);240  void printSWaitCnt(const MCInst *MI, unsigned OpNo,241                     const MCSubtargetInfo &STI, raw_ostream &O);242  void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,243                   raw_ostream &O);244  void printSDelayALU(const MCInst *MI, unsigned OpNo,245                      const MCSubtargetInfo &STI, raw_ostream &O);246  void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,247                  raw_ostream &O);248  void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,249                   raw_ostream &O);250};251 252} // End namespace llvm253 254#endif255