Commit 6d8d5435 by Richard Sandiford Committed by Richard Sandiford

mips.c (mips_gimplify_va_arg_expr): Fix invalid tree sharing.

gcc/
	* config/mips/mips.c (mips_gimplify_va_arg_expr): Fix invalid
	tree sharing.

From-SVN: r144244
parent e69ff910
2009-02-17 Richard Sandiford <rdsandiford@googlemail.com>
* config/mips/mips.c (mips_gimplify_va_arg_expr): Fix invalid
tree sharing.
2009-02-17 Ruan Beihong <ruanbeihong@gmail.com> 2009-02-17 Ruan Beihong <ruanbeihong@gmail.com>
Richard Sandiford <rdsandiford@googlemail.com> Richard Sandiford <rdsandiford@googlemail.com>
......
...@@ -5292,10 +5292,10 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, ...@@ -5292,10 +5292,10 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
if (GET_MODE_CLASS (TYPE_MODE (type)) == MODE_FLOAT if (GET_MODE_CLASS (TYPE_MODE (type)) == MODE_FLOAT
&& GET_MODE_SIZE (TYPE_MODE (type)) <= UNITS_PER_FPVALUE) && GET_MODE_SIZE (TYPE_MODE (type)) <= UNITS_PER_FPVALUE)
{ {
top = build3 (COMPONENT_REF, TREE_TYPE (f_ftop), valist, f_ftop, top = build3 (COMPONENT_REF, TREE_TYPE (f_ftop),
NULL_TREE); unshare_expr (valist), f_ftop, NULL_TREE);
off = build3 (COMPONENT_REF, TREE_TYPE (f_foff), valist, f_foff, off = build3 (COMPONENT_REF, TREE_TYPE (f_foff),
NULL_TREE); unshare_expr (valist), f_foff, NULL_TREE);
/* When va_start saves FPR arguments to the stack, each slot /* When va_start saves FPR arguments to the stack, each slot
takes up UNITS_PER_HWFPVALUE bytes, regardless of the takes up UNITS_PER_HWFPVALUE bytes, regardless of the
...@@ -5322,17 +5322,17 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, ...@@ -5322,17 +5322,17 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
} }
else else
{ {
top = build3 (COMPONENT_REF, TREE_TYPE (f_gtop), valist, f_gtop, top = build3 (COMPONENT_REF, TREE_TYPE (f_gtop),
NULL_TREE); unshare_expr (valist), f_gtop, NULL_TREE);
off = build3 (COMPONENT_REF, TREE_TYPE (f_goff), valist, f_goff, off = build3 (COMPONENT_REF, TREE_TYPE (f_goff),
NULL_TREE); unshare_expr (valist), f_goff, NULL_TREE);
rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD; rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD;
if (rsize > UNITS_PER_WORD) if (rsize > UNITS_PER_WORD)
{ {
/* [1] Emit code for: off &= -rsize. */ /* [1] Emit code for: off &= -rsize. */
t = build2 (BIT_AND_EXPR, TREE_TYPE (off), off, t = build2 (BIT_AND_EXPR, TREE_TYPE (off), unshare_expr (off),
build_int_cst (TREE_TYPE (off), -rsize)); build_int_cst (TREE_TYPE (off), -rsize));
gimplify_assign (off, t, pre_p); gimplify_assign (unshare_expr (off), t, pre_p);
} }
osize = rsize; osize = rsize;
} }
...@@ -5363,12 +5363,14 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, ...@@ -5363,12 +5363,14 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
{ {
/* [9] Emit: ovfl = ((intptr_t) ovfl + osize - 1) & -osize. */ /* [9] Emit: ovfl = ((intptr_t) ovfl + osize - 1) & -osize. */
u = size_int (osize - 1); u = size_int (osize - 1);
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovfl), ovfl, u); t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (ovfl),
unshare_expr (ovfl), u);
t = fold_convert (sizetype, t); t = fold_convert (sizetype, t);
u = size_int (-osize); u = size_int (-osize);
t = build2 (BIT_AND_EXPR, sizetype, t, u); t = build2 (BIT_AND_EXPR, sizetype, t, u);
t = fold_convert (TREE_TYPE (ovfl), t); t = fold_convert (TREE_TYPE (ovfl), t);
align = build2 (MODIFY_EXPR, TREE_TYPE (ovfl), ovfl, t); align = build2 (MODIFY_EXPR, TREE_TYPE (ovfl),
unshare_expr (ovfl), t);
} }
else else
align = NULL; align = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment