Path: blob/main/contrib/llvm-project/llvm/lib/Target/M68k/MCTargetDesc/M68kMemOperandPrinter.h
35294 views
//===-- M68kMemOperandPrinter.h - Memory operands printing ------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file9/// This file contains memory operand printing logics shared between AsmPrinter10// and MCInstPrinter.11///12//===----------------------------------------------------------------------===//1314#ifndef LLVM_LIB_TARGET_M68K_MEMOPERANDPRINTER_M68KINSTPRINTER_H15#define LLVM_LIB_TARGET_M68K_MEMOPERANDPRINTER_M68KINSTPRINTER_H1617#include "M68kBaseInfo.h"1819#include "llvm/Support/raw_ostream.h"2021namespace llvm {22template <class Derived, typename InstTy> class M68kMemOperandPrinter {23Derived &impl() { return *static_cast<Derived *>(this); }2425protected:26void printARIMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {27O << '(';28impl().printOperand(MI, OpNum, O);29O << ')';30}3132void printARIPIMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {33O << "(";34impl().printOperand(MI, OpNum, O);35O << ")+";36}3738void printARIPDMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {39O << "-(";40impl().printOperand(MI, OpNum, O);41O << ")";42}4344void printARIDMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {45O << '(';46impl().printDisp(MI, OpNum + M68k::MemDisp, O);47O << ',';48impl().printOperand(MI, OpNum + M68k::MemBase, O);49O << ')';50}5152void printARIIMem(const InstTy *MI, unsigned OpNum, raw_ostream &O) {53O << '(';54impl().printDisp(MI, OpNum + M68k::MemDisp, O);55O << ',';56impl().printOperand(MI, OpNum + M68k::MemBase, O);57O << ',';58impl().printOperand(MI, OpNum + M68k::MemIndex, O);59O << ')';60}6162void printPCDMem(const InstTy *MI, uint64_t Address, unsigned OpNum,63raw_ostream &O) {64O << '(';65impl().printDisp(MI, OpNum + M68k::PCRelDisp, O);66O << ",%pc)";67}6869void printPCIMem(const InstTy *MI, uint64_t Address, unsigned OpNum,70raw_ostream &O) {71O << '(';72impl().printDisp(MI, OpNum + M68k::PCRelDisp, O);73O << ",%pc,";74impl().printOperand(MI, OpNum + M68k::PCRelIndex, O);75O << ')';76}77};78} // end namespace llvm79#endif808182