remove a dead bool.
[llvm/avr.git] / lib / Target / X86 / AsmPrinter / X86ATTAsmPrinter.h
blob12c3d1168e9974d0961a790280039127b4df76b5
1 //===-- X86ATTAsmPrinter.h - Convert X86 LLVM code to AT&T assembly -------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // AT&T assembly code printer class.
12 //===----------------------------------------------------------------------===//
14 #ifndef X86ATTASMPRINTER_H
15 #define X86ATTASMPRINTER_H
17 #include "../X86.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"
27 namespace llvm {
29 class MachineJumpTableInfo;
30 class MCContext;
31 class MCInst;
32 class MCStreamer;
33 class MCSymbol;
35 class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
36 const X86Subtarget *Subtarget;
37 public:
38 explicit X86ATTAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
39 const MCAsmInfo *T, bool V)
40 : AsmPrinter(O, TM, T, V) {
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 {
51 AU.setPreservesAll();
52 if (Subtarget->isTargetDarwin() ||
53 Subtarget->isTargetELF() ||
54 Subtarget->isTargetCygMing()) {
55 AU.addRequired<MachineModuleInfo>();
57 AU.addRequired<DwarfWriter>();
58 AsmPrinter::getAnalysisUsage(AU);
61 bool doFinalization(Module &M);
63 void printInstructionThroughMCStreamer(const MachineInstr *MI);
66 // FIXME: REMOVE.
67 virtual void printMCInst(const MCInst *MI);
69 void printSymbolOperand(const MachineOperand &MO);
73 // These methods are used by the tablegen'erated instruction printer.
74 void printOperand(const MachineInstr *MI, unsigned OpNo,
75 const char *Modifier = 0);
76 void print_pcrel_imm(const MachineInstr *MI, unsigned OpNo);
78 void printopaquemem(const MachineInstr *MI, unsigned OpNo) {
79 printMemReference(MI, OpNo);
82 void printi8mem(const MachineInstr *MI, unsigned OpNo) {
83 printMemReference(MI, OpNo);
85 void printi16mem(const MachineInstr *MI, unsigned OpNo) {
86 printMemReference(MI, OpNo);
88 void printi32mem(const MachineInstr *MI, unsigned OpNo) {
89 printMemReference(MI, OpNo);
91 void printi64mem(const MachineInstr *MI, unsigned OpNo) {
92 printMemReference(MI, OpNo);
94 void printi128mem(const MachineInstr *MI, unsigned OpNo) {
95 printMemReference(MI, OpNo);
97 void printi256mem(const MachineInstr *MI, unsigned OpNo) {
98 printMemReference(MI, OpNo);
100 void printf32mem(const MachineInstr *MI, unsigned OpNo) {
101 printMemReference(MI, OpNo);
103 void printf64mem(const MachineInstr *MI, unsigned OpNo) {
104 printMemReference(MI, OpNo);
106 void printf80mem(const MachineInstr *MI, unsigned OpNo) {
107 printMemReference(MI, OpNo);
109 void printf128mem(const MachineInstr *MI, unsigned OpNo) {
110 printMemReference(MI, OpNo);
112 void printf256mem(const MachineInstr *MI, unsigned OpNo) {
113 printMemReference(MI, OpNo);
115 void printlea32mem(const MachineInstr *MI, unsigned OpNo) {
116 printLeaMemReference(MI, OpNo);
118 void printlea64mem(const MachineInstr *MI, unsigned OpNo) {
119 printLeaMemReference(MI, OpNo);
121 void printlea64_32mem(const MachineInstr *MI, unsigned OpNo) {
122 printLeaMemReference(MI, OpNo, "subreg64");
125 bool printAsmMRegister(const MachineOperand &MO, char Mode);
126 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
127 unsigned AsmVariant, const char *ExtraCode);
128 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
129 unsigned AsmVariant, const char *ExtraCode);
131 void printMachineInstruction(const MachineInstr *MI);
132 void printSSECC(const MachineInstr *MI, unsigned Op);
133 void printMemReference(const MachineInstr *MI, unsigned Op,
134 const char *Modifier=NULL);
135 void printLeaMemReference(const MachineInstr *MI, unsigned Op,
136 const char *Modifier=NULL);
137 void printPICJumpTableSetLabel(unsigned uid,
138 const MachineBasicBlock *MBB) const;
139 void printPICJumpTableSetLabel(unsigned uid, unsigned uid2,
140 const MachineBasicBlock *MBB) const {
141 AsmPrinter::printPICJumpTableSetLabel(uid, uid2, MBB);
143 void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
144 const MachineBasicBlock *MBB,
145 unsigned uid) const;
147 void printPICLabel(const MachineInstr *MI, unsigned Op);
148 void PrintGlobalVariable(const GlobalVariable* GVar);
150 void PrintPICBaseSymbol() const;
152 bool runOnMachineFunction(MachineFunction &F);
154 void emitFunctionHeader(const MachineFunction &MF);
156 // Necessary for Darwin to print out the appropriate types of linker stubs.
157 DenseMap<MCSymbol*, MCSymbol*> FnStubs; // Darwin $stub stubs.
158 DenseMap<MCSymbol*, MCSymbol*> GVStubs; // Darwin $non_lazy_ptr stub.
159 DenseMap<MCSymbol*, MCSymbol*> HiddenGVStubs; // Darwin $non_lazy_ptr stub.
161 // Necessary for dllexport support
162 StringSet<> CygMingStubs, DLLExportedFns, DLLExportedGVs;
164 // We have to propagate some information about MachineFunction to
165 // AsmPrinter. It's ok, when we're printing the function, since we have
166 // access to MachineFunction and can get the appropriate MachineFunctionInfo.
167 // Unfortunately, this is not possible when we're printing reference to
168 // Function (e.g. calling it and so on). Even more, there is no way to get the
169 // corresponding MachineFunctions: it can even be not created at all. That's
170 // why we should use additional structure, when we're collecting all necessary
171 // information.
173 // This structure is using e.g. for name decoration for stdcall & fastcall'ed
174 // function, since we have to use arguments' size for decoration.
175 typedef std::map<const Function*, X86MachineFunctionInfo> FMFInfoMap;
176 FMFInfoMap FunctionInfoMap;
178 void DecorateCygMingName(std::string &Name, const GlobalValue *GV);
179 void DecorateCygMingName(SmallVectorImpl<char> &Name, const GlobalValue *GV);
182 } // end namespace llvm
184 #endif