mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-19 22:21:32 +08:00
i386.md (sibcall_memory): Check that register with callee address is not also used as one of the arguments...
* config/i386/i386.md (sibcall_memory): Check that register with callee address is not also used as one of the arguments, instead of checking that it is not live after the sibcall. (sibcall_pop_memory): Ditto. (sibcall_value_memory): Ditto. (sibcall_value_pop_memory): Ditto. testsuite: * gcc.target/i386/sibcall-7.c: New test. * gcc.target/i386/sibcall-8.c: New test. From-SVN: r223201
This commit is contained in:
parent
aea417d748
commit
f226d22967
@ -1,3 +1,12 @@
|
||||
2015-05-14 Alexander Monakov <amonakov@ispras.ru>
|
||||
|
||||
* config/i386/i386.md (sibcall_memory): Check that register with
|
||||
callee address is not also used as one of the arguments, instead
|
||||
of checking that it is not live after the sibcall.
|
||||
(sibcall_pop_memory): Ditto.
|
||||
(sibcall_value_memory): Ditto.
|
||||
(sibcall_value_pop_memory): Ditto.
|
||||
|
||||
2015-05-14 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* generic-match-head.c (types_match): Handle non-types.
|
||||
|
@ -11680,7 +11680,8 @@
|
||||
(call (mem:QI (match_dup 0))
|
||||
(match_operand 3))]
|
||||
"!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1))
|
||||
&& peep2_reg_dead_p (2, operands[0])"
|
||||
&& !reg_mentioned_p (operands[0],
|
||||
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
|
||||
[(parallel [(call (mem:QI (match_dup 1))
|
||||
(match_dup 3))
|
||||
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])])
|
||||
@ -11692,7 +11693,8 @@
|
||||
(call (mem:QI (match_dup 0))
|
||||
(match_operand 3))]
|
||||
"!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2))
|
||||
&& peep2_reg_dead_p (3, operands[0])"
|
||||
&& !reg_mentioned_p (operands[0],
|
||||
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
|
||||
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
|
||||
(parallel [(call (mem:QI (match_dup 1))
|
||||
(match_dup 3))
|
||||
@ -11751,7 +11753,8 @@
|
||||
(plus:SI (reg:SI SP_REG)
|
||||
(match_operand:SI 4 "immediate_operand")))])]
|
||||
"!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1))
|
||||
&& peep2_reg_dead_p (2, operands[0])"
|
||||
&& !reg_mentioned_p (operands[0],
|
||||
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
|
||||
[(parallel [(call (mem:QI (match_dup 1))
|
||||
(match_dup 3))
|
||||
(set (reg:SI SP_REG)
|
||||
@ -11769,7 +11772,8 @@
|
||||
(plus:SI (reg:SI SP_REG)
|
||||
(match_operand:SI 4 "immediate_operand")))])]
|
||||
"!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2))
|
||||
&& peep2_reg_dead_p (3, operands[0])"
|
||||
&& !reg_mentioned_p (operands[0],
|
||||
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
|
||||
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
|
||||
(parallel [(call (mem:QI (match_dup 1))
|
||||
(match_dup 3))
|
||||
@ -11845,7 +11849,8 @@
|
||||
(call (mem:QI (match_dup 0))
|
||||
(match_operand 3)))]
|
||||
"!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1))
|
||||
&& peep2_reg_dead_p (2, operands[0])"
|
||||
&& !reg_mentioned_p (operands[0],
|
||||
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
|
||||
[(parallel [(set (match_dup 2)
|
||||
(call (mem:QI (match_dup 1))
|
||||
(match_dup 3)))
|
||||
@ -11859,7 +11864,8 @@
|
||||
(call (mem:QI (match_dup 0))
|
||||
(match_operand 3)))]
|
||||
"!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2))
|
||||
&& peep2_reg_dead_p (3, operands[0])"
|
||||
&& !reg_mentioned_p (operands[0],
|
||||
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
|
||||
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
|
||||
(parallel [(set (match_dup 2)
|
||||
(call (mem:QI (match_dup 1))
|
||||
@ -11924,7 +11930,8 @@
|
||||
(plus:SI (reg:SI SP_REG)
|
||||
(match_operand:SI 4 "immediate_operand")))])]
|
||||
"!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1))
|
||||
&& peep2_reg_dead_p (2, operands[0])"
|
||||
&& !reg_mentioned_p (operands[0],
|
||||
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
|
||||
[(parallel [(set (match_dup 2)
|
||||
(call (mem:QI (match_dup 1))
|
||||
(match_dup 3)))
|
||||
@ -11944,7 +11951,8 @@
|
||||
(plus:SI (reg:SI SP_REG)
|
||||
(match_operand:SI 4 "immediate_operand")))])]
|
||||
"!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2))
|
||||
&& peep2_reg_dead_p (3, operands[0])"
|
||||
&& !reg_mentioned_p (operands[0],
|
||||
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
|
||||
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
|
||||
(parallel [(set (match_dup 2)
|
||||
(call (mem:QI (match_dup 1))
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-05-14 Alexander Monakov <amonakov@ispras.ru>
|
||||
|
||||
* gcc.target/i386/sibcall-7.c: New test.
|
||||
* gcc.target/i386/sibcall-8.c: New test.
|
||||
|
||||
2015-05-14 Wilco Dijkstra <wdijkstr@arm.com>
|
||||
|
||||
* gcc.target/aarch64/abs_1.c (abs64): Update test for new abs expansion.
|
||||
@ -97,7 +102,7 @@
|
||||
PR tree-optimization/37021
|
||||
* gcc.target/i386/vect-addsub.c: New testcase.
|
||||
|
||||
2015-05-11 Alexander Monakov <amonakov@ispras.ru>
|
||||
2015-05-12 Alexander Monakov <amonakov@ispras.ru>
|
||||
|
||||
* gcc.target/i386/pr65753.c: Use -O2 instead of -O.
|
||||
|
||||
|
10
gcc/testsuite/gcc.target/i386/sibcall-7.c
Normal file
10
gcc/testsuite/gcc.target/i386/sibcall-7.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* { dg-do compile { target { ! x32 } } } */
|
||||
/* { dg-options "-O2" } */
|
||||
/* { dg-final { scan-assembler-not "mov" } } */
|
||||
|
||||
int foo()
|
||||
{
|
||||
int (**bar)(void);
|
||||
asm("":"=a"(bar));
|
||||
return (*bar)();
|
||||
}
|
24
gcc/testsuite/gcc.target/i386/sibcall-8.c
Normal file
24
gcc/testsuite/gcc.target/i386/sibcall-8.c
Normal file
@ -0,0 +1,24 @@
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
static int __attribute__((regparm(1)))
|
||||
bar(void *arg)
|
||||
{
|
||||
return arg != bar;
|
||||
}
|
||||
|
||||
static int __attribute__((noinline,noclone,regparm(1)))
|
||||
foo(int (__attribute__((regparm(1))) **bar)(void*))
|
||||
{
|
||||
return (*bar)(*bar);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int (__attribute__((regparm(1))) *p)(void*) = bar;
|
||||
if (foo(&p))
|
||||
abort();
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user