move mangler quote handling from asm printers to TargetAsmInfo.
[oota-llvm.git] / lib / Target / X86 / AsmPrinter / X86ATTAsmPrinter.h
index f9479fd41d47563107384c1df3829dd11f4a2425..547d29b8475a734be36e04f70e3497510f52cb54 100644 (file)
@@ -14,9 +14,9 @@
 #ifndef X86ATTASMPRINTER_H
 #define X86ATTASMPRINTER_H
 
-#include "X86.h"
-#include "X86MachineFunctionInfo.h"
-#include "X86TargetMachine.h"
+#include "../X86.h"
+#include "../X86MachineFunctionInfo.h"
+#include "../X86TargetMachine.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/DwarfWriter.h"
 
 namespace llvm {
 
-struct MachineJumpTableInfo;
+class MachineJumpTableInfo;
 
-struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
-  DwarfWriter DW;
+class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
+  DwarfWriter *DW;
   MachineModuleInfo *MMI;
-
   const X86Subtarget *Subtarget;
-
-  X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM,
-                   const TargetAsmInfo *T)
-    : AsmPrinter(O, TM, T), DW(O, this, T), MMI(0) {
+ public:
+  explicit X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM,
+                            const TargetAsmInfo *T, CodeGenOpt::Level OL,
+                            bool V)
+    : AsmPrinter(O, TM, T, OL, V), DW(0), MMI(0) {
     Subtarget = &TM.getSubtarget<X86Subtarget>();
   }
 
@@ -51,6 +51,7 @@ struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
         Subtarget->isTargetCygMing()) {
       AU.addRequired<MachineModuleInfo>();
     }
+    AU.addRequired<DwarfWriter>();
     AsmPrinter::getAnalysisUsage(AU);
   }
 
@@ -93,11 +94,17 @@ struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
   void printf128mem(const MachineInstr *MI, unsigned OpNo) {
     printMemReference(MI, OpNo);
   }
+  void printlea32mem(const MachineInstr *MI, unsigned OpNo) {
+    printLeaMemReference(MI, OpNo);
+  }
+  void printlea64mem(const MachineInstr *MI, unsigned OpNo) {
+    printLeaMemReference(MI, OpNo);
+  }
   void printlea64_32mem(const MachineInstr *MI, unsigned OpNo) {
-    printMemReference(MI, OpNo, "subreg64");
+    printLeaMemReference(MI, OpNo, "subreg64");
   }
 
-  bool printAsmMRegister(const MachineOperand &MO, const char Mode);
+  bool printAsmMRegister(const MachineOperand &MO, char Mode);
   bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
                        unsigned AsmVariant, const char *ExtraCode);
   bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
@@ -106,7 +113,9 @@ struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
   void printMachineInstruction(const MachineInstr *MI);
   void printSSECC(const MachineInstr *MI, unsigned Op);
   void printMemReference(const MachineInstr *MI, unsigned Op,
-                         const char *Modifier=NULL);
+                         const char *Modifier=NULL, bool NotRIPRel = false);
+  void printLeaMemReference(const MachineInstr *MI, unsigned Op,
+                            const char *Modifier=NULL, bool NotRIPRel = false);
   void printPICJumpTableSetLabel(unsigned uid,
                                  const MachineBasicBlock *MBB) const;
   void printPICJumpTableSetLabel(unsigned uid, unsigned uid2,
@@ -121,17 +130,14 @@ struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
   void printModuleLevelGV(const GlobalVariable* GVar);
 
   void printGVStub(const char *GV, const char *Prefix = NULL);
+  void printHiddenGVStub(const char *GV, const char *Prefix = NULL);
 
   bool runOnMachineFunction(MachineFunction &F);
 
-  /// getSectionForFunction - Return the section that we should emit the
-  /// specified function body into.
-  virtual std::string getSectionForFunction(const Function &F) const;
-
   void emitFunctionHeader(const MachineFunction &MF);
 
   // Necessary for Darwin to print out the apprioriate types of linker stubs
-  StringSet<> FnStubs, GVStubs, LinkOnceStubs;
+  StringSet<> FnStubs, GVStubs, HiddenGVStubs;
 
   // Necessary for dllexport support
   StringSet<> DLLExportedFns, DLLExportedGVs;