1 //===-- X86AsmPrinter.h - X86 implementation of AsmPrinter ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef X86ASMPRINTER_H
11 #define X86ASMPRINTER_H
14 #include "X86MachineFunctionInfo.h"
15 #include "X86TargetMachine.h"
16 #include "llvm/CodeGen/AsmPrinter.h"
17 #include "llvm/CodeGen/MachineModuleInfo.h"
18 #include "llvm/CodeGen/ValueTypes.h"
19 #include "llvm/CodeGen/StackMaps.h"
20 #include "llvm/Support/Compiler.h"
26 class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter {
27 const X86Subtarget *Subtarget;
30 // Parses operands of PATCHPOINT and STACKMAP to produce stack map Location
31 // structures. Returns a result location and an iterator to the operand
32 // immediately following the operands consumed.
34 // This method is implemented in X86MCInstLower.cpp.
35 static std::pair<StackMaps::Location, MachineInstr::const_mop_iterator>
36 stackmapOperandParser(MachineInstr::const_mop_iterator MOI,
37 MachineInstr::const_mop_iterator MOE,
38 const TargetMachine &TM);
41 explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
42 : AsmPrinter(TM, Streamer), SM(*this, stackmapOperandParser) {
43 Subtarget = &TM.getSubtarget<X86Subtarget>();
46 virtual const char *getPassName() const LLVM_OVERRIDE {
47 return "X86 Assembly / Object Emitter";
50 const X86Subtarget &getSubtarget() const { return *Subtarget; }
52 virtual void EmitStartOfAsmFile(Module &M) LLVM_OVERRIDE;
54 virtual void EmitEndOfAsmFile(Module &M) LLVM_OVERRIDE;
56 virtual void EmitInstruction(const MachineInstr *MI) LLVM_OVERRIDE;
58 virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
59 unsigned AsmVariant, const char *ExtraCode,
60 raw_ostream &OS) LLVM_OVERRIDE;
61 virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
62 unsigned AsmVariant, const char *ExtraCode,
63 raw_ostream &OS) LLVM_OVERRIDE;
65 virtual bool runOnMachineFunction(MachineFunction &F) LLVM_OVERRIDE;
68 } // end namespace llvm