1251607Sdim//==- SystemZInstPrinter.h - Convert SystemZ MCInst to assembly --*- C++ -*-==//
2251607Sdim//
3251607Sdim//                     The LLVM Compiler Infrastructure
4251607Sdim//
5251607Sdim// This file is distributed under the University of Illinois Open Source
6251607Sdim// License. See LICENSE.TXT for details.
7251607Sdim//
8251607Sdim//===----------------------------------------------------------------------===//
9251607Sdim//
10251607Sdim// This class prints a SystemZ MCInst to a .s file.
11251607Sdim//
12251607Sdim//===----------------------------------------------------------------------===//
13251607Sdim
14251607Sdim#ifndef LLVM_SYSTEMZINSTPRINTER_H
15251607Sdim#define LLVM_SYSTEMZINSTPRINTER_H
16251607Sdim
17251607Sdim#include "llvm/MC/MCInstPrinter.h"
18251607Sdim#include "llvm/Support/Compiler.h"
19251607Sdim
20251607Sdimnamespace llvm {
21251607Sdimclass MCOperand;
22251607Sdim
23251607Sdimclass SystemZInstPrinter : public MCInstPrinter {
24251607Sdimpublic:
25251607Sdim  SystemZInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
26251607Sdim                     const MCRegisterInfo &MRI)
27251607Sdim    : MCInstPrinter(MAI, MII, MRI) {}
28251607Sdim
29251607Sdim  // Automatically generated by tblgen.
30251607Sdim  void printInstruction(const MCInst *MI, raw_ostream &O);
31251607Sdim  static const char *getRegisterName(unsigned RegNo);
32251607Sdim
33251607Sdim  // Print an address with the given base, displacement and index.
34251607Sdim  static void printAddress(unsigned Base, int64_t Disp, unsigned Index,
35251607Sdim                           raw_ostream &O);
36251607Sdim
37251607Sdim  // Print the given operand.
38251607Sdim  static void printOperand(const MCOperand &MO, raw_ostream &O);
39251607Sdim
40251607Sdim  // Override MCInstPrinter.
41251607Sdim  virtual void printRegName(raw_ostream &O, unsigned RegNo) const
42251607Sdim    LLVM_OVERRIDE;
43251607Sdim  virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot)
44251607Sdim    LLVM_OVERRIDE;
45251607Sdim
46251607Sdimprivate:
47251607Sdim  // Print various types of operand.
48251607Sdim  void printOperand(const MCInst *MI, int OpNum, raw_ostream &O);
49251607Sdim  void printBDAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
50251607Sdim  void printBDXAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
51263509Sdim  void printBDLAddrOperand(const MCInst *MI, int OpNum, raw_ostream &O);
52251607Sdim  void printU4ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
53251607Sdim  void printU6ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
54251607Sdim  void printS8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
55251607Sdim  void printU8ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
56251607Sdim  void printS16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
57251607Sdim  void printU16ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
58251607Sdim  void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
59251607Sdim  void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
60263509Sdim  void printPCRelOperand(const MCInst *MI, int OpNum, raw_ostream &O);
61251607Sdim  void printAccessRegOperand(const MCInst *MI, int OpNum, raw_ostream &O);
62251607Sdim
63251607Sdim  // Print the mnemonic for a condition-code mask ("ne", "lh", etc.)
64251607Sdim  // This forms part of the instruction name rather than the operand list.
65251607Sdim  void printCond4Operand(const MCInst *MI, int OpNum, raw_ostream &O);
66251607Sdim};
67251607Sdim} // end namespace llvm
68251607Sdim
69251607Sdim#endif
70