LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
X86AsmPrinter.h
Go to the documentation of this file.
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 "X86.h"
14 #include "X86MachineFunctionInfo.h"
15 #include "X86TargetMachine.h"
19 #include "llvm/CodeGen/StackMaps.h"
20 #include "llvm/Support/Compiler.h"
21 
22 namespace llvm {
23 
24 class MCStreamer;
25 
27  const X86Subtarget *Subtarget;
28  StackMaps SM;
29 
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.
33  //
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,
38  const TargetMachine &TM);
39 
40  public:
41  explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
42  : AsmPrinter(TM, Streamer), SM(*this, stackmapOperandParser) {
43  Subtarget = &TM.getSubtarget<X86Subtarget>();
44  }
45 
46  virtual const char *getPassName() const LLVM_OVERRIDE {
47  return "X86 Assembly / Object Emitter";
48  }
49 
50  const X86Subtarget &getSubtarget() const { return *Subtarget; }
51 
52  virtual void EmitStartOfAsmFile(Module &M) LLVM_OVERRIDE;
53 
54  virtual void EmitEndOfAsmFile(Module &M) LLVM_OVERRIDE;
55 
56  virtual void EmitInstruction(const MachineInstr *MI) LLVM_OVERRIDE;
57 
58  void printSymbolOperand(const MachineOperand &MO, raw_ostream &O);
59 
60  // These methods are used by the tablegen'erated instruction printer.
61  void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
62  const char *Modifier = 0, unsigned AsmVariant = 0);
63  void printPCRelImm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
64 
65  bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O);
66  virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
67  unsigned AsmVariant, const char *ExtraCode,
69  virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
70  unsigned AsmVariant, const char *ExtraCode,
72 
73  void printMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
74  const char *Modifier=NULL);
75  void printLeaMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
76  const char *Modifier=NULL);
77 
78  void printIntelMemReference(const MachineInstr *MI, unsigned Op,
79  raw_ostream &O, const char *Modifier=NULL,
80  unsigned AsmVariant = 1);
81 
82  virtual bool runOnMachineFunction(MachineFunction &F) LLVM_OVERRIDE;
83 };
84 
85 } // end namespace llvm
86 
87 #endif
The main container class for the LLVM Intermediate Representation.
Definition: Module.h:112
F(f)
virtual const char * getPassName() const LLVM_OVERRIDE
Definition: X86AsmPrinter.h:46
#define LLVM_LIBRARY_VISIBILITY
Definition: Compiler.h:173
X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
Definition: X86AsmPrinter.h:41
const STC & getSubtarget() const
const X86Subtarget & getSubtarget() const
Definition: X86AsmPrinter.h:50
#define LLVM_OVERRIDE
Definition: Compiler.h:155