LLVM API Documentation

X86ATTInstPrinter.h
Go to the documentation of this file.
00001 //==- X86ATTInstPrinter.h - Convert X86 MCInst to assembly syntax -*- C++ -*-=//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This class prints an X86 MCInst to AT&T style .s file syntax.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_X86_INSTPRINTER_X86ATTINSTPRINTER_H
00015 #define LLVM_LIB_TARGET_X86_INSTPRINTER_X86ATTINSTPRINTER_H
00016 
00017 #include "llvm/MC/MCInstPrinter.h"
00018 #include "llvm/MC/MCSubtargetInfo.h"
00019 
00020 namespace llvm {
00021 
00022 class MCOperand;
00023 
00024 class X86ATTInstPrinter final : public MCInstPrinter {
00025 public:
00026   X86ATTInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
00027                     const MCRegisterInfo &MRI, const MCSubtargetInfo &STI)
00028     : MCInstPrinter(MAI, MII, MRI) {
00029     // Initialize the set of available features.
00030     setAvailableFeatures(STI.getFeatureBits());
00031   }
00032 
00033   void printRegName(raw_ostream &OS, unsigned RegNo) const override;
00034   void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot) override;
00035 
00036   // Autogenerated by tblgen, returns true if we successfully printed an
00037   // alias.
00038   bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
00039   void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
00040                                unsigned PrintMethodIdx, raw_ostream &O);
00041 
00042   // Autogenerated by tblgen.
00043   void printInstruction(const MCInst *MI, raw_ostream &OS);
00044   static const char *getRegisterName(unsigned RegNo);
00045 
00046   void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
00047   void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS);
00048   void printSSECC(const MCInst *MI, unsigned Op, raw_ostream &OS);
00049   void printAVXCC(const MCInst *MI, unsigned Op, raw_ostream &OS);
00050   void printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
00051   void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
00052   void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
00053   void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
00054   void printRoundingControl(const MCInst *MI, unsigned Op, raw_ostream &OS);
00055 
00056   void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00057     printMemReference(MI, OpNo, O);
00058   }
00059   
00060   void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00061     printMemReference(MI, OpNo, O);
00062   }
00063   void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00064     printMemReference(MI, OpNo, O);
00065   }
00066   void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00067     printMemReference(MI, OpNo, O);
00068   }
00069   void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00070     printMemReference(MI, OpNo, O);
00071   }
00072   void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00073     printMemReference(MI, OpNo, O);
00074   }
00075   void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00076     printMemReference(MI, OpNo, O);
00077   }
00078   void printi512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00079     printMemReference(MI, OpNo, O);
00080   }
00081   void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00082     printMemReference(MI, OpNo, O);
00083   }
00084   void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00085     printMemReference(MI, OpNo, O);
00086   }
00087   void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00088     printMemReference(MI, OpNo, O);
00089   }
00090   void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00091     printMemReference(MI, OpNo, O);
00092   }
00093   void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00094     printMemReference(MI, OpNo, O);
00095   }
00096   void printf512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00097     printMemReference(MI, OpNo, O);
00098   }
00099 
00100   void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00101     printSrcIdx(MI, OpNo, O);
00102   }
00103   void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00104     printSrcIdx(MI, OpNo, O);
00105   }
00106   void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00107     printSrcIdx(MI, OpNo, O);
00108   }
00109   void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00110     printSrcIdx(MI, OpNo, O);
00111   }
00112   void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00113     printDstIdx(MI, OpNo, O);
00114   }
00115   void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00116     printDstIdx(MI, OpNo, O);
00117   }
00118   void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00119     printDstIdx(MI, OpNo, O);
00120   }
00121   void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00122     printDstIdx(MI, OpNo, O);
00123   }
00124   void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00125     printMemOffset(MI, OpNo, O);
00126   }
00127   void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00128     printMemOffset(MI, OpNo, O);
00129   }
00130   void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00131     printMemOffset(MI, OpNo, O);
00132   }
00133   void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00134     printMemOffset(MI, OpNo, O);
00135   }
00136 
00137 private:
00138   bool HasCustomInstComment;
00139 };
00140   
00141 }
00142 
00143 #endif