Home | History | Annotate | Download | only in InstPrinter
      1 //=- X86ATTInstPrinter.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 AT&T style .s file syntax.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_LIB_TARGET_X86_INSTPRINTER_X86ATTINSTPRINTER_H
     15 #define LLVM_LIB_TARGET_X86_INSTPRINTER_X86ATTINSTPRINTER_H
     16 
     17 #include "X86InstPrinterCommon.h"
     18 
     19 namespace llvm {
     20 
     21 class X86ATTInstPrinter final : public X86InstPrinterCommon {
     22 public:
     23   X86ATTInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
     24                     const MCRegisterInfo &MRI)
     25       : X86InstPrinterCommon(MAI, MII, MRI) {}
     26 
     27   void printRegName(raw_ostream &OS, unsigned RegNo) const override;
     28   void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot,
     29                  const MCSubtargetInfo &STI) override;
     30 
     31   // Autogenerated by tblgen, returns true if we successfully printed an
     32   // alias.
     33   bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
     34   void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
     35                                unsigned PrintMethodIdx, raw_ostream &O);
     36 
     37   // Autogenerated by tblgen.
     38   void printInstruction(const MCInst *MI, raw_ostream &OS);
     39   static const char *getRegisterName(unsigned RegNo);
     40 
     41   void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS) override;
     42   void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS);
     43   void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
     44   void printSrcIdx(const MCInst *MI, unsigned Op, raw_ostream &O);
     45   void printDstIdx(const MCInst *MI, unsigned Op, raw_ostream &O);
     46   void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &OS);
     47 
     48   void printanymem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     49     printMemReference(MI, OpNo, O);
     50   }
     51   void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     52     printMemReference(MI, OpNo, O);
     53   }
     54 
     55   void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     56     printMemReference(MI, OpNo, O);
     57   }
     58   void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     59     printMemReference(MI, OpNo, O);
     60   }
     61   void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     62     printMemReference(MI, OpNo, O);
     63   }
     64   void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     65     printMemReference(MI, OpNo, O);
     66   }
     67   void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     68     printMemReference(MI, OpNo, O);
     69   }
     70   void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     71     printMemReference(MI, OpNo, O);
     72   }
     73   void printi512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     74     printMemReference(MI, OpNo, O);
     75   }
     76   void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     77     printMemReference(MI, OpNo, O);
     78   }
     79   void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     80     printMemReference(MI, OpNo, O);
     81   }
     82   void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     83     printMemReference(MI, OpNo, O);
     84   }
     85   void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     86     printMemReference(MI, OpNo, O);
     87   }
     88   void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     89     printMemReference(MI, OpNo, O);
     90   }
     91   void printf512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     92     printMemReference(MI, OpNo, O);
     93   }
     94 
     95   void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     96     printSrcIdx(MI, OpNo, O);
     97   }
     98   void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
     99     printSrcIdx(MI, OpNo, O);
    100   }
    101   void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    102     printSrcIdx(MI, OpNo, O);
    103   }
    104   void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    105     printSrcIdx(MI, OpNo, O);
    106   }
    107   void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    108     printDstIdx(MI, OpNo, O);
    109   }
    110   void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    111     printDstIdx(MI, OpNo, O);
    112   }
    113   void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    114     printDstIdx(MI, OpNo, O);
    115   }
    116   void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    117     printDstIdx(MI, OpNo, O);
    118   }
    119   void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    120     printMemOffset(MI, OpNo, O);
    121   }
    122   void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    123     printMemOffset(MI, OpNo, O);
    124   }
    125   void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    126     printMemOffset(MI, OpNo, O);
    127   }
    128   void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
    129     printMemOffset(MI, OpNo, O);
    130   }
    131 
    132 private:
    133   bool HasCustomInstComment;
    134 };
    135 
    136 } // end namespace llvm
    137 
    138 #endif // LLVM_LIB_TARGET_X86_INSTPRINTER_X86ATTINSTPRINTER_H
    139