[llvm-branch-commits] [cfe-branch] r324718 - Merging r324594:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Feb 9 01:01:30 PST 2018
Author: hans
Date: Fri Feb 9 01:01:30 2018
New Revision: 324718
URL: http://llvm.org/viewvc/llvm-project?rev=324718&view=rev
Log:
Merging r324594:
------------------------------------------------------------------------
r324594 | aivchenk | 2018-02-08 12:15:21 +0100 (Thu, 08 Feb 2018) | 17 lines
Fix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.
Summary:
This patch is a fix for following issue:
https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by front end
lowering C calling conventions without taking into account calling conventions
enforced by attribute. In this case win64cc was no correctly lowered on targets
other than Windows.
Reviewed By: rnk (Reid Kleckner)
Differential Revision: https://reviews.llvm.org/D43016
Author: belickim <mateusz.belicki at intel.com>
------------------------------------------------------------------------
Modified:
cfe/branches/release_60/ (props changed)
cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp
cfe/branches/release_60/test/CodeGen/ms_abi.c
Propchange: cfe/branches/release_60/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 9 01:01:30 2018
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123,323155,323360,323485,323904,323935,324059,324134,324246,324419,324439,324514
+/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123,323155,323360,323485,323904,323935,324059,324134,324246,324419,324439,324514,324594
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp?rev=324718&r1=324717&r2=324718&view=diff
==============================================================================
--- cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp Fri Feb 9 01:01:30 2018
@@ -3543,7 +3543,17 @@ ABIArgInfo X86_64ABIInfo::classifyRegCal
void X86_64ABIInfo::computeInfo(CGFunctionInfo &FI) const {
- bool IsRegCall = FI.getCallingConvention() == llvm::CallingConv::X86_RegCall;
+ const unsigned CallingConv = FI.getCallingConvention();
+ // It is possible to force Win64 calling convention on any x86_64 target by
+ // using __attribute__((ms_abi)). In such case to correctly emit Win64
+ // compatible code delegate this call to WinX86_64ABIInfo::computeInfo.
+ if (CallingConv == llvm::CallingConv::Win64) {
+ WinX86_64ABIInfo Win64ABIInfo(CGT);
+ Win64ABIInfo.computeInfo(FI);
+ return;
+ }
+
+ bool IsRegCall = CallingConv == llvm::CallingConv::X86_RegCall;
// Keep track of the number of assigned registers.
unsigned FreeIntRegs = IsRegCall ? 11 : 6;
Modified: cfe/branches/release_60/test/CodeGen/ms_abi.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/test/CodeGen/ms_abi.c?rev=324718&r1=324717&r2=324718&view=diff
==============================================================================
--- cfe/branches/release_60/test/CodeGen/ms_abi.c (original)
+++ cfe/branches/release_60/test/CodeGen/ms_abi.c Fri Feb 9 01:01:30 2018
@@ -146,3 +146,16 @@ void __attribute__((sysv_abi)) f6(__buil
// WIN64: %[[AP_VAL:.*]] = load i8*, i8** %[[AP]]
// WIN64-NEXT: store i8* %[[AP_VAL]], i8** %[[AP2:.*]]
}
+
+// This test checks if structs are passed according to Win64 calling convention
+// when it's enforced by __attribute((ms_abi)).
+struct i128 {
+ unsigned long long a;
+ unsigned long long b;
+};
+
+__attribute__((ms_abi)) struct i128 f7(struct i128 a) {
+ // WIN64: define void @f7(%struct.i128* noalias sret %agg.result, %struct.i128* %a)
+ // FREEBSD: define win64cc void @f7(%struct.i128* noalias sret %agg.result, %struct.i128* %a)
+ return a;
+}
More information about the llvm-branch-commits
mailing list