1*bdd1243dSDimitry Andric //===- XtensaInstPrinter.h - Convert Xtensa MCInst to asm syntax -*- C++ -*-==// 2*bdd1243dSDimitry Andric // 3*bdd1243dSDimitry Andric // The LLVM Compiler Infrastructure 4*bdd1243dSDimitry Andric // 5*bdd1243dSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 6*bdd1243dSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 7*bdd1243dSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 8*bdd1243dSDimitry Andric // 9*bdd1243dSDimitry Andric //===----------------------------------------------------------------------===// 10*bdd1243dSDimitry Andric // 11*bdd1243dSDimitry Andric // This class prints an Xtensa MCInst to a .s file. 12*bdd1243dSDimitry Andric // 13*bdd1243dSDimitry Andric //===----------------------------------------------------------------------===// 14*bdd1243dSDimitry Andric 15*bdd1243dSDimitry Andric #ifndef LLVM_LIB_TARGET_XTENSA_MCTARGETDESC_XTENSAINSTPRINTER_H 16*bdd1243dSDimitry Andric #define LLVM_LIB_TARGET_XTENSA_MCTARGETDESC_XTENSAINSTPRINTER_H 17*bdd1243dSDimitry Andric 18*bdd1243dSDimitry Andric #include "llvm/MC/MCInstPrinter.h" 19*bdd1243dSDimitry Andric #include "llvm/Support/Compiler.h" 20*bdd1243dSDimitry Andric 21*bdd1243dSDimitry Andric namespace llvm { 22*bdd1243dSDimitry Andric class MCOperand; 23*bdd1243dSDimitry Andric 24*bdd1243dSDimitry Andric class XtensaInstPrinter : public MCInstPrinter { 25*bdd1243dSDimitry Andric public: XtensaInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)26*bdd1243dSDimitry Andric XtensaInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 27*bdd1243dSDimitry Andric const MCRegisterInfo &MRI) 28*bdd1243dSDimitry Andric : MCInstPrinter(MAI, MII, MRI) {} 29*bdd1243dSDimitry Andric 30*bdd1243dSDimitry Andric // Automatically generated by tblgen. 31*bdd1243dSDimitry Andric std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override; 32*bdd1243dSDimitry Andric void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); 33*bdd1243dSDimitry Andric static const char *getRegisterName(MCRegister Reg); 34*bdd1243dSDimitry Andric 35*bdd1243dSDimitry Andric // Print the given operand. 36*bdd1243dSDimitry Andric static void printOperand(const MCOperand &MO, raw_ostream &O); 37*bdd1243dSDimitry Andric 38*bdd1243dSDimitry Andric // Override MCInstPrinter. 39*bdd1243dSDimitry Andric void printRegName(raw_ostream &O, MCRegister Reg) const override; 40*bdd1243dSDimitry Andric void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, 41*bdd1243dSDimitry Andric const MCSubtargetInfo &STI, raw_ostream &O) override; 42*bdd1243dSDimitry Andric 43*bdd1243dSDimitry Andric private: 44*bdd1243dSDimitry Andric // Print various types of operand. 45*bdd1243dSDimitry Andric void printOperand(const MCInst *MI, int OpNum, raw_ostream &O); 46*bdd1243dSDimitry Andric void printMemOperand(const MCInst *MI, int OpNUm, raw_ostream &O); 47*bdd1243dSDimitry Andric void printBranchTarget(const MCInst *MI, int OpNum, raw_ostream &O); 48*bdd1243dSDimitry Andric void printJumpTarget(const MCInst *MI, int OpNum, raw_ostream &O); 49*bdd1243dSDimitry Andric void printCallOperand(const MCInst *MI, int OpNum, raw_ostream &O); 50*bdd1243dSDimitry Andric void printL32RTarget(const MCInst *MI, int OpNum, raw_ostream &O); 51*bdd1243dSDimitry Andric 52*bdd1243dSDimitry Andric void printImm8_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 53*bdd1243dSDimitry Andric void printImm8_sh8_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 54*bdd1243dSDimitry Andric void printImm12_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 55*bdd1243dSDimitry Andric void printImm12m_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 56*bdd1243dSDimitry Andric void printUimm4_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 57*bdd1243dSDimitry Andric void printUimm5_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 58*bdd1243dSDimitry Andric void printShimm1_31_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 59*bdd1243dSDimitry Andric void printImm1_16_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 60*bdd1243dSDimitry Andric void printOffset8m8_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 61*bdd1243dSDimitry Andric void printOffset8m16_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 62*bdd1243dSDimitry Andric void printOffset8m32_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 63*bdd1243dSDimitry Andric void printOffset4m32_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 64*bdd1243dSDimitry Andric void printB4const_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 65*bdd1243dSDimitry Andric void printB4constu_AsmOperand(const MCInst *MI, int OpNum, raw_ostream &O); 66*bdd1243dSDimitry Andric }; 67*bdd1243dSDimitry Andric } // end namespace llvm 68*bdd1243dSDimitry Andric 69*bdd1243dSDimitry Andric #endif /* LLVM_LIB_TARGET_XTENSA_MCTARGETDESC_XTENSAINSTPRINTER_H */ 70