LLVM API Documentation

X86IntelInstPrinter.h
Go to the documentation of this file.
00001 //= X86IntelInstPrinter.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 Intel style .s file syntax.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_X86_INSTPRINTER_X86INTELINSTPRINTER_H
00015 #define LLVM_LIB_TARGET_X86_INSTPRINTER_X86INTELINSTPRINTER_H
00016 
00017 #include "llvm/MC/MCInstPrinter.h"
00018 #include "llvm/Support/raw_ostream.h"
00019 
00020 namespace llvm {
00021 
00022 class MCOperand;
00023 
00024 class X86IntelInstPrinter final : public MCInstPrinter {
00025 public:
00026   X86IntelInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
00027                       const MCRegisterInfo &MRI)
00028     : MCInstPrinter(MAI, MII, MRI) {}
00029 
00030   void printRegName(raw_ostream &OS, unsigned RegNo) const override;
00031   void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot) override;
00032 
00033   // Autogenerated by tblgen.
00034   void printInstruction(const MCInst *MI, raw_ostream &O);
00035   static const char *getRegisterName(unsigned RegNo);
00036 
00037   void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
00038   void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &O);
00039   void printSSECC(const MCInst *MI, unsigned Op, raw_ostream &O);
00040   void printAVXCC(const MCInst *MI, unsigned Op, raw_ostream &O);
00041   void printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &O);
00042   void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O);
00043   void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
00044   void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O);
00045   void printRoundingControl(const MCInst *MI, unsigned Op, raw_ostream &OS);
00046 
00047   void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00048     O << "opaque ptr ";
00049     printMemReference(MI, OpNo, O);
00050   }
00051   
00052   void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00053     O << "byte ptr ";
00054     printMemReference(MI, OpNo, O);
00055   }
00056   void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00057     O << "word ptr ";
00058     printMemReference(MI, OpNo, O);
00059   }
00060   void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00061     O << "dword ptr ";
00062     printMemReference(MI, OpNo, O);
00063   }
00064   void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00065     O << "qword ptr ";
00066     printMemReference(MI, OpNo, O);
00067   }
00068   void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00069     O << "xmmword ptr ";
00070     printMemReference(MI, OpNo, O);
00071   }
00072   void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00073     O << "ymmword ptr ";
00074     printMemReference(MI, OpNo, O);
00075   }
00076   void printi512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00077     O << "zmmword ptr ";
00078     printMemReference(MI, OpNo, O);
00079   }
00080   void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00081     O << "dword ptr ";
00082     printMemReference(MI, OpNo, O);
00083   }
00084   void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00085     O << "qword ptr ";
00086     printMemReference(MI, OpNo, O);
00087   }
00088   void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00089     O << "xword ptr ";
00090     printMemReference(MI, OpNo, O);
00091   }
00092   void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00093     O << "xmmword ptr ";
00094     printMemReference(MI, OpNo, O);
00095   }
00096   void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00097     O << "ymmword ptr ";
00098     printMemReference(MI, OpNo, O);
00099   }
00100   void printf512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00101     O << "zmmword ptr ";
00102     printMemReference(MI, OpNo, O);
00103   }
00104 
00105 
00106   void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00107     O << "byte ptr ";
00108     printSrcIdx(MI, OpNo, O);
00109   }
00110   void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00111     O << "word ptr ";
00112     printSrcIdx(MI, OpNo, O);
00113   }
00114   void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00115     O << "dword ptr ";
00116     printSrcIdx(MI, OpNo, O);
00117   }
00118   void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00119     O << "qword ptr ";
00120     printSrcIdx(MI, OpNo, O);
00121   }
00122   void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00123     O << "byte ptr ";
00124     printDstIdx(MI, OpNo, O);
00125   }
00126   void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00127     O << "word ptr ";
00128     printDstIdx(MI, OpNo, O);
00129   }
00130   void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00131     O << "dword ptr ";
00132     printDstIdx(MI, OpNo, O);
00133   }
00134   void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00135     O << "qword ptr ";
00136     printDstIdx(MI, OpNo, O);
00137   }
00138   void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00139     O << "byte ptr ";
00140     printMemOffset(MI, OpNo, O);
00141   }
00142   void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00143     O << "word ptr ";
00144     printMemOffset(MI, OpNo, O);
00145   }
00146   void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00147     O << "dword ptr ";
00148     printMemOffset(MI, OpNo, O);
00149   }
00150   void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
00151     O << "qword ptr ";
00152     printMemOffset(MI, OpNo, O);
00153   }
00154 };
00155   
00156 }
00157 
00158 #endif