Change x86_fastcallcc to require inreg markers. This allows it to known
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 24 Oct 2012 01:58:48 +0000 (01:58 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 24 Oct 2012 01:58:48 +0000 (01:58 +0000)
the difference from "int x" (which should go in registers and
"struct y {int x;}" (which should not).

Clang will be updated in the next patches.

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

lib/Target/X86/X86CallingConv.td
test/CodeGen/X86/fast-cc-callee-pops.ll
test/CodeGen/X86/fast-cc-merge-stack-adj.ll
test/CodeGen/X86/fast-cc-pass-in-regs.ll

index a6d2709b372d442f345161ef874135c634d8bca3..c881b4d0ad3dc14663b8c936115817f9e62415f0 100644 (file)
@@ -324,7 +324,7 @@ def CC_X86_32_FastCall : CallingConv<[
   CCIfNest<CCAssignToReg<[EAX]>>,
 
   // The first 2 integer arguments are passed in ECX/EDX
-  CCIfType<[i32], CCAssignToReg<[ECX, EDX]>>,
+  CCIfInReg<CCIfType<[i32], CCAssignToReg<[ECX, EDX]>>>,
 
   // Otherwise, same as everything else.
   CCDelegateTo<CC_X86_32_Common>
index ea10897c735748b69530d297f3cb09ed702a2158..2c5b80ac4af07528707718dc9192002845c61591 100644 (file)
@@ -2,12 +2,12 @@
 
 ; Check that a fastcc function pops its stack variables before returning.
 
-define x86_fastcallcc void @func(i64 %X, i64 %Y, float %G, double %Z) nounwind {
+define x86_fastcallcc void @func(i64 inreg %X, i64 %Y, float %G, double %Z) nounwind {
         ret void
 ; CHECK: ret{{.*}}20
 }
 
-define x86_thiscallcc void @func2(i32 %X, i64 %Y, float %G, double %Z) nounwind {
+define x86_thiscallcc void @func2(i32 inreg %X, i64 %Y, float %G, double %Z) nounwind {
         ret void
 ; CHECK: ret{{.*}}20
 }
index 14cb136f89de6c535d56b405be24eb5cece21840..d591f9408b140c38ee0ea065ec8f06afbafd8ac4 100644 (file)
@@ -3,7 +3,7 @@
 
 target triple = "i686-pc-linux-gnu"
 
-declare x86_fastcallcc void @func(i32*, i64)
+declare x86_fastcallcc void @func(i32*, i64 inreg)
 
 define x86_fastcallcc void @caller(i32, i64) {
         %X = alloca i32         ; <i32*> [#uses=1]
index a96e5043fed4eecc79a21dcd2f5f7240eccccd7f..b60b68bd388da42e4ee28597ee7d9b6853cfb90c 100644 (file)
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -march=x86 -x86-asm-syntax=intel | FileCheck %s
 ; check that fastcc is passing stuff in regs.
 
-declare x86_fastcallcc i64 @callee(i64)
+declare x86_fastcallcc i64 @callee(i64 inreg)
 
 define i64 @caller() {
         %X = call x86_fastcallcc  i64 @callee( i64 4294967299 )          ; <i64> [#uses=1]
@@ -9,7 +9,7 @@ define i64 @caller() {
         ret i64 %X
 }
 
-define x86_fastcallcc i64 @caller2(i64 %X) {
+define x86_fastcallcc i64 @caller2(i64 inreg %X) {
         ret i64 %X
 ; CHECK: mov{{.*}}EAX, ECX
 }