X86IntelInstPrinter.h revision ebe69fe11e48d322045d5949c83283927a0d790b
1//= X86IntelInstPrinter.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 Intel style .s file syntax. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef LLVM_LIB_TARGET_X86_INSTPRINTER_X86INTELINSTPRINTER_H 15#define LLVM_LIB_TARGET_X86_INSTPRINTER_X86INTELINSTPRINTER_H 16 17#include "llvm/MC/MCInstPrinter.h" 18#include "llvm/Support/raw_ostream.h" 19 20namespace llvm { 21 22class MCOperand; 23 24class X86IntelInstPrinter final : public MCInstPrinter { 25public: 26 X86IntelInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 27 const MCRegisterInfo &MRI) 28 : MCInstPrinter(MAI, MII, MRI) {} 29 30 void printRegName(raw_ostream &OS, unsigned RegNo) const override; 31 void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot) override; 32 33 // Autogenerated by tblgen. 34 void printInstruction(const MCInst *MI, raw_ostream &O); 35 static const char *getRegisterName(unsigned RegNo); 36 37 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 38 void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &O); 39 void printSSEAVXCC(const MCInst *MI, unsigned Op, raw_ostream &O); 40 void printXOPCC(const MCInst *MI, unsigned Op, raw_ostream &O); 41 void printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &O); 42 void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O); 43 void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O); 44 void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O); 45 void printRoundingControl(const MCInst *MI, unsigned Op, raw_ostream &OS); 46 void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &O); 47 48 void printanymem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 49 printMemReference(MI, OpNo, O); 50 } 51 52 void printopaquemem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 53 O << "opaque ptr "; 54 printMemReference(MI, OpNo, O); 55 } 56 57 void printi8mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 58 O << "byte ptr "; 59 printMemReference(MI, OpNo, O); 60 } 61 void printi16mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 62 O << "word ptr "; 63 printMemReference(MI, OpNo, O); 64 } 65 void printi32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 66 O << "dword ptr "; 67 printMemReference(MI, OpNo, O); 68 } 69 void printi64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 70 O << "qword ptr "; 71 printMemReference(MI, OpNo, O); 72 } 73 void printi128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 74 O << "xmmword ptr "; 75 printMemReference(MI, OpNo, O); 76 } 77 void printi256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 78 O << "ymmword ptr "; 79 printMemReference(MI, OpNo, O); 80 } 81 void printi512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 82 O << "zmmword ptr "; 83 printMemReference(MI, OpNo, O); 84 } 85 void printf32mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 86 O << "dword ptr "; 87 printMemReference(MI, OpNo, O); 88 } 89 void printf64mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 90 O << "qword ptr "; 91 printMemReference(MI, OpNo, O); 92 } 93 void printf80mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 94 O << "xword ptr "; 95 printMemReference(MI, OpNo, O); 96 } 97 void printf128mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 98 O << "xmmword ptr "; 99 printMemReference(MI, OpNo, O); 100 } 101 void printf256mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 102 O << "ymmword ptr "; 103 printMemReference(MI, OpNo, O); 104 } 105 void printf512mem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 106 O << "zmmword ptr "; 107 printMemReference(MI, OpNo, O); 108 } 109 110 111 void printSrcIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 112 O << "byte ptr "; 113 printSrcIdx(MI, OpNo, O); 114 } 115 void printSrcIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 116 O << "word ptr "; 117 printSrcIdx(MI, OpNo, O); 118 } 119 void printSrcIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 120 O << "dword ptr "; 121 printSrcIdx(MI, OpNo, O); 122 } 123 void printSrcIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 124 O << "qword ptr "; 125 printSrcIdx(MI, OpNo, O); 126 } 127 void printDstIdx8(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 128 O << "byte ptr "; 129 printDstIdx(MI, OpNo, O); 130 } 131 void printDstIdx16(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 132 O << "word ptr "; 133 printDstIdx(MI, OpNo, O); 134 } 135 void printDstIdx32(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 136 O << "dword ptr "; 137 printDstIdx(MI, OpNo, O); 138 } 139 void printDstIdx64(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 140 O << "qword ptr "; 141 printDstIdx(MI, OpNo, O); 142 } 143 void printMemOffs8(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 144 O << "byte ptr "; 145 printMemOffset(MI, OpNo, O); 146 } 147 void printMemOffs16(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 148 O << "word ptr "; 149 printMemOffset(MI, OpNo, O); 150 } 151 void printMemOffs32(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 152 O << "dword ptr "; 153 printMemOffset(MI, OpNo, O); 154 } 155 void printMemOffs64(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 156 O << "qword ptr "; 157 printMemOffset(MI, OpNo, O); 158 } 159}; 160 161} 162 163#endif 164