LLVM 20.0.0git
M68kMemOperandPrinter.h
Go to the documentation of this file.
1//===-- M68kMemOperandPrinter.h - Memory operands printing ------*- 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 memory operand printing logics shared between AsmPrinter
11// and MCInstPrinter.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_M68K_MEMOPERANDPRINTER_M68KINSTPRINTER_H
16#define LLVM_LIB_TARGET_M68K_MEMOPERANDPRINTER_M68KINSTPRINTER_H
17
18#include "M68kBaseInfo.h"
19
21
22namespace llvm {
23template <class Derived, typename InstTy> class M68kMemOperandPrinter {
24 Derived &impl() { return *static_cast<Derived *>(this); }
25
26protected:
27 void printARIMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {
28 O << '(';
29 impl().printOperand(MI, OpNum, O);
30 O << ')';
31 }
32
33 void printARIPIMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {
34 O << "(";
35 impl().printOperand(MI, OpNum, O);
36 O << ")+";
37 }
38
39 void printARIPDMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {
40 O << "-(";
41 impl().printOperand(MI, OpNum, O);
42 O << ")";
43 }
44
45 void printARIDMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {
46 O << '(';
47 impl().printDisp(MI, OpNum + M68k::MemDisp, O);
48 O << ',';
49 impl().printOperand(MI, OpNum + M68k::MemBase, O);
50 O << ')';
51 }
52
53 void printARIIMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {
54 O << '(';
55 impl().printDisp(MI, OpNum + M68k::MemDisp, O);
56 O << ',';
57 impl().printOperand(MI, OpNum + M68k::MemBase, O);
58 O << ',';
59 impl().printOperand(MI, OpNum + M68k::MemIndex, O);
60 O << ')';
61 }
62
63 void printPCDMem(const InstTy *MI, uint64_t Address, unsigned OpNum,
64 raw_ostream &O) {
65 O << '(';
66 impl().printDisp(MI, OpNum + M68k::PCRelDisp, O);
67 O << ",%pc)";
68 }
69
70 void printPCIMem(const InstTy *MI, uint64_t Address, unsigned OpNum,
71 raw_ostream &O) {
72 O << '(';
73 impl().printDisp(MI, OpNum + M68k::PCRelDisp, O);
74 O << ",%pc,";
75 impl().printOperand(MI, OpNum + M68k::PCRelIndex, O);
76 O << ')';
77 }
78};
79} // end namespace llvm
80#endif
IRTranslator LLVM IR MI
This file contains small standalone helper functions and enum definitions for the M68k target useful ...
void printARIDMem(const InstTy *MI, unsigned OpNum, raw_ostream &O)
void printPCDMem(const InstTy *MI, uint64_t Address, unsigned OpNum, raw_ostream &O)
void printPCIMem(const InstTy *MI, uint64_t Address, unsigned OpNum, raw_ostream &O)
void printARIPDMem(const InstTy *MI, unsigned OpNum, raw_ostream &O)
void printARIPIMem(const InstTy *MI, unsigned OpNum, raw_ostream &O)
void printARIIMem(const InstTy *MI, unsigned OpNum, raw_ostream &O)
void printARIMem(const InstTy *MI, unsigned OpNum, raw_ostream &O)
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18