Make intel asmprinter child of generic asmprinter, not x86 shared asm printer. This...
[oota-llvm.git] / lib / Target / X86 / X86IntelAsmPrinter.h
index 2a10e1c9b71c549cd469d9137d6b9f862f084964..ea1e9a7605650dcf9d3d41b07791565261e731a1 100644 (file)
 #ifndef X86INTELASMPRINTER_H
 #define X86INTELASMPRINTER_H
 
-#include "X86AsmPrinter.h"
-#include "llvm/CodeGen/ValueTypes.h"
-#include "llvm/Target/TargetRegisterInfo.h"
+#include "X86.h"
+#include "X86MachineFunctionInfo.h"
+#include "X86TargetMachine.h"
+#include "llvm/CodeGen/AsmPrinter.h"
+#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
-struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public X86SharedAsmPrinter {
+struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public AsmPrinter {
   X86IntelAsmPrinter(std::ostream &O, X86TargetMachine &TM,
                      const TargetAsmInfo *T)
-      : X86SharedAsmPrinter(O, TM, T) {
+      : AsmPrinter(O, TM, T) {
   }
 
   virtual const char *getPassName() const {
@@ -110,12 +113,31 @@ struct VISIBILITY_HIDDEN X86IntelAsmPrinter : public X86SharedAsmPrinter {
   bool runOnMachineFunction(MachineFunction &F);
   bool doInitialization(Module &M);
   bool doFinalization(Module &M);
-  
+
+  // We have to propagate some information about MachineFunction to
+  // AsmPrinter. It's ok, when we're printing the function, since we have
+  // access to MachineFunction and can get the appropriate MachineFunctionInfo.
+  // Unfortunately, this is not possible when we're printing reference to
+  // Function (e.g. calling it and so on). Even more, there is no way to get the
+  // corresponding MachineFunctions: it can even be not created at all. That's
+  // why we should use additional structure, when we're collecting all necessary
+  // information.
+  //
+  // This structure is using e.g. for name decoration for stdcall & fastcall'ed
+  // function, since we have to use arguments' size for decoration.
+  typedef std::map<const Function*, X86MachineFunctionInfo> FMFInfoMap;
+  FMFInfoMap FunctionInfoMap;
+
+  void decorateName(std::string& Name, const GlobalValue* GV);
+
   /// getSectionForFunction - Return the section that we should emit the
   /// specified function body into.
   virtual std::string getSectionForFunction(const Function &F) const;
 
   virtual void EmitString(const ConstantArray *CVA) const;
+
+  // Necessary for dllexport support
+  StringSet<> DLLExportedFns, DLLExportedGVs;
 };
 
 } // end namespace llvm