[llvm-commits] [llvm] r75744 - in /llvm/trunk/lib/Target/X86/AsmPrinter: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h

Chris Lattner sabre at nondot.org
Tue Jul 14 21:55:56 PDT 2009


Author: lattner
Date: Tue Jul 14 23:55:56 2009
New Revision: 75744

URL: http://llvm.org/viewvc/llvm-project?rev=75744&view=rev
Log:
rename decorateName -> DecorateCygMingName, make it assert if not
cygming, make the two callers only call it if cygming.  Other minor
cleanups.

Modified:
    llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
    llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h

Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=75744&r1=75743&r2=75744&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Jul 14 23:55:56 2009
@@ -102,15 +102,17 @@
   return Info;
 }
 
-/// decorateName - Query FunctionInfoMap and use this information for various
-/// name decoration.
-void X86ATTAsmPrinter::decorateName(std::string &Name,
-                                    const GlobalValue *GV) {
+/// DecorateCygMingName - Query FunctionInfoMap and use this information for
+/// various name decorations for Cygwin and MingW.
+void X86ATTAsmPrinter::DecorateCygMingName(std::string &Name,
+                                           const GlobalValue *GV) {
+  assert(Subtarget->isTargetCygMing() && "This is only for cygwin and mingw");
+  
   const Function *F = dyn_cast<Function>(GV);
   if (!F) return;
 
   // Save function name for later type emission.
-  if (Subtarget->isTargetCygMing() && F->isDeclaration())
+  if (F->isDeclaration())
     CygMingStubs.insert(Name);
   
   // We don't want to decorate non-stdcall or non-fastcall functions right now
@@ -118,13 +120,10 @@
   if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall)
     return;
 
-  // Decorate names only when we're targeting Cygwin/Mingw32 targets
-  if (!Subtarget->isTargetCygMing())
-    return;
-
-  FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F);
 
   const X86MachineFunctionInfo *Info;
+  
+  FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F);
   if (info_item == FunctionInfoMap.end()) {
     // Calculate apropriate function info and populate map
     FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData());
@@ -164,7 +163,8 @@
   unsigned FnAlign = MF.getAlignment();
   const Function *F = MF.getFunction();
 
-  decorateName(CurrentFnName, F);
+  if (Subtarget->isTargetCygMing())
+    DecorateCygMingName(CurrentFnName, F);
 
   SwitchToSection(TAI->SectionForGlobal(F));
   switch (F->getLinkage()) {
@@ -316,7 +316,8 @@
       Suffix = "$non_lazy_ptr";
     
     std::string Name = Mang->getMangledName(GV, Suffix, Suffix[0] != '\0');
-    decorateName(Name, GV);
+    if (Subtarget->isTargetCygMing())
+      DecorateCygMingName(Name, GV);
     
     // Handle dllimport linkage.
     if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)

Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=75744&r1=75743&r2=75744&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Tue Jul 14 23:55:56 2009
@@ -219,7 +219,7 @@
   typedef std::map<const Function*, X86MachineFunctionInfo> FMFInfoMap;
   FMFInfoMap FunctionInfoMap;
 
-  void decorateName(std::string& Name, const GlobalValue* GV);
+  void DecorateCygMingName(std::string &Name, const GlobalValue *GV);
 };
 
 } // end namespace llvm





More information about the llvm-commits mailing list