X86IntelInstPrinter.h revision 263508
1//= X86IntelInstPrinter.h - Convert X86 MCInst to assembly syntax -*- C++ -*-=//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This class prints an X86 MCInst to Intel style .s file syntax.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef X86_INTEL_INST_PRINTER_H
15#define X86_INTEL_INST_PRINTER_H
16
17#include "llvm/MC/MCInstPrinter.h"
18#include "llvm/Support/raw_ostream.h"
19
20namespace llvm {
21
22class MCOperand;
23
24class X86IntelInstPrinter : public MCInstPrinter {
25public:
26  X86IntelInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
27                      const MCRegisterInfo &MRI)
28    : MCInstPrinter(MAI, MII, MRI) {}
29
30  virtual void printRegName(raw_ostream &OS, unsigned RegNo) const;
31  virtual void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot);
32
33  // Autogenerated by tblgen.
34  void printInstruction(const MCInst *MI, raw_ostream &O);
35  static const char *getRegisterName(unsigned RegNo);
36
37  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
38  void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &O);
39  void printSSECC(const MCInst *MI, unsigned Op, raw_ostream &O);
40  void printAVXCC(const MCInst *MI, unsigned Op, raw_ostream &O);
41  void printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &O);
42  void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O);
43
44  void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
45    O << "opaque ptr ";
46    printMemReference(MI, OpNo, O);
47  }
48
49  void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
50    O << "byte ptr ";
51    printMemReference(MI, OpNo, O);
52  }
53  void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
54    O << "word ptr ";
55    printMemReference(MI, OpNo, O);
56  }
57  void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
58    O << "dword ptr ";
59    printMemReference(MI, OpNo, O);
60  }
61  void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
62    O << "qword ptr ";
63    printMemReference(MI, OpNo, O);
64  }
65  void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
66    O << "xmmword ptr ";
67    printMemReference(MI, OpNo, O);
68  }
69  void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
70    O << "ymmword ptr ";
71    printMemReference(MI, OpNo, O);
72  }
73  void printi512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
74    O << "zmmword ptr ";
75    printMemReference(MI, OpNo, O);
76  }
77  void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
78    O << "dword ptr ";
79    printMemReference(MI, OpNo, O);
80  }
81  void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
82    O << "qword ptr ";
83    printMemReference(MI, OpNo, O);
84  }
85  void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
86    O << "xword ptr ";
87    printMemReference(MI, OpNo, O);
88  }
89  void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
90    O << "xmmword ptr ";
91    printMemReference(MI, OpNo, O);
92  }
93  void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
94    O << "ymmword ptr ";
95    printMemReference(MI, OpNo, O);
96  }
97  void printf512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
98    O << "zmmword ptr ";
99    printMemReference(MI, OpNo, O);
100  }
101
102  void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
103    O << "byte ptr ";
104    printMemOffset(MI, OpNo, O);
105  }
106  void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
107    O << "word ptr ";
108    printMemOffset(MI, OpNo, O);
109  }
110  void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
111    O << "dword ptr ";
112    printMemOffset(MI, OpNo, O);
113  }
114  void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
115    O << "qword ptr ";
116    printMemOffset(MI, OpNo, O);
117  }
118};
119
120}
121
122#endif
123