blob: 8d69391c968b33e2a87810cc32619e736c54db83 [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 {
Bill Wendlinga5c177e2011-03-21 04:13:46 +000020
21class MCOperand;
Bill Wendling44dcfd32011-04-07 21:20:06 +000022class X86Subtarget;
Bill Wendlinga5c177e2011-03-21 04:13:46 +000023class TargetMachine;
Chris Lattnerc493fb22009-09-14 01:49:26 +000024
25class X86ATTInstPrinter : public MCInstPrinter {
26public:
Bill Wendling44dcfd32011-04-07 21:20:06 +000027 X86ATTInstPrinter(TargetMachine &TM, const MCAsmInfo &MAI);
Chris Lattnerc493fb22009-09-14 01:49:26 +000028
Chris Lattnerd3740872010-04-04 05:04:31 +000029 virtual void printInst(const MCInst *MI, raw_ostream &OS);
Chris Lattner0d7b0aa2010-02-11 22:57:32 +000030 virtual StringRef getOpcodeName(unsigned Opcode) const;
31
Bill Wendling44dcfd32011-04-07 21:20:06 +000032 // Methods used to print the alias of an instruction.
33 unsigned ComputeAvailableFeatures(const X86Subtarget *Subtarget) const;
Eric Christopher721ef662011-04-18 21:28:11 +000034 // Autogenerated by tblgen, returns true if we successfully printed an
35 // alias.
Bill Wendling44dcfd32011-04-07 21:20:06 +000036 bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
37
Chris Lattner05af2612009-09-13 20:08:00 +000038 // Autogenerated by tblgen.
Chris Lattner35c33bd2010-04-04 04:47:45 +000039 void printInstruction(const MCInst *MI, raw_ostream &OS);
Chris Lattnerd95148f2009-09-13 20:19:22 +000040 static const char *getRegisterName(unsigned RegNo);
Chris Lattner0d7b0aa2010-02-11 22:57:32 +000041 static const char *getInstructionName(unsigned Opcode);
Chris Lattnercae05cb2009-09-13 19:30:11 +000042
Chris Lattner35c33bd2010-04-04 04:47:45 +000043 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
44 void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS);
Chris Lattner35c33bd2010-04-04 04:47:45 +000045 void printSSECC(const MCInst *MI, unsigned Op, raw_ostream &OS);
46 void print_pcrel_imm(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
Chris Lattnercae05cb2009-09-13 19:30:11 +000047
Chris Lattner35c33bd2010-04-04 04:47:45 +000048 void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
49 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000050 }
51
Chris Lattner35c33bd2010-04-04 04:47:45 +000052 void printi8mem(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 printi16mem(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 printi32mem(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 printi64mem(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 printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
65 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000066 }
Bruno Cardoso Lopes94143ee2010-07-19 23:32:44 +000067 void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
68 printMemReference(MI, OpNo, O);
69 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000070 void printf32mem(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 printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
74 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000075 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000076 void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
77 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000078 }
Chris Lattner35c33bd2010-04-04 04:47:45 +000079 void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
80 printMemReference(MI, OpNo, O);
Chris Lattnercae05cb2009-09-13 19:30:11 +000081 }
Bruno Cardoso Lopese86b01c2010-07-09 18:27:43 +000082 void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
83 printMemReference(MI, OpNo, O);
84 }
Chris Lattnercae05cb2009-09-13 19:30:11 +000085};
86
87}
88
89#endif