104eeddc0SDimitry Andric //===-- M68kInstPrinter.h - Convert M68k MCInst to asm ----------*- C++ -*-===// 2fe6060f1SDimitry Andric // 3fe6060f1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4fe6060f1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5fe6060f1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6fe6060f1SDimitry Andric // 7fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 8fe6060f1SDimitry Andric /// 9fe6060f1SDimitry Andric /// \file 10fe6060f1SDimitry Andric /// This file contains declarations for an M68k MCInst printer. 11fe6060f1SDimitry Andric /// 12fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 13fe6060f1SDimitry Andric 14fe6060f1SDimitry Andric #ifndef LLVM_LIB_TARGET_M68K_INSTPRINTER_M68KINSTPRINTER_H 15fe6060f1SDimitry Andric #define LLVM_LIB_TARGET_M68K_INSTPRINTER_M68KINSTPRINTER_H 16fe6060f1SDimitry Andric 17*06c3fb27SDimitry Andric #include "M68kMemOperandPrinter.h" 18fe6060f1SDimitry Andric #include "llvm/MC/MCInstPrinter.h" 19fe6060f1SDimitry Andric 20fe6060f1SDimitry Andric namespace llvm { 21fe6060f1SDimitry Andric 22fe6060f1SDimitry Andric class TargetMachine; 23fe6060f1SDimitry Andric 24*06c3fb27SDimitry Andric class M68kInstPrinter : public MCInstPrinter, 25*06c3fb27SDimitry Andric public M68kMemOperandPrinter<M68kInstPrinter, MCInst> { 26*06c3fb27SDimitry Andric friend class M68kMemOperandPrinter; 27*06c3fb27SDimitry Andric 28fe6060f1SDimitry Andric public: M68kInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)29fe6060f1SDimitry Andric M68kInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 30fe6060f1SDimitry Andric const MCRegisterInfo &MRI) 31fe6060f1SDimitry Andric : MCInstPrinter(MAI, MII, MRI) {} 32fe6060f1SDimitry Andric 33fe6060f1SDimitry Andric // Autogenerated by tblgen. 34fe6060f1SDimitry Andric void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); 35bdd1243dSDimitry Andric static const char *getRegisterName(MCRegister Reg); 36fe6060f1SDimitry Andric 37bdd1243dSDimitry Andric void printRegName(raw_ostream &OS, MCRegister Reg) const override; 38fe6060f1SDimitry Andric void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, 39fe6060f1SDimitry Andric const MCSubtargetInfo &STI, raw_ostream &O) override; 40fe6060f1SDimitry Andric 41fe6060f1SDimitry Andric bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS); 42fe6060f1SDimitry Andric void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, 43fe6060f1SDimitry Andric unsigned PrintMethodIdx, raw_ostream &O); 44fe6060f1SDimitry Andric 45fe6060f1SDimitry Andric std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override; 46fe6060f1SDimitry Andric 47fe6060f1SDimitry Andric private: 48fe6060f1SDimitry Andric void printOperand(const MCInst *MI, unsigned opNum, raw_ostream &O); 49fe6060f1SDimitry Andric void printImmediate(const MCInst *MI, unsigned opNum, raw_ostream &O); 50fe6060f1SDimitry Andric /// Print register mask for MOVEM instruction in order D0-D7,A0-A7 51fe6060f1SDimitry Andric void printMoveMask(const MCInst *MI, unsigned opNum, raw_ostream &O); 52fe6060f1SDimitry Andric /// Print register mask for MOVEM instruction in order A7-A0,D7-D0 53fe6060f1SDimitry Andric void printMoveMaskR(const MCInst *MI, unsigned opNum, raw_ostream &O); 54fe6060f1SDimitry Andric void printDisp(const MCInst *MI, unsigned opNum, raw_ostream &O); 55fe6060f1SDimitry Andric void printAbsMem(const MCInst *MI, unsigned opNum, raw_ostream &O); 56fe6060f1SDimitry Andric 57fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 58fe6060f1SDimitry Andric // Specializations 59fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 60fe6060f1SDimitry Andric // printPCRelImm(const MCInst * MI,uint64_t Address,unsigned opNum,raw_ostream & O)61fe6060f1SDimitry Andric void printPCRelImm(const MCInst *MI, uint64_t Address, unsigned opNum, 62fe6060f1SDimitry Andric raw_ostream &O) { 63fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 64fe6060f1SDimitry Andric } 65fe6060f1SDimitry Andric printARI8Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)66fe6060f1SDimitry Andric void printARI8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 67fe6060f1SDimitry Andric printARIMem(MI, opNum, O); 68fe6060f1SDimitry Andric } printARI16Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)69fe6060f1SDimitry Andric void printARI16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 70fe6060f1SDimitry Andric printARIMem(MI, opNum, O); 71fe6060f1SDimitry Andric } printARI32Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)72fe6060f1SDimitry Andric void printARI32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 73fe6060f1SDimitry Andric printARIMem(MI, opNum, O); 74fe6060f1SDimitry Andric } 75fe6060f1SDimitry Andric printARIPI8Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)76fe6060f1SDimitry Andric void printARIPI8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 77fe6060f1SDimitry Andric printARIPIMem(MI, opNum, O); 78fe6060f1SDimitry Andric } printARIPI16Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)79fe6060f1SDimitry Andric void printARIPI16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 80fe6060f1SDimitry Andric printARIPIMem(MI, opNum, O); 81fe6060f1SDimitry Andric } printARIPI32Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)82fe6060f1SDimitry Andric void printARIPI32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 83fe6060f1SDimitry Andric printARIPIMem(MI, opNum, O); 84fe6060f1SDimitry Andric } 85fe6060f1SDimitry Andric printARIPD8Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)86fe6060f1SDimitry Andric void printARIPD8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 87fe6060f1SDimitry Andric printARIPDMem(MI, opNum, O); 88fe6060f1SDimitry Andric } printARIPD16Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)89fe6060f1SDimitry Andric void printARIPD16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 90fe6060f1SDimitry Andric printARIPDMem(MI, opNum, O); 91fe6060f1SDimitry Andric } printARIPD32Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)92fe6060f1SDimitry Andric void printARIPD32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 93fe6060f1SDimitry Andric printARIPDMem(MI, opNum, O); 94fe6060f1SDimitry Andric } 95fe6060f1SDimitry Andric printARID8Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)96fe6060f1SDimitry Andric void printARID8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 97fe6060f1SDimitry Andric printARIDMem(MI, opNum, O); 98fe6060f1SDimitry Andric } printARID16Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)99fe6060f1SDimitry Andric void printARID16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 100fe6060f1SDimitry Andric printARIDMem(MI, opNum, O); 101fe6060f1SDimitry Andric } printARID32Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)102fe6060f1SDimitry Andric void printARID32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 103fe6060f1SDimitry Andric printARIDMem(MI, opNum, O); 104fe6060f1SDimitry Andric } 105fe6060f1SDimitry Andric printARII8Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)106fe6060f1SDimitry Andric void printARII8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 107fe6060f1SDimitry Andric printARIIMem(MI, opNum, O); 108fe6060f1SDimitry Andric } printARII16Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)109fe6060f1SDimitry Andric void printARII16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 110fe6060f1SDimitry Andric printARIIMem(MI, opNum, O); 111fe6060f1SDimitry Andric } printARII32Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)112fe6060f1SDimitry Andric void printARII32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 113fe6060f1SDimitry Andric printARIIMem(MI, opNum, O); 114fe6060f1SDimitry Andric } 115fe6060f1SDimitry Andric printAS8Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)116fe6060f1SDimitry Andric void printAS8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 117fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 118fe6060f1SDimitry Andric } printAS16Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)119fe6060f1SDimitry Andric void printAS16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 120fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 121fe6060f1SDimitry Andric } printAS32Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)122fe6060f1SDimitry Andric void printAS32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 123fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 124fe6060f1SDimitry Andric } 125fe6060f1SDimitry Andric printAL8Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)126fe6060f1SDimitry Andric void printAL8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 127fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 128fe6060f1SDimitry Andric } printAL16Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)129fe6060f1SDimitry Andric void printAL16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 130fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 131fe6060f1SDimitry Andric } printAL32Mem(const MCInst * MI,unsigned opNum,raw_ostream & O)132fe6060f1SDimitry Andric void printAL32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 133fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 134fe6060f1SDimitry Andric } 135fe6060f1SDimitry Andric printPCD8Mem(const MCInst * MI,uint64_t Address,unsigned opNum,raw_ostream & O)136fe6060f1SDimitry Andric void printPCD8Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 137fe6060f1SDimitry Andric raw_ostream &O) { 138fe6060f1SDimitry Andric printPCDMem(MI, Address, opNum, O); 139fe6060f1SDimitry Andric } printPCD16Mem(const MCInst * MI,uint64_t Address,unsigned opNum,raw_ostream & O)140fe6060f1SDimitry Andric void printPCD16Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 141fe6060f1SDimitry Andric raw_ostream &O) { 142fe6060f1SDimitry Andric printPCDMem(MI, Address, opNum, O); 143fe6060f1SDimitry Andric } printPCD32Mem(const MCInst * MI,uint64_t Address,unsigned opNum,raw_ostream & O)144fe6060f1SDimitry Andric void printPCD32Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 145fe6060f1SDimitry Andric raw_ostream &O) { 146fe6060f1SDimitry Andric printPCDMem(MI, Address, opNum, O); 147fe6060f1SDimitry Andric } 148fe6060f1SDimitry Andric printPCI8Mem(const MCInst * MI,uint64_t Address,unsigned opNum,raw_ostream & O)149fe6060f1SDimitry Andric void printPCI8Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 150fe6060f1SDimitry Andric raw_ostream &O) { 151fe6060f1SDimitry Andric printPCIMem(MI, Address, opNum, O); 152fe6060f1SDimitry Andric } printPCI16Mem(const MCInst * MI,uint64_t Address,unsigned opNum,raw_ostream & O)153fe6060f1SDimitry Andric void printPCI16Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 154fe6060f1SDimitry Andric raw_ostream &O) { 155fe6060f1SDimitry Andric printPCIMem(MI, Address, opNum, O); 156fe6060f1SDimitry Andric } printPCI32Mem(const MCInst * MI,uint64_t Address,unsigned opNum,raw_ostream & O)157fe6060f1SDimitry Andric void printPCI32Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 158fe6060f1SDimitry Andric raw_ostream &O) { 159fe6060f1SDimitry Andric printPCIMem(MI, Address, opNum, O); 160fe6060f1SDimitry Andric } 161fe6060f1SDimitry Andric }; 162fe6060f1SDimitry Andric } // end namespace llvm 163fe6060f1SDimitry Andric 16404eeddc0SDimitry Andric #endif // LLVM_LIB_TARGET_M68K_INSTPRINTER_M68KINSTPRINTER_H 165