]> granicus.if.org Git - clang/commitdiff
lib/CodeGen/TargetInfo.cpp: On Win64, arg i128 should be emitted as INDIRECT.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 22 Feb 2011 03:56:57 +0000 (03:56 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 22 Feb 2011 03:56:57 +0000 (03:56 +0000)
mingw-w64's i128 tweak should be done with x86_64-mingw32.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126186 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetInfo.cpp

index d74b3f32d954b2b521328782efe3e44da6f9830a..2ffc840b9f9214688a137c32fdb7162eee9b5861 100644 (file)
@@ -2105,8 +2105,15 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty) const {
         RT->getDecl()->hasFlexibleArrayMember())
       return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
 
-    // FIXME: mingw64-gcc emits 128-bit struct as i128
-    if (Size <= 128 &&
+    // FIXME: mingw-w64-gcc emits 128-bit struct as i128
+    if (Size == 128 &&
+        getContext().Target.getTriple().getOS() == llvm::Triple::MinGW32)
+      return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(),
+                                                          Size));
+
+    // MS x64 ABI requirement: "Any argument that doesn't fit in 8 bytes, or is
+    // not 1, 2, 4, or 8 bytes, must be passed by reference."
+    if (Size <= 64 &&
         (Size & (Size - 1)) == 0)
       return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(),
                                                           Size));