1 //===-- X86AsmPrinter.h - X86 implementation of AsmPrinter ------*- 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 #ifndef X86ASMPRINTER_H 11 #define X86ASMPRINTER_H 12 13 #include "X86Subtarget.h" 14 #include "llvm/CodeGen/AsmPrinter.h" 15 #include "llvm/CodeGen/StackMaps.h" 16 #include "llvm/Target/TargetMachine.h" 17 18 namespace llvm { 19 class MCStreamer; 20 class MCSymbol; 21 22 class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter { 23 const X86Subtarget *Subtarget; 24 StackMaps SM; 25 26 void GenerateExportDirective(const MCSymbol *Sym, bool IsData); 27 28 public: X86AsmPrinter(TargetMachine & TM,MCStreamer & Streamer)29 explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer) 30 : AsmPrinter(TM, Streamer), SM(*this) { 31 Subtarget = &TM.getSubtarget<X86Subtarget>(); 32 } 33 getPassName()34 const char *getPassName() const override { 35 return "X86 Assembly / Object Emitter"; 36 } 37 getSubtarget()38 const X86Subtarget &getSubtarget() const { return *Subtarget; } 39 40 void EmitStartOfAsmFile(Module &M) override; 41 42 void EmitEndOfAsmFile(Module &M) override; 43 44 void EmitInstruction(const MachineInstr *MI) override; 45 46 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, 47 unsigned AsmVariant, const char *ExtraCode, 48 raw_ostream &OS) override; 49 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, 50 unsigned AsmVariant, const char *ExtraCode, 51 raw_ostream &OS) override; 52 53 bool runOnMachineFunction(MachineFunction &F) override; 54 }; 55 56 } // end namespace llvm 57 58 #endif 59