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