1*04eeddc0SDimitry 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 17fe6060f1SDimitry Andric #include "llvm/MC/MCInstPrinter.h" 18fe6060f1SDimitry Andric 19fe6060f1SDimitry Andric namespace llvm { 20fe6060f1SDimitry Andric 21fe6060f1SDimitry Andric class TargetMachine; 22fe6060f1SDimitry Andric 23fe6060f1SDimitry Andric class M68kInstPrinter : public MCInstPrinter { 24fe6060f1SDimitry Andric public: 25fe6060f1SDimitry Andric M68kInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 26fe6060f1SDimitry Andric const MCRegisterInfo &MRI) 27fe6060f1SDimitry Andric : MCInstPrinter(MAI, MII, MRI) {} 28fe6060f1SDimitry Andric 29fe6060f1SDimitry Andric // Autogenerated by tblgen. 30fe6060f1SDimitry Andric void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); 31fe6060f1SDimitry Andric static const char *getRegisterName(unsigned RegNo); 32fe6060f1SDimitry Andric 33fe6060f1SDimitry Andric void printRegName(raw_ostream &OS, unsigned RegNo) const override; 34fe6060f1SDimitry Andric void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, 35fe6060f1SDimitry Andric const MCSubtargetInfo &STI, raw_ostream &O) override; 36fe6060f1SDimitry Andric 37fe6060f1SDimitry Andric bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS); 38fe6060f1SDimitry Andric void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, 39fe6060f1SDimitry Andric unsigned PrintMethodIdx, raw_ostream &O); 40fe6060f1SDimitry Andric 41fe6060f1SDimitry Andric std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override; 42fe6060f1SDimitry Andric 43fe6060f1SDimitry Andric private: 44fe6060f1SDimitry Andric void printOperand(const MCInst *MI, unsigned opNum, raw_ostream &O); 45fe6060f1SDimitry Andric void printImmediate(const MCInst *MI, unsigned opNum, raw_ostream &O); 46fe6060f1SDimitry Andric /// Print register mask for MOVEM instruction in order D0-D7,A0-A7 47fe6060f1SDimitry Andric void printMoveMask(const MCInst *MI, unsigned opNum, raw_ostream &O); 48fe6060f1SDimitry Andric /// Print register mask for MOVEM instruction in order A7-A0,D7-D0 49fe6060f1SDimitry Andric void printMoveMaskR(const MCInst *MI, unsigned opNum, raw_ostream &O); 50fe6060f1SDimitry Andric void printDisp(const MCInst *MI, unsigned opNum, raw_ostream &O); 51fe6060f1SDimitry Andric void printARIMem(const MCInst *MI, unsigned opNum, raw_ostream &O); 52fe6060f1SDimitry Andric void printARIPIMem(const MCInst *MI, unsigned opNum, raw_ostream &O); 53fe6060f1SDimitry Andric void printARIPDMem(const MCInst *MI, unsigned opNum, raw_ostream &O); 54fe6060f1SDimitry Andric void printARIDMem(const MCInst *MI, unsigned opNum, raw_ostream &O); 55fe6060f1SDimitry Andric void printARIIMem(const MCInst *MI, unsigned opNum, raw_ostream &O); 56fe6060f1SDimitry Andric void printAbsMem(const MCInst *MI, unsigned opNum, raw_ostream &O); 57fe6060f1SDimitry Andric void printPCDMem(const MCInst *MI, uint64_t Address, unsigned opNum, 58fe6060f1SDimitry Andric raw_ostream &O); 59fe6060f1SDimitry Andric void printPCIMem(const MCInst *MI, uint64_t Address, unsigned opNum, 60fe6060f1SDimitry Andric raw_ostream &O); 61fe6060f1SDimitry Andric 62fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 63fe6060f1SDimitry Andric // Specializations 64fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 65fe6060f1SDimitry Andric // 66fe6060f1SDimitry Andric void printPCRelImm(const MCInst *MI, uint64_t Address, unsigned opNum, 67fe6060f1SDimitry Andric raw_ostream &O) { 68fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 69fe6060f1SDimitry Andric } 70fe6060f1SDimitry Andric 71fe6060f1SDimitry Andric void printARI8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 72fe6060f1SDimitry Andric printARIMem(MI, opNum, O); 73fe6060f1SDimitry Andric } 74fe6060f1SDimitry Andric void printARI16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 75fe6060f1SDimitry Andric printARIMem(MI, opNum, O); 76fe6060f1SDimitry Andric } 77fe6060f1SDimitry Andric void printARI32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 78fe6060f1SDimitry Andric printARIMem(MI, opNum, O); 79fe6060f1SDimitry Andric } 80fe6060f1SDimitry Andric 81fe6060f1SDimitry Andric void printARIPI8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 82fe6060f1SDimitry Andric printARIPIMem(MI, opNum, O); 83fe6060f1SDimitry Andric } 84fe6060f1SDimitry Andric void printARIPI16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 85fe6060f1SDimitry Andric printARIPIMem(MI, opNum, O); 86fe6060f1SDimitry Andric } 87fe6060f1SDimitry Andric void printARIPI32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 88fe6060f1SDimitry Andric printARIPIMem(MI, opNum, O); 89fe6060f1SDimitry Andric } 90fe6060f1SDimitry Andric 91fe6060f1SDimitry Andric void printARIPD8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 92fe6060f1SDimitry Andric printARIPDMem(MI, opNum, O); 93fe6060f1SDimitry Andric } 94fe6060f1SDimitry Andric void printARIPD16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 95fe6060f1SDimitry Andric printARIPDMem(MI, opNum, O); 96fe6060f1SDimitry Andric } 97fe6060f1SDimitry Andric void printARIPD32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 98fe6060f1SDimitry Andric printARIPDMem(MI, opNum, O); 99fe6060f1SDimitry Andric } 100fe6060f1SDimitry Andric 101fe6060f1SDimitry Andric void printARID8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 102fe6060f1SDimitry Andric printARIDMem(MI, opNum, O); 103fe6060f1SDimitry Andric } 104fe6060f1SDimitry Andric void printARID16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 105fe6060f1SDimitry Andric printARIDMem(MI, opNum, O); 106fe6060f1SDimitry Andric } 107fe6060f1SDimitry Andric void printARID32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 108fe6060f1SDimitry Andric printARIDMem(MI, opNum, O); 109fe6060f1SDimitry Andric } 110fe6060f1SDimitry Andric 111fe6060f1SDimitry Andric void printARII8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 112fe6060f1SDimitry Andric printARIIMem(MI, opNum, O); 113fe6060f1SDimitry Andric } 114fe6060f1SDimitry Andric void printARII16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 115fe6060f1SDimitry Andric printARIIMem(MI, opNum, O); 116fe6060f1SDimitry Andric } 117fe6060f1SDimitry Andric void printARII32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 118fe6060f1SDimitry Andric printARIIMem(MI, opNum, O); 119fe6060f1SDimitry Andric } 120fe6060f1SDimitry Andric 121fe6060f1SDimitry Andric void printAS8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 122fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 123fe6060f1SDimitry Andric } 124fe6060f1SDimitry Andric void printAS16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 125fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 126fe6060f1SDimitry Andric } 127fe6060f1SDimitry Andric void printAS32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 128fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 129fe6060f1SDimitry Andric } 130fe6060f1SDimitry Andric 131fe6060f1SDimitry Andric void printAL8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 132fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 133fe6060f1SDimitry Andric } 134fe6060f1SDimitry Andric void printAL16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 135fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 136fe6060f1SDimitry Andric } 137fe6060f1SDimitry Andric void printAL32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) { 138fe6060f1SDimitry Andric printAbsMem(MI, opNum, O); 139fe6060f1SDimitry Andric } 140fe6060f1SDimitry Andric 141fe6060f1SDimitry Andric void printPCD8Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 142fe6060f1SDimitry Andric raw_ostream &O) { 143fe6060f1SDimitry Andric printPCDMem(MI, Address, opNum, O); 144fe6060f1SDimitry Andric } 145fe6060f1SDimitry Andric void printPCD16Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 146fe6060f1SDimitry Andric raw_ostream &O) { 147fe6060f1SDimitry Andric printPCDMem(MI, Address, opNum, O); 148fe6060f1SDimitry Andric } 149fe6060f1SDimitry Andric void printPCD32Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 150fe6060f1SDimitry Andric raw_ostream &O) { 151fe6060f1SDimitry Andric printPCDMem(MI, Address, opNum, O); 152fe6060f1SDimitry Andric } 153fe6060f1SDimitry Andric 154fe6060f1SDimitry Andric void printPCI8Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 155fe6060f1SDimitry Andric raw_ostream &O) { 156fe6060f1SDimitry Andric printPCIMem(MI, Address, opNum, O); 157fe6060f1SDimitry Andric } 158fe6060f1SDimitry Andric void printPCI16Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 159fe6060f1SDimitry Andric raw_ostream &O) { 160fe6060f1SDimitry Andric printPCIMem(MI, Address, opNum, O); 161fe6060f1SDimitry Andric } 162fe6060f1SDimitry Andric void printPCI32Mem(const MCInst *MI, uint64_t Address, unsigned opNum, 163fe6060f1SDimitry Andric raw_ostream &O) { 164fe6060f1SDimitry Andric printPCIMem(MI, Address, opNum, O); 165fe6060f1SDimitry Andric } 166fe6060f1SDimitry Andric }; 167fe6060f1SDimitry Andric } // end namespace llvm 168fe6060f1SDimitry Andric 169*04eeddc0SDimitry Andric #endif // LLVM_LIB_TARGET_M68K_INSTPRINTER_M68KINSTPRINTER_H 170