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/ADT/StringSet.h"
21 #include "llvm/CodeGen/AsmPrinter.h"
22 #include "llvm/CodeGen/DwarfWriter.h"
23 #include "llvm/CodeGen/MachineModuleInfo.h"
24 #include "llvm/CodeGen/ValueTypes.h"
25 #include "llvm/Support/Compiler.h"
29 class MachineJumpTableInfo;
35 class VISIBILITY_HIDDEN X86AsmPrinter : public AsmPrinter {
36 const X86Subtarget *Subtarget;
38 explicit X86AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
40 : AsmPrinter(O, TM, Streamer) {
41 Subtarget = &TM.getSubtarget<X86Subtarget>();
44 virtual const char *getPassName() const {
45 return "X86 AT&T-Style Assembly Printer";
48 const X86Subtarget &getSubtarget() const { return *Subtarget; }
50 void getAnalysisUsage(AnalysisUsage &AU) const {
52 AU.addRequired<MachineModuleInfo>();
53 AU.addRequired<DwarfWriter>();
54 AsmPrinter::getAnalysisUsage(AU);
57 virtual void EmitStartOfAsmFile(Module &M);
59 virtual void EmitEndOfAsmFile(Module &M);
61 virtual void EmitInstruction(const MachineInstr *MI);
63 void printSymbolOperand(const MachineOperand &MO, raw_ostream &O);
65 // These methods are used by the tablegen'erated instruction printer.
66 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
67 const char *Modifier = 0);
68 void print_pcrel_imm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
70 bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O);
71 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
72 unsigned AsmVariant, const char *ExtraCode,
74 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
75 unsigned AsmVariant, const char *ExtraCode,
78 void printMachineInstruction(const MachineInstr *MI);
79 void printSSECC(const MachineInstr *MI, unsigned Op, raw_ostream &O);
80 void printMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
81 const char *Modifier=NULL);
82 void printLeaMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
83 const char *Modifier=NULL);
85 void printPICLabel(const MachineInstr *MI, unsigned Op, raw_ostream &O);
87 void PrintPICBaseSymbol(raw_ostream &O) const;
89 bool runOnMachineFunction(MachineFunction &F);
92 } // end namespace llvm