LLVM 19.0.0git
SystemZInstPrinter.h
Go to the documentation of this file.
1//==- SystemZInstPrinter.h - Convert SystemZ MCInst to assembly --*- 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_SYSTEMZINSTPRINTER_H
14#define LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTER_H
15
16#include "SystemZMCAsmInfo.h"
18#include <cstdint>
19
20namespace llvm {
21
22class MCOperand;
23
25public:
27 const MCRegisterInfo &MRI)
28 : MCInstPrinter(MAI, MII, MRI) {}
29
30 // Automatically generated by tblgen.
31 std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
33 static const char *getRegisterName(MCRegister Reg);
34
35 // Print an address with the given base, displacement and index.
37 const MCOperand &DispMO, MCRegister Index, raw_ostream &O);
38
39 // Print the given operand.
40 void printOperand(const MCOperand &MO, const MCAsmInfo *MAI, raw_ostream &O);
41
43 raw_ostream &O) const;
44
45 // Override MCInstPrinter.
46 void printRegName(raw_ostream &O, MCRegister Reg) const override;
47
48 void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
49 const MCSubtargetInfo &STI, raw_ostream &O) override;
50
51private:
52 template <unsigned N>
53 void printUImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
54 template <unsigned N>
55 void printSImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
56
57 // Print various types of operand.
58 void printOperand(const MCInst *MI, int OpNum, raw_ostream &O);
59 void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
60 raw_ostream &O) {
61 printOperand(MI, OpNum, O);
62 }
63 void printBDAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
64 void printBDXAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
65 void printBDLAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
66 void printBDRAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
67 void printBDVAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
68 void printU1ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
69 void printU2ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
70 void printU3ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
71 void printU4ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
72 void printS8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
73 void printU8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
74 void printU12ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
75 void printS16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
76 void printU16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
77 void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
78 void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
79 void printU48ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
80 void printPCRelOperand(const MCInst *MI, int OpNum, raw_ostream &O);
81 void printPCRelOperand(const MCInst *MI, uint64_t /*Address*/, int OpNum,
82 raw_ostream &O) {
83 printPCRelOperand(MI, OpNum, O);
84 }
85 void printPCRelTLSOperand(const MCInst *MI, uint64_t Address, int OpNum,
86 raw_ostream &O);
87
88 // Print the mnemonic for a condition-code mask ("ne", "lh", etc.)
89 // This forms part of the instruction name rather than the operand list.
90 void printCond4Operand(const MCInst *MI, int OpNum, raw_ostream &O);
91};
92
93} // end namespace llvm
94
95#endif // LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZINSTPRINTER_H
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:45
const MCInstrInfo & MII
Definition: MCInstPrinter.h:52
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:53
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:51
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:36
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
Generic base class for all target subtargets.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
void printRegName(raw_ostream &O, MCRegister Reg) const override
Print the assembler register name.
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...
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.
void printOperand(const MCOperand &MO, const MCAsmInfo *MAI, raw_ostream &O)
void printAddress(const MCAsmInfo *MAI, MCRegister Base, const MCOperand &DispMO, MCRegister Index, raw_ostream &O)
void printFormattedRegName(const MCAsmInfo *MAI, MCRegister Reg, raw_ostream &O) const
static const char * getRegisterName(MCRegister Reg)
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
SystemZInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
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