1 //===-- X86AsmPrinter.h - Convert X86 LLVM code to assembly -----*- 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 // AT&T assembly code printer class.
12 //===----------------------------------------------------------------------===//
14 #ifndef X86ASMPRINTER_H
15 #define X86ASMPRINTER_H
18 #include "X86MachineFunctionInfo.h"
19 #include "X86TargetMachine.h"
20 #include "llvm/CodeGen/AsmPrinter.h"
21 #include "llvm/CodeGen/MachineModuleInfo.h"
22 #include "llvm/CodeGen/ValueTypes.h"
23 #include "llvm/Support/Compiler.h"
27 class MachineJumpTableInfo;
33 class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter {
34 const X86Subtarget *Subtarget;
36 explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
37 : AsmPrinter(TM, Streamer) {
38 Subtarget = &TM.getSubtarget<X86Subtarget>();
41 virtual const char *getPassName() const {
42 return "X86 AT&T-Style Assembly Printer";
45 const X86Subtarget &getSubtarget() const { return *Subtarget; }
47 virtual void EmitStartOfAsmFile(Module &M);
49 virtual void EmitEndOfAsmFile(Module &M);
51 virtual void EmitInstruction(const MachineInstr *MI);
53 void printSymbolOperand(const MachineOperand &MO, raw_ostream &O);
55 // These methods are used by the tablegen'erated instruction printer.
56 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
57 const char *Modifier = 0);
58 void print_pcrel_imm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
60 bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O);
61 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
62 unsigned AsmVariant, const char *ExtraCode,
64 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
65 unsigned AsmVariant, const char *ExtraCode,
68 void printMachineInstruction(const MachineInstr *MI);
69 void printSSECC(const MachineInstr *MI, unsigned Op, raw_ostream &O);
70 void printMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
71 const char *Modifier=NULL);
72 void printLeaMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
73 const char *Modifier=NULL);
75 void printPICLabel(const MachineInstr *MI, unsigned Op, raw_ostream &O);
77 bool runOnMachineFunction(MachineFunction &F);
79 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
81 MachineLocation getDebugValueLocation(const MachineInstr *MI) const;
84 } // end namespace llvm