[llvm] r197163 - Switch to the new MingW ABI.

Rafael Espindola rafael.espindola at gmail.com
Thu Dec 12 08:06:58 PST 2013


Author: rafael
Date: Thu Dec 12 10:06:58 2013
New Revision: 197163

URL: http://llvm.org/viewvc/llvm-project?rev=197163&view=rev
Log:
Switch to the new MingW ABI.

GCC 4.7 changed the MingW ABI. On the LLVM side it means that sret functions
don't pop the stack.

Modified:
    llvm/trunk/lib/Target/X86/X86FastISel.cpp
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
    llvm/trunk/test/CodeGen/X86/win32_sret.ll

Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=197163&r1=197162&r2=197163&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Dec 12 10:06:58 2013
@@ -1863,7 +1863,7 @@ static unsigned computeBytesPoppedByCall
                                            const ImmutableCallSite &CS) {
   if (Subtarget.is64Bit())
     return 0;
-  if (Subtarget.isTargetWindows())
+  if (Subtarget.getTargetTriple().isOSMSVCRT())
     return 0;
   CallingConv::ID CC = CS.getCallingConv();
   if (CC == CallingConv::Fast || CC == CallingConv::GHC)

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=197163&r1=197162&r2=197163&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Dec 12 10:06:58 2013
@@ -2175,7 +2175,6 @@ X86TargetLowering::LowerFormalArguments(
 
   MachineFrameInfo *MFI = MF.getFrameInfo();
   bool Is64Bit = Subtarget->is64Bit();
-  bool IsWindows = Subtarget->isTargetWindows();
   bool IsWin64 = Subtarget->isCallingConvWin64(CallConv);
 
   assert(!(isVarArg && IsTailCallConvention(CallConv)) &&
@@ -2420,7 +2419,8 @@ X86TargetLowering::LowerFormalArguments(
   } else {
     FuncInfo->setBytesToPopOnReturn(0); // Callee pops nothing.
     // If this is an sret function, the return should pop the hidden pointer.
-    if (!Is64Bit && !IsTailCallConvention(CallConv) && !IsWindows &&
+    if (!Is64Bit && !IsTailCallConvention(CallConv) &&
+        !Subtarget->getTargetTriple().isOSMSVCRT() &&
         argsAreStructReturn(Ins) == StackStructReturn)
       FuncInfo->setBytesToPopOnReturn(4);
   }
@@ -2509,7 +2509,6 @@ X86TargetLowering::LowerCall(TargetLower
   MachineFunction &MF = DAG.getMachineFunction();
   bool Is64Bit        = Subtarget->is64Bit();
   bool IsWin64        = Subtarget->isCallingConvWin64(CallConv);
-  bool IsWindows      = Subtarget->isTargetWindows();
   StructReturnType SR = callIsStructReturn(Outs);
   bool IsSibcall      = false;
 
@@ -2903,7 +2902,8 @@ X86TargetLowering::LowerCall(TargetLower
   if (X86::isCalleePop(CallConv, Is64Bit, isVarArg,
                        getTargetMachine().Options.GuaranteedTailCallOpt))
     NumBytesForCalleeToPush = NumBytes;    // Callee pops everything
-  else if (!Is64Bit && !IsTailCallConvention(CallConv) && !IsWindows &&
+  else if (!Is64Bit && !IsTailCallConvention(CallConv) &&
+           !Subtarget->getTargetTriple().isOSMSVCRT() &&
            SR == StackStructReturn)
     // If this is a call to a struct-return function, the callee
     // pops the hidden struct pointer, so we have to push it back.

Modified: llvm/trunk/test/CodeGen/X86/win32_sret.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win32_sret.ll?rev=197163&r1=197162&r2=197163&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/win32_sret.ll (original)
+++ llvm/trunk/test/CodeGen/X86/win32_sret.ll Thu Dec 12 10:06:58 2013
@@ -19,7 +19,7 @@ entry:
 ; WIN32:    {{ret$}}
 
 ; MINGW_X86-LABEL:  _sret1:
-; MINGW_X86:  ret $4
+; MINGW_X86:  {{ret$}}
 
 ; LINUX-LABEL:      sret1:
 ; LINUX:      ret $4
@@ -36,7 +36,7 @@ entry:
 ; WIN32:    {{ret$}}
 
 ; MINGW_X86-LABEL:  _sret2:
-; MINGW_X86:  ret $4
+; MINGW_X86:  {{ret$}}
 
 ; LINUX-LABEL:      sret2:
 ; LINUX:      ret $4
@@ -54,7 +54,7 @@ entry:
 ; WIN32:    {{ret$}}
 
 ; MINGW_X86-LABEL:  _sret3:
-; MINGW_X86:  ret $4
+; MINGW_X86:  {{ret$}}
 
 ; LINUX-LABEL:      sret3:
 ; LINUX:      ret $4
@@ -75,7 +75,7 @@ entry:
 ; WIN32:   {{ret$}}
 
 ; MINGW_X86-LABEL: _sret4:
-; MINGW_X86: ret $4
+; MINGW_X86: {{ret$}}
 
 ; LINUX-LABEL:     sret4:
 ; LINUX:     ret $4





More information about the llvm-commits mailing list