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"
29 class LLVM_LIBRARY_VISIBILITY X86AsmPrinter
: public AsmPrinter
{
30 const X86Subtarget
*Subtarget
;
32 explicit X86AsmPrinter(TargetMachine
&TM
, MCStreamer
&Streamer
)
33 : AsmPrinter(TM
, Streamer
) {
34 Subtarget
= &TM
.getSubtarget
<X86Subtarget
>();
37 virtual const char *getPassName() const {
38 return "X86 AT&T-Style Assembly Printer";
41 const X86Subtarget
&getSubtarget() const { return *Subtarget
; }
43 virtual void EmitStartOfAsmFile(Module
&M
);
45 virtual void EmitEndOfAsmFile(Module
&M
);
47 virtual void EmitInstruction(const MachineInstr
*MI
);
49 void printSymbolOperand(const MachineOperand
&MO
, raw_ostream
&O
);
51 // These methods are used by the tablegen'erated instruction printer.
52 void printOperand(const MachineInstr
*MI
, unsigned OpNo
, raw_ostream
&O
,
53 const char *Modifier
= 0, unsigned AsmVariant
= 0);
54 void printPCRelImm(const MachineInstr
*MI
, unsigned OpNo
, raw_ostream
&O
);
56 bool printAsmMRegister(const MachineOperand
&MO
, char Mode
, raw_ostream
&O
);
57 bool PrintAsmOperand(const MachineInstr
*MI
, unsigned OpNo
,
58 unsigned AsmVariant
, const char *ExtraCode
,
60 bool PrintAsmMemoryOperand(const MachineInstr
*MI
, unsigned OpNo
,
61 unsigned AsmVariant
, const char *ExtraCode
,
64 void printMachineInstruction(const MachineInstr
*MI
);
65 void printSSECC(const MachineInstr
*MI
, unsigned Op
, raw_ostream
&O
);
66 void printMemReference(const MachineInstr
*MI
, unsigned Op
, raw_ostream
&O
,
67 const char *Modifier
=NULL
);
68 void printLeaMemReference(const MachineInstr
*MI
, unsigned Op
, raw_ostream
&O
,
69 const char *Modifier
=NULL
);
71 void printPICLabel(const MachineInstr
*MI
, unsigned Op
, raw_ostream
&O
);
73 bool runOnMachineFunction(MachineFunction
&F
);
75 void PrintDebugValueComment(const MachineInstr
*MI
, raw_ostream
&OS
);
76 void PrintGCRegRootComment(const MachineInstr
*MI
, raw_ostream
&OS
);
78 MachineLocation
getDebugValueLocation(const MachineInstr
*MI
) const;
81 } // end namespace llvm