LLVM API Documentation

X86AsmPrinter.h
Go to the documentation of this file.
00001 //===-- X86AsmPrinter.h - X86 implementation of AsmPrinter ------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef X86ASMPRINTER_H
00011 #define X86ASMPRINTER_H
00012 
00013 #include "X86.h"
00014 #include "X86MachineFunctionInfo.h"
00015 #include "X86TargetMachine.h"
00016 #include "llvm/CodeGen/AsmPrinter.h"
00017 #include "llvm/CodeGen/MachineModuleInfo.h"
00018 #include "llvm/CodeGen/ValueTypes.h"
00019 #include "llvm/Support/Compiler.h"
00020 
00021 namespace llvm {
00022 
00023 class MCStreamer;
00024 
00025 class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter {
00026   const X86Subtarget *Subtarget;
00027  public:
00028   explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
00029     : AsmPrinter(TM, Streamer) {
00030     Subtarget = &TM.getSubtarget<X86Subtarget>();
00031   }
00032 
00033   virtual const char *getPassName() const LLVM_OVERRIDE {
00034     return "X86 Assembly / Object Emitter";
00035   }
00036 
00037   const X86Subtarget &getSubtarget() const { return *Subtarget; }
00038 
00039   virtual void EmitStartOfAsmFile(Module &M) LLVM_OVERRIDE;
00040 
00041   virtual void EmitEndOfAsmFile(Module &M) LLVM_OVERRIDE;
00042 
00043   virtual void EmitInstruction(const MachineInstr *MI) LLVM_OVERRIDE;
00044 
00045   void printSymbolOperand(const MachineOperand &MO, raw_ostream &O);
00046 
00047   // These methods are used by the tablegen'erated instruction printer.
00048   void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
00049                     const char *Modifier = 0, unsigned AsmVariant = 0);
00050   void printPCRelImm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
00051 
00052   bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O);
00053   virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
00054                                unsigned AsmVariant, const char *ExtraCode,
00055                                raw_ostream &OS) LLVM_OVERRIDE;
00056   virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
00057                                      unsigned AsmVariant, const char *ExtraCode,
00058                                      raw_ostream &OS) LLVM_OVERRIDE;
00059 
00060   void printMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
00061                          const char *Modifier=NULL);
00062   void printLeaMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
00063                             const char *Modifier=NULL);
00064 
00065   void printIntelMemReference(const MachineInstr *MI, unsigned Op,
00066                               raw_ostream &O, const char *Modifier=NULL,
00067                               unsigned AsmVariant = 1);
00068 
00069   virtual bool runOnMachineFunction(MachineFunction &F) LLVM_OVERRIDE;
00070 
00071   void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
00072 
00073   virtual MachineLocation
00074     getDebugValueLocation(const MachineInstr *MI) const LLVM_OVERRIDE;
00075 };
00076 
00077 } // end namespace llvm
00078 
00079 #endif