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(TargetMachine &TM, MCStreamer &Streamer)
39 : AsmPrinter(TM, Streamer) {
40 Subtarget = &TM.getSubtarget<X86Subtarget>();
43 virtual const char *getPassName() const {
44 return "X86 AT&T-Style Assembly Printer";
47 const X86Subtarget &getSubtarget() const { return *Subtarget; }
49 void getAnalysisUsage(AnalysisUsage &AU) const {
51 AU.addRequired<MachineModuleInfo>();
52 AU.addRequired<DwarfWriter>();
53 AsmPrinter::getAnalysisUsage(AU);
56 virtual void EmitStartOfAsmFile(Module &M);
58 virtual void EmitEndOfAsmFile(Module &M);
60 virtual void EmitInstruction(const MachineInstr *MI);
62 void printSymbolOperand(const MachineOperand &MO, raw_ostream &O);
64 // These methods are used by the tablegen'erated instruction printer.
65 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
66 const char *Modifier = 0);
67 void print_pcrel_imm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
69 bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O);
70 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
71 unsigned AsmVariant, const char *ExtraCode,
73 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
74 unsigned AsmVariant, const char *ExtraCode,
77 void printMachineInstruction(const MachineInstr *MI);
78 void printSSECC(const MachineInstr *MI, unsigned Op, raw_ostream &O);
79 void printMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
80 const char *Modifier=NULL);
81 void printLeaMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
82 const char *Modifier=NULL);
84 void printPICLabel(const MachineInstr *MI, unsigned Op, raw_ostream &O);
86 void PrintPICBaseSymbol(raw_ostream &O) const;
88 bool runOnMachineFunction(MachineFunction &F);
90 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
93 } // end namespace llvm