1 //===-- X86AsmPrinter.h - Convert X86 LLVM code to assembly -----*- 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 // AT&T assembly code printer class. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef X86ASMPRINTER_H 15 #define X86ASMPRINTER_H 16 17 #include "X86.h" 18 #include "X86MachineFunctionInfo.h" 19 #include "X86TargetMachine.h" 20 #include "llvm/ADT/StringSet.h" 21 #include "llvm/CodeGen/AsmPrinter.h" 22 #include "llvm/CodeGen/MachineModuleInfo.h" 23 #include "llvm/CodeGen/ValueTypes.h" 24 #include "llvm/Support/Compiler.h" 25 26 namespace llvm { 27 28 class MachineJumpTableInfo; 29 class MCContext; 30 class MCInst; 31 class MCStreamer; 32 class MCSymbol; 33 34 class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter { 35 const X86Subtarget *Subtarget; 36 public: X86AsmPrinter(TargetMachine & TM,MCStreamer & Streamer)37 explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer) 38 : AsmPrinter(TM, Streamer) { 39 Subtarget = &TM.getSubtarget<X86Subtarget>(); 40 } 41 getPassName()42 virtual const char *getPassName() const { 43 return "X86 AT&T-Style Assembly Printer"; 44 } 45 getSubtarget()46 const X86Subtarget &getSubtarget() const { return *Subtarget; } 47 48 virtual void EmitStartOfAsmFile(Module &M); 49 50 virtual void EmitEndOfAsmFile(Module &M); 51 52 virtual void EmitInstruction(const MachineInstr *MI); 53 54 void printSymbolOperand(const MachineOperand &MO, raw_ostream &O); 55 56 // These methods are used by the tablegen'erated instruction printer. 57 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O, 58 const char *Modifier = 0); 59 void print_pcrel_imm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O); 60 61 bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O); 62 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, 63 unsigned AsmVariant, const char *ExtraCode, 64 raw_ostream &OS); 65 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, 66 unsigned AsmVariant, const char *ExtraCode, 67 raw_ostream &OS); 68 69 void printMachineInstruction(const MachineInstr *MI); 70 void printSSECC(const MachineInstr *MI, unsigned Op, raw_ostream &O); 71 void printMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O, 72 const char *Modifier=NULL); 73 void printLeaMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O, 74 const char *Modifier=NULL); 75 76 void printPICLabel(const MachineInstr *MI, unsigned Op, raw_ostream &O); 77 78 bool runOnMachineFunction(MachineFunction &F); 79 80 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS); 81 82 MachineLocation getDebugValueLocation(const MachineInstr *MI) const; 83 }; 84 85 } // end namespace llvm 86 87 #endif 88