LLVM 23.0.0git
M68kInstPrinter.h
Go to the documentation of this file.
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-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file contains declarations for an M68k MCInst printer.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_M68K_INSTPRINTER_M68KINSTPRINTER_H
15#define LLVM_LIB_TARGET_M68K_INSTPRINTER_M68KINSTPRINTER_H
16
19
20namespace llvm {
21
22class TargetMachine;
23
25 public M68kMemOperandPrinter<M68kInstPrinter, MCInst> {
27
28public:
32
33 // Autogenerated by tblgen.
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
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-A7
52 void printMoveMask(const MCInst *MI, unsigned opNum, raw_ostream &O);
53 /// Print register mask for MOVEM instruction in order A7-A0,D7-D0
54 void printMoveMaskR(const MCInst *MI, unsigned opNum, raw_ostream &O);
55 void printDisp(const MCInst *MI, unsigned opNum, raw_ostream &O);
56 void printScale(const MCInst *MI, unsigned opNum, raw_ostream &O);
57 void printAbsMem(const MCInst *MI, unsigned opNum, raw_ostream &O);
58
59 //===----------------------------------------------------------------------===//
60 // Specializations
61 //===----------------------------------------------------------------------===//
62 //
63 void printPCRelImm(const MCInst *MI, uint64_t Address, unsigned opNum,
64 raw_ostream &O) {
65 printAbsMem(MI, opNum, O);
66 }
67
68 void printARI8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
69 printARIMem(MI, opNum, O);
70 }
71 void printARI16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
72 printARIMem(MI, opNum, O);
73 }
74 void printARI32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
75 printARIMem(MI, opNum, O);
76 }
77
78 void printARIPI8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
79 printARIPIMem(MI, opNum, O);
80 }
81 void printARIPI16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
82 printARIPIMem(MI, opNum, O);
83 }
84 void printARIPI32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
85 printARIPIMem(MI, opNum, O);
86 }
87
88 void printARIPD8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
89 printARIPDMem(MI, opNum, O);
90 }
91 void printARIPD16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
92 printARIPDMem(MI, opNum, O);
93 }
94 void printARIPD32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
95 printARIPDMem(MI, opNum, O);
96 }
97
98 void printARID8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
99 printARIDMem(MI, opNum, O);
100 }
101 void printARID16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
102 printARIDMem(MI, opNum, O);
103 }
104 void printARID32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
105 printARIDMem(MI, opNum, O);
106 }
107
108 void printARII8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
109 printARIIMem(MI, opNum, O);
110 }
111 void printARII16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
112 printARIIMem(MI, opNum, O);
113 }
114 void printARII32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
115 printARIIMem(MI, opNum, O);
116 }
117
118 void printAS8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
119 printAbsMem(MI, opNum, O);
120 }
121 void printAS16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
122 printAbsMem(MI, opNum, O);
123 }
124 void printAS32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
125 printAbsMem(MI, opNum, O);
126 }
127
128 void printAL8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
129 printAbsMem(MI, opNum, O);
130 }
131 void printAL16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
132 printAbsMem(MI, opNum, O);
133 }
134 void printAL32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
135 printAbsMem(MI, opNum, O);
136 }
137
138 void printPCD8Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
139 raw_ostream &O) {
140 printPCDMem(MI, Address, opNum, O);
141 }
142 void printPCD16Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
143 raw_ostream &O) {
144 printPCDMem(MI, Address, opNum, O);
145 }
146 void printPCD32Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
147 raw_ostream &O) {
148 printPCDMem(MI, Address, opNum, O);
149 }
150
151 void printPCI8Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
152 raw_ostream &O) {
153 printPCIMem(MI, Address, opNum, O);
154 }
155 void printPCI16Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
156 raw_ostream &O) {
157 printPCIMem(MI, Address, opNum, O);
158 }
159 void printPCI32Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
160 raw_ostream &O) {
161 printPCIMem(MI, Address, opNum, O);
162 }
163
164 void printPCIBD16Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
165 raw_ostream &O) {
166 printPCIBDMem<16>(MI, Address, opNum, O);
167 }
168 void printPCIBD32Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
169 raw_ostream &O) {
170 printPCIBDMem<32>(MI, Address, opNum, O);
171 }
172};
173} // end namespace llvm
174
175#endif // LLVM_LIB_TARGET_M68K_INSTPRINTER_M68KINSTPRINTER_H
IRTranslator LLVM IR MI
This file contains memory operand printing logics shared between AsmPrinter.
Register Reg
MachineInstr unsigned OpIdx
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
M68kInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS)
void printRegName(raw_ostream &OS, MCRegister Reg) override
Print the assembler register name.
std::pair< const char *, uint64_t > getMnemonic(const MCInst &MI) const override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, unsigned PrintMethodIdx, raw_ostream &O)
static const char * getRegisterName(MCRegister Reg)
friend class M68kMemOperandPrinter
void printARIDMem(const MCInst *MI, unsigned OpNum, raw_ostream &O)
void printPCDMem(const MCInst *MI, uint64_t Address, unsigned OpNum, raw_ostream &O)
void printPCIMem(const MCInst *MI, uint64_t Address, unsigned OpNum, raw_ostream &O)
void printARIPDMem(const MCInst *MI, unsigned OpNum, raw_ostream &O)
void printARIPIMem(const MCInst *MI, unsigned OpNum, raw_ostream &O)
void printARIIMem(const MCInst *MI, unsigned OpNum, raw_ostream &O)
void printARIMem(const MCInst *MI, unsigned OpNum, raw_ostream &O)
void printPCIBDMem(const MCInst *MI, uint64_t Address, unsigned OpNum, raw_ostream &O)
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:66
const MCInstrInfo & MII
const MCRegisterInfo & MRI
const MCAsmInfo & MAI
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Interface to description of machine instruction set.
Definition MCInstrInfo.h:27
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:41
Generic base class for all target subtargets.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Primary interface to the complete machine description for the target machine.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.