LLVM  11.0.0git
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 //===----------------------------------------------------------------------===//
16 #include "llvm/MC/MCInstPrinter.h"
17 #include <cstdint>
19 namespace llvm {
21 class MCOperand;
24 public:
26  const MCRegisterInfo &MRI)
27  : MCInstPrinter(MAI, MII, MRI) {}
29  // Automatically generated by tblgen.
30  void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
31  static const char *getRegisterName(unsigned RegNo);
33  // Print an address with the given base, displacement and index.
34  static void printAddress(unsigned Base, int64_t Disp, unsigned Index,
35  raw_ostream &O);
37  // Print the given operand.
38  static void printOperand(const MCOperand &MO, const MCAsmInfo *MAI,
39  raw_ostream &O);
41  // Override MCInstPrinter.
42  void printRegName(raw_ostream &O, unsigned RegNo) const override;
43  void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
44  const MCSubtargetInfo &STI, raw_ostream &O) override;
46 private:
47  // Print various types of operand.
48  void printOperand(const MCInst *MI, int OpNum, raw_ostream &O);
49  void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
50  raw_ostream &O) {
51  printOperand(MI, OpNum, O);
52  }
53  void printBDAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
54  void printBDXAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
55  void printBDLAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
56  void printBDRAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
57  void printBDVAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
58  void printU1ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
59  void printU2ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
60  void printU3ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
61  void printU4ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
62  void printU6ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
63  void printS8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
64  void printU8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
65  void printU12ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
66  void printS16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
67  void printU16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
68  void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
69  void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
70  void printU48ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
71  void printPCRelOperand(const MCInst *MI, int OpNum, raw_ostream &O);
72  void printPCRelOperand(const MCInst *MI, uint64_t /*Address*/, int OpNum,
73  raw_ostream &O) {
74  printPCRelOperand(MI, OpNum, O);
75  }
76  void printPCRelTLSOperand(const MCInst *MI, uint64_t Address, int OpNum,
77  raw_ostream &O);
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 };
84 } // end namespace llvm
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.
static void printAddress(unsigned Base, int64_t Disp, unsigned Index, raw_ostream &O)
This class represents lattice values for constants.
Definition: AllocatorList.h:23
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
SystemZInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
static const char * getRegisterName(unsigned RegNo)
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:48
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:42
Generic base class for all target subtargets.
const MCInstrInfo & MII
Definition: MCInstPrinter.h:49
static void printOperand(const MCOperand &MO, const MCAsmInfo *MAI, raw_ostream &O)
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
void printRegName(raw_ostream &O, unsigned RegNo) const override
Print the assembler register name.
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:34
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:50