LLVM  14.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 
17 #include "llvm/MC/MCInstPrinter.h"
18 
19 namespace llvm {
20 
21 class TargetMachine;
22 
24 public:
26  const MCRegisterInfo &MRI)
27  : MCInstPrinter(MAI, MII, MRI) {}
28 
29  // Autogenerated by tblgen.
30  void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
31  static const char *getRegisterName(unsigned RegNo);
32 
33  void printRegName(raw_ostream &OS, unsigned RegNo) const override;
34  void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
35  const MCSubtargetInfo &STI, raw_ostream &O) override;
36 
37  bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
38  void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
39  unsigned PrintMethodIdx, raw_ostream &O);
40 
41  std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
42 
43 private:
44  void printOperand(const MCInst *MI, unsigned opNum, raw_ostream &O);
45  void printImmediate(const MCInst *MI, unsigned opNum, raw_ostream &O);
46  /// Print register mask for MOVEM instruction in order D0-D7,A0-A7
47  void printMoveMask(const MCInst *MI, unsigned opNum, raw_ostream &O);
48  /// Print register mask for MOVEM instruction in order A7-A0,D7-D0
49  void printMoveMaskR(const MCInst *MI, unsigned opNum, raw_ostream &O);
50  void printDisp(const MCInst *MI, unsigned opNum, raw_ostream &O);
51  void printARIMem(const MCInst *MI, unsigned opNum, raw_ostream &O);
52  void printARIPIMem(const MCInst *MI, unsigned opNum, raw_ostream &O);
53  void printARIPDMem(const MCInst *MI, unsigned opNum, raw_ostream &O);
54  void printARIDMem(const MCInst *MI, unsigned opNum, raw_ostream &O);
55  void printARIIMem(const MCInst *MI, unsigned opNum, raw_ostream &O);
56  void printAbsMem(const MCInst *MI, unsigned opNum, raw_ostream &O);
57  void printPCDMem(const MCInst *MI, uint64_t Address, unsigned opNum,
58  raw_ostream &O);
59  void printPCIMem(const MCInst *MI, uint64_t Address, unsigned opNum,
60  raw_ostream &O);
61 
62  //===----------------------------------------------------------------------===//
63  // Specializations
64  //===----------------------------------------------------------------------===//
65  //
66  void printPCRelImm(const MCInst *MI, uint64_t Address, unsigned opNum,
67  raw_ostream &O) {
68  printAbsMem(MI, opNum, O);
69  }
70 
71  void printARI8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
72  printARIMem(MI, opNum, O);
73  }
74  void printARI16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
75  printARIMem(MI, opNum, O);
76  }
77  void printARI32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
78  printARIMem(MI, opNum, O);
79  }
80 
81  void printARIPI8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
82  printARIPIMem(MI, opNum, O);
83  }
84  void printARIPI16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
85  printARIPIMem(MI, opNum, O);
86  }
87  void printARIPI32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
88  printARIPIMem(MI, opNum, O);
89  }
90 
91  void printARIPD8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
92  printARIPDMem(MI, opNum, O);
93  }
94  void printARIPD16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
95  printARIPDMem(MI, opNum, O);
96  }
97  void printARIPD32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
98  printARIPDMem(MI, opNum, O);
99  }
100 
101  void printARID8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
102  printARIDMem(MI, opNum, O);
103  }
104  void printARID16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
105  printARIDMem(MI, opNum, O);
106  }
107  void printARID32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
108  printARIDMem(MI, opNum, O);
109  }
110 
111  void printARII8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
112  printARIIMem(MI, opNum, O);
113  }
114  void printARII16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
115  printARIIMem(MI, opNum, O);
116  }
117  void printARII32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
118  printARIIMem(MI, opNum, O);
119  }
120 
121  void printAS8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
122  printAbsMem(MI, opNum, O);
123  }
124  void printAS16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
125  printAbsMem(MI, opNum, O);
126  }
127  void printAS32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
128  printAbsMem(MI, opNum, O);
129  }
130 
131  void printAL8Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
132  printAbsMem(MI, opNum, O);
133  }
134  void printAL16Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
135  printAbsMem(MI, opNum, O);
136  }
137  void printAL32Mem(const MCInst *MI, unsigned opNum, raw_ostream &O) {
138  printAbsMem(MI, opNum, O);
139  }
140 
141  void printPCD8Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
142  raw_ostream &O) {
143  printPCDMem(MI, Address, opNum, O);
144  }
145  void printPCD16Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
146  raw_ostream &O) {
147  printPCDMem(MI, Address, opNum, O);
148  }
149  void printPCD32Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
150  raw_ostream &O) {
151  printPCDMem(MI, Address, opNum, O);
152  }
153 
154  void printPCI8Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
155  raw_ostream &O) {
156  printPCIMem(MI, Address, opNum, O);
157  }
158  void printPCI16Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
159  raw_ostream &O) {
160  printPCIMem(MI, Address, opNum, O);
161  }
162  void printPCI32Mem(const MCInst *MI, uint64_t Address, unsigned opNum,
163  raw_ostream &O) {
164  printPCIMem(MI, Address, opNum, O);
165  }
166 };
167 } // end namespace llvm
168 
169 #endif
llvm::MCInstPrinter::MII
const MCInstrInfo & MII
Definition: MCInstPrinter.h:50
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:105
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::M68kInstPrinter::M68kInstPrinter
M68kInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: M68kInstPrinter.h:25
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::M68kInstPrinter::printInst
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.
Definition: M68kInstPrinter.cpp:48
llvm::MCInstPrinter::MRI
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:51
llvm::M68kInstPrinter::printCustomAliasOperand
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, unsigned PrintMethodIdx, raw_ostream &O)
llvm::M68kInstPrinter::printRegName
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
Definition: M68kInstPrinter.cpp:44
llvm::M68kInstPrinter::getRegisterName
static const char * getRegisterName(unsigned RegNo)
llvm::M68kInstPrinter::printAliasInstr
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS)
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
MCInstPrinter.h
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:197
uint64_t
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
llvm::M68kInstPrinter
Definition: M68kInstPrinter.h:23
llvm::M68kInstPrinter::printInstruction
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
llvm::M68kInstPrinter::getMnemonic
std::pair< const char *, uint64_t > getMnemonic(const MCInst *MI) override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
llvm::MCInstPrinter::MAI
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:49
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75