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/MachineModuleInfo.h"
23 #include "llvm/CodeGen/ValueTypes.h"
24 #include "llvm/Support/Compiler.h"
28 class MachineJumpTableInfo;
34 class VISIBILITY_HIDDEN X86AsmPrinter : public AsmPrinter {
35 const X86Subtarget *Subtarget;
37 explicit X86AsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
38 : AsmPrinter(TM, Streamer) {
39 Subtarget = &TM.getSubtarget<X86Subtarget>();
42 virtual const char *getPassName() const {
43 return "X86 AT&T-Style Assembly Printer";
46 const X86Subtarget &getSubtarget() const { return *Subtarget; }
48 virtual void EmitStartOfAsmFile(Module &M);
50 virtual void EmitEndOfAsmFile(Module &M);
52 virtual void EmitInstruction(const MachineInstr *MI);
54 void printSymbolOperand(const MachineOperand &MO, raw_ostream &O);
56 // These methods are used by the tablegen'erated instruction printer.
57 void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
58 const char *Modifier = 0);
59 void print_pcrel_imm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
61 bool printAsmMRegister(const MachineOperand &MO, char Mode, raw_ostream &O);
62 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
63 unsigned AsmVariant, const char *ExtraCode,
65 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
66 unsigned AsmVariant, const char *ExtraCode,
69 void printMachineInstruction(const MachineInstr *MI);
70 void printSSECC(const MachineInstr *MI, unsigned Op, raw_ostream &O);
71 void printMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
72 const char *Modifier=NULL);
73 void printLeaMemReference(const MachineInstr *MI, unsigned Op, raw_ostream &O,
74 const char *Modifier=NULL);
76 void printPICLabel(const MachineInstr *MI, unsigned Op, raw_ostream &O);
78 void PrintPICBaseSymbol(raw_ostream &O) const;
80 bool runOnMachineFunction(MachineFunction &F);
82 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
85 } // end namespace llvm