var-tracking.c (track_expr_p): Do not track declarations for parts of tracked parameters.

* var-tracking.c (track_expr_p): Do not track declarations for parts
	of tracked parameters.
	(add_stores): Do not track values for tracked parameters passed in
	multiple locations.
	(vt_get_decl_and_offset): Handle PARALLEL.
	(vt_add_function_parameter): Handle parameters with incoming PARALLEL.

From-SVN: r205461
This commit is contained in:
Eric Botcazou 2013-11-27 21:16:21 +00:00
parent fa788bb403
commit 35af99b462
4 changed files with 129 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2013-11-27 Eric Botcazou <ebotcazou@adacore.com>
* var-tracking.c (track_expr_p): Do not track declarations for parts
of tracked parameters.
(add_stores): Do not track values for tracked parameters passed in
multiple locations.
(vt_get_decl_and_offset): Handle PARALLEL.
(vt_add_function_parameter): Handle parameters with incoming PARALLEL.
2013-11-27 Jeff Law <law@redhat.com>
* tree-ssa-threadupdate.c (thread_through_all_blocks): Do not
@ -11,9 +20,8 @@
2013-11-27 Kenneth Zadeck <zadeck@naturalbridge.com>
* fold-const.c
(int_const_binop_1): Make INT_MIN % -1 return 0 with the overflow
bit set.
* fold-const.c (int_const_binop_1): Make INT_MIN % -1 return 0 with the
overflow bit set.
2013-11-27 Richard Biener <rguenther@suse.de>

View File

@ -1,3 +1,7 @@
2013-11-27 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/guality/param-3.c: New test.
2013-11-27 Uros Bizjak <ubizjak@gmail.com>
Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com>

View File

@ -0,0 +1,33 @@
/* { dg-do run } */
/* { dg-options "-g" } */
/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" "-O1" } } */
typedef __UINTPTR_TYPE__ uintptr_t;
__attribute__((noinline, noclone)) int
sub (int a, int b)
{
return a - b;
}
typedef struct { uintptr_t pa; uintptr_t pb; } fatp_t
__attribute__ ((aligned (2 * __alignof__ (uintptr_t))));
__attribute__((noinline, noclone)) void
foo (fatp_t str, int a, int b)
{
int i = sub (a, b);
if (i == 0) /* BREAK */
foo (str, a - 1, b);
}
int
main (void)
{
fatp_t ptr = { 31415927, 27182818 };
foo (ptr, 1, 2);
return 0;
}
/* { dg-final { gdb-test 20 "str.pa" "31415927" } } */
/* { dg-final { gdb-test 20 "str.pb" "27182818" } } */

View File

@ -5071,6 +5071,11 @@ track_expr_p (tree expr, bool need_rtl)
&maxsize);
if (!DECL_P (innerdecl)
|| DECL_IGNORED_P (innerdecl)
/* Do not track declarations for parts of tracked parameters
since we want to track them as a whole instead. */
|| (TREE_CODE (innerdecl) == PARM_DECL
&& DECL_MODE (innerdecl) != BLKmode
&& TREE_CODE (TREE_TYPE (innerdecl)) != UNION_TYPE)
|| TREE_STATIC (innerdecl)
|| bitsize <= 0
|| bitpos + bitsize > 256
@ -5925,6 +5930,20 @@ add_stores (rtx loc, const_rtx expr, void *cuip)
if (type != MO_VAL_SET)
goto log_and_return;
/* We cannot track values for multiple-part variables, so we track only
locations for tracked parameters passed either by invisible reference
or directly in multiple locations. */
if (track_p
&& REG_P (loc)
&& REG_EXPR (loc)
&& TREE_CODE (REG_EXPR (loc)) == PARM_DECL
&& DECL_MODE (REG_EXPR (loc)) != BLKmode
&& ((MEM_P (DECL_INCOMING_RTL (REG_EXPR (loc)))
&& XEXP (DECL_INCOMING_RTL (REG_EXPR (loc)), 0) != arg_pointer_rtx)
|| (GET_CODE (DECL_INCOMING_RTL (REG_EXPR (loc))) == PARALLEL
&& XVECLEN (DECL_INCOMING_RTL (REG_EXPR (loc)), 0) > 1)))
goto log_and_return;
v = find_use_val (oloc, mode, cui);
if (!v)
@ -9447,6 +9466,32 @@ vt_get_decl_and_offset (rtx rtl, tree *declp, HOST_WIDE_INT *offsetp)
return true;
}
}
else if (GET_CODE (rtl) == PARALLEL)
{
tree decl = NULL_TREE;
HOST_WIDE_INT offset = MAX_VAR_PARTS;
int len = XVECLEN (rtl, 0), i;
for (i = 0; i < len; i++)
{
rtx reg = XEXP (XVECEXP (rtl, 0, i), 0);
if (!REG_P (reg) || !REG_ATTRS (reg))
break;
if (!decl)
decl = REG_EXPR (reg);
if (REG_EXPR (reg) != decl)
break;
if (REG_OFFSET (reg) < offset)
offset = REG_OFFSET (reg);
}
if (i == len)
{
*declp = decl;
*offsetp = offset;
return true;
}
}
else if (MEM_P (rtl))
{
if (MEM_ATTRS (rtl))
@ -9532,6 +9577,28 @@ vt_add_function_parameter (tree parm)
p.outgoing = incoming;
vec_safe_push (windowed_parm_regs, p);
}
else if (GET_CODE (incoming) == PARALLEL)
{
rtx outgoing
= gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (XVECLEN (incoming, 0)));
int i;
for (i = 0; i < XVECLEN (incoming, 0); i++)
{
rtx reg = XEXP (XVECEXP (incoming, 0, i), 0);
parm_reg_t p;
p.incoming = reg;
reg = gen_rtx_REG_offset (reg, GET_MODE (reg),
OUTGOING_REGNO (REGNO (reg)), 0);
p.outgoing = reg;
XVECEXP (outgoing, 0, i)
= gen_rtx_EXPR_LIST (VOIDmode, reg,
XEXP (XVECEXP (incoming, 0, i), 1));
vec_safe_push (windowed_parm_regs, p);
}
incoming = outgoing;
}
else if (MEM_P (incoming)
&& REG_P (XEXP (incoming, 0))
&& HARD_REGISTER_P (XEXP (incoming, 0)))
@ -9665,6 +9732,20 @@ vt_add_function_parameter (tree parm)
}
}
}
else if (GET_CODE (incoming) == PARALLEL && !dv_onepart_p (dv))
{
int i;
for (i = 0; i < XVECLEN (incoming, 0); i++)
{
rtx reg = XEXP (XVECEXP (incoming, 0, i), 0);
offset = REG_OFFSET (reg);
gcc_assert (REGNO (reg) < FIRST_PSEUDO_REGISTER);
attrs_list_insert (&out->regs[REGNO (reg)], dv, offset, reg);
set_variable_part (out, reg, dv, offset,
VAR_INIT_STATUS_INITIALIZED, NULL, INSERT);
}
}
else if (MEM_P (incoming))
{
incoming = var_lowpart (mode, incoming);