87 lines · c
1//== SystemZInstPrinterCommon.h - Common SystemZ InstPrinter funcs *- 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// This class prints a SystemZ MCInst to a .s file.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTERCOMMON_H14#define LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTERCOMMON_H15 16#include "SystemZMCAsmInfo.h"17#include "llvm/MC/MCInstPrinter.h"18#include "llvm/MC/MCRegister.h"19#include <cstdint>20 21namespace llvm {22 23class MCOperand;24 25class SystemZInstPrinterCommon : public MCInstPrinter {26public:27 SystemZInstPrinterCommon(const MCAsmInfo &MAI, const MCInstrInfo &MII,28 const MCRegisterInfo &MRI)29 : MCInstPrinter(MAI, MII, MRI) {}30 31 // Print an address with the given base, displacement and index.32 void printAddress(const MCAsmInfo *MAI, MCRegister Base,33 const MCOperand &DispMO, MCRegister Index, raw_ostream &O);34 35 // Print the given operand.36 void printOperand(const MCOperand &MO, const MCAsmInfo *MAI, raw_ostream &O);37 38 virtual void printFormattedRegName(const MCAsmInfo *MAI, MCRegister Reg,39 raw_ostream &O) {}40 41 // Override MCInstPrinter.42 void printRegName(raw_ostream &O, MCRegister Reg) override;43 44protected:45 template <unsigned N>46 void printUImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);47 template <unsigned N>48 void printSImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);49 50 // Print various types of operand.51 void printOperand(const MCInst *MI, int OpNum, raw_ostream &O);52 void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,53 raw_ostream &O) {54 printOperand(MI, OpNum, O);55 }56 void printBDAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);57 void printBDXAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);58 void printBDLAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);59 void printBDRAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);60 void printBDVAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);61 void printLXAAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);62 void printU1ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);63 void printU2ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);64 void printU3ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);65 void printU4ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);66 void printS8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);67 void printU8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);68 void printU12ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);69 void printS16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);70 void printU16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);71 void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);72 void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);73 void printU48ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);74 void printPCRelOperand(const MCInst *MI, uint64_t Address, int OpNum,75 raw_ostream &O);76 void printPCRelTLSOperand(const MCInst *MI, uint64_t Address, int OpNum,77 raw_ostream &O);78 79 // Print the mnemonic for a condition-code mask ("ne", "lh", etc.)80 // This forms part of the instruction name rather than the operand list.81 void printCond4Operand(const MCInst *MI, int OpNum, raw_ostream &O);82};83 84} // end namespace llvm85 86#endif // LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTERCOMMON_H87