LLVM 20.0.0git
SystemZInstPrinterCommon.h
Go to the documentation of this file.
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-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This class prints a SystemZ MCInst to a .s file.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTERCOMMON_H
14#define LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTERCOMMON_H
15
16#include "SystemZMCAsmInfo.h"
18#include "llvm/MC/MCRegister.h"
19#include <cstdint>
20
21namespace llvm {
22
23class MCOperand;
24
26public:
28 const MCRegisterInfo &MRI)
29 : MCInstPrinter(MAI, MII, MRI) {}
30
31 // Print an address with the given base, displacement and index.
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
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 printU1ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
62 void printU2ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
63 void printU3ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
64 void printU4ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
65 void printS8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
66 void printU8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
67 void printU12ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
68 void printS16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
69 void printU16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
70 void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
71 void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
72 void printU48ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
73 void printPCRelOperand(const MCInst *MI, int OpNum, raw_ostream &O);
74 void printPCRelOperand(const MCInst *MI, uint64_t /*Address*/, int OpNum,
75 raw_ostream &O) {
76 printPCRelOperand(MI, OpNum, O);
77 }
78 void printPCRelTLSOperand(const MCInst *MI, uint64_t Address, int OpNum,
79 raw_ostream &O);
80
81 // Print the mnemonic for a condition-code mask ("ne", "lh", etc.)
82 // This forms part of the instruction name rather than the operand list.
83 void printCond4Operand(const MCInst *MI, int OpNum, raw_ostream &O);
84};
85
86} // end namespace llvm
87
88#endif // LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTERCOMMON_H
uint32_t Index
IRTranslator LLVM IR MI
unsigned Reg
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:46
const MCInstrInfo & MII
Definition: MCInstPrinter.h:53
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:54
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:52
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:185
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:37
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:33
void printUImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printU2ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printU3ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printBDXAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printBDVAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O)
SystemZInstPrinterCommon(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
void printU4ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printSImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printS8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printBDLAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printOperand(const MCOperand &MO, const MCAsmInfo *MAI, raw_ostream &O)
void printPCRelTLSOperand(const MCInst *MI, uint64_t Address, int OpNum, raw_ostream &O)
void printOperand(const MCInst *MI, uint64_t, unsigned OpNum, raw_ostream &O)
void printRegName(raw_ostream &O, MCRegister Reg) override
Print the assembler register name.
virtual void printFormattedRegName(const MCAsmInfo *MAI, MCRegister Reg, raw_ostream &O)
void printU12ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printBDAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printPCRelOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printU1ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printPCRelOperand(const MCInst *MI, uint64_t, int OpNum, raw_ostream &O)
void printU48ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printU8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printAddress(const MCAsmInfo *MAI, MCRegister Base, const MCOperand &DispMO, MCRegister Index, raw_ostream &O)
void printCond4Operand(const MCInst *MI, int OpNum, raw_ostream &O)
void printBDRAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printS16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O)
void printU16ImmOperand(const MCInst *MI, int 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