blob: 3450a057f83a71cf5bf37e60a7be88791d177faa [file] [log] [blame]
Chris Lattnercae05cb2009-09-13 19:30:11 +00001//===-- X86ATTInstPrinter.h - Convert X86 MCInst to assembly syntax -------===//
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 AT&T style .s file syntax.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef X86_ATT_INST_PRINTER_H
15#define X86_ATT_INST_PRINTER_H
16
Chris Lattnerc493fb22009-09-14 01:49:26 +000017#include "llvm/MC/MCInstPrinter.h"
Chris Lattner05af2612009-09-13 20:08:00 +000018
Chris Lattnerc493fb22009-09-14 01:49:26 +000019namespace llvm {
20 class MCOperand;
21
22class X86ATTInstPrinter : public MCInstPrinter {
23public:
24 X86ATTInstPrinter(raw_ostream &O, const MCAsmInfo &MAI)
25 : MCInstPrinter(O, MAI) {}
26
27
28 virtual void printInst(const MCInst *MI);
Chris Lattner0d7b0aa2010-02-11 22:57:32 +000029 virtual StringRef getOpcodeName(unsigned Opcode) const;
30
Chris Lattner05af2612009-09-13 20:08:00 +000031 // Autogenerated by tblgen.
Chris Lattner35c33bd2010-04-04 04:47:45 +000032 void printInstruction(const MCInst *MI, raw_ostream &OS);
Chris Lattnerd95148f2009-09-13 20:19:22 +000033 static const char *getRegisterName(unsigned RegNo);
Chris Lattner0d7b0aa2010-02-11 22:57:32 +000034 static const char *getInstructionName(unsigned Opcode);
Chris Lattnercae05cb2009-09-13 19:30:11 +000035
Chris Lattner35c33bd2010-04-04 04:47:45 +000036 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
37 void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS);
38 void printLeaMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS);
39 void printSSECC(const MCInst *MI, unsigned Op, raw_ostream &OS);
40 void print_pcrel_imm(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
Chris Lattnercae05cb2009-09-13 19:30:11 +000041
Chris Lattner35c33bd2010-04-04 04:47:45 +000042 void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
43 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000044 }
45
Chris Lattner35c33bd2010-04-04 04:47:45 +000046 void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
47 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000048 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000049 void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
50 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000051 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000052 void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
53 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000054 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000055 void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
56 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000057 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000058 void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
59 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000060 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000061 void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
62 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000063 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000064 void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
65 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000066 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000067 void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
68 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000069 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000070 void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
71 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000072 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000073 void printlea32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
74 printLeaMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000075 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000076 void printlea64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
77 printLeaMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000078 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000079 void printlea64_32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
80 printLeaMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000081 }
82};
83
84}
85
86#endif