1275970Scy//==- SystemZInstPrinter.h - Convert SystemZ MCInst to assembly --*- C++ -*-==//
2275970Scy//
3275970Scy//                     The LLVM Compiler Infrastructure
4275970Scy//
5275970Scy// This file is distributed under the University of Illinois Open Source
6275970Scy// License. See LICENSE.TXT for details.
7275970Scy//
8275970Scy//===----------------------------------------------------------------------===//
9275970Scy//
10275970Scy// This class prints a SystemZ MCInst to a .s file.
11275970Scy//
12275970Scy//===----------------------------------------------------------------------===//
13275970Scy
14275970Scy#ifndef LLVM_SYSTEMZINSTPRINTER_H
15275970Scy#define LLVM_SYSTEMZINSTPRINTER_H
16275970Scy
17275970Scy#include "llvm/MC/MCInstPrinter.h"
18275970Scy#include "llvm/Support/Compiler.h"
19275970Scy
20275970Scynamespace llvm {
21275970Scyclass MCOperand;
22275970Scy
23275970Scyclass SystemZInstPrinter : public MCInstPrinter {
24275970Scypublic:
25275970Scy  SystemZInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
26275970Scy                     const MCRegisterInfo &MRI)
27275970Scy    : MCInstPrinter(MAI, MII, MRI) {}
28275970Scy
29275970Scy  // Automatically generated by tblgen.
30275970Scy  void printInstruction(const MCInst *MI, raw_ostream &O);
31275970Scy  static const char *getRegisterName(unsigned RegNo);
32275970Scy
33275970Scy  // Print an address with the given base, displacement and index.
34275970Scy  static void printAddress(unsigned Base, int64_t Disp, unsigned Index,
35275970Scy                           raw_ostream &O);
36275970Scy
37275970Scy  // Print the given operand.
38275970Scy  static void printOperand(const MCOperand &MO, raw_ostream &O);
39275970Scy
40275970Scy  // Override MCInstPrinter.
41275970Scy  virtual void printRegName(raw_ostream &O, unsigned RegNo) const
42275970Scy    LLVM_OVERRIDE;
43275970Scy  virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot)
44275970Scy    LLVM_OVERRIDE;
45275970Scy
46275970Scyprivate:
47275970Scy  // Print various types of operand.
48275970Scy  void printOperand(const MCInst *MI, int OpNum, raw_ostream &O);
49275970Scy  void printBDAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
50275970Scy  void printBDXAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
51275970Scy  void printBDLAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
52275970Scy  void printU4ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
53275970Scy  void printU6ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
54275970Scy  void printS8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
55275970Scy  void printU8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
56275970Scy  void printS16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
57275970Scy  void printU16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
58275970Scy  void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
59275970Scy  void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
60275970Scy  void printPCRelOperand(const MCInst *MI, int OpNum, raw_ostream &O);
61275970Scy  void printAccessRegOperand(const MCInst *MI, int OpNum, raw_ostream &O);
62275970Scy
63275970Scy  // Print the mnemonic for a condition-code mask ("ne", "lh", etc.)
64275970Scy  // This forms part of the instruction name rather than the operand list.
65275970Scy  void printCond4Operand(const MCInst *MI, int OpNum, raw_ostream &O);
66275970Scy};
67275970Scy} // end namespace llvm
68275970Scy
69275970Scy#endif
70275970Scy