Consistency with native compilers
authorAnton Korobeynikov <asl@math.spbu.ru>
Sat, 31 Mar 2007 13:11:52 +0000 (13:11 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Sat, 31 Mar 2007 13:11:52 +0000 (13:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35532 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86AsmPrinter.cpp

index 81ec50e345ea28b92371fb38bd8ab00abf23fd5c..454bd868c3f9b90f5a8550a10bd172b024dedcfc 100644 (file)
@@ -24,6 +24,7 @@
 #include "llvm/CallingConv.h"
 #include "llvm/Constants.h"
 #include "llvm/Module.h"
+#include "llvm/DerivedTypes.h"
 #include "llvm/Type.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Support/Mangler.h"
@@ -84,16 +85,21 @@ void X86SharedAsmPrinter::decorateName(std::string &Name,
   } else {
     Info = &info_item->second;
   }
-        
+  
+  const FunctionType *FT = F->getFunctionType();
   switch (Info->getDecorationStyle()) {
   case None:
     break;
   case StdCall:
-    if (!F->isVarArg()) // Variadic functions do not receive @0 suffix.
+    // "Pure" variadic functions do not receive @0 suffix.
+    if (!FT->isVarArg() || (FT->getNumParams() == 0) ||
+        (FT->getNumParams() == 1 && FT->isStructReturn())) 
       Name += '@' + utostr_32(Info->getBytesToPopOnReturn());
     break;
   case FastCall:
-    if (!F->isVarArg()) // Variadic functions do not receive @0 suffix.
+    // "Pure" variadic functions do not receive @0 suffix.
+    if (!FT->isVarArg() || (FT->getNumParams() == 0) ||
+        (FT->getNumParams() == 1 && FT->isStructReturn())) 
       Name += '@' + utostr_32(Info->getBytesToPopOnReturn());
 
     if (Name[0] == '_') {