Commit e847cc68 by Richard Henderson Committed by Richard Henderson

gimplify.c (is_gimple_addr_expr_arg_or_indirect): Remove.

        * gimplify.c (is_gimple_addr_expr_arg_or_indirect): Remove.
        (gimplify_modify_expr, gimplify_addr_expr, gimplify_expr): Use
        is_gimple_addressable.
        * tree-gimple.c (is_gimple_addressable): Rename from
        is_gimple_addr_expr_arg; accept INDIRECT_REF.
        (is_gimple_lvalue): Don't test INDIRECT_REF directly.
        * tree-gimple.h, tree-sra.c, tree-ssa-loop-im.c: Update for
        rename to is_gimple_addressable.

From-SVN: r85243
parent b91accd6
2004-07-27 Richard Henderson <rth@redhat.com>
* gimplify.c (is_gimple_addr_expr_arg_or_indirect): Remove.
(gimplify_modify_expr, gimplify_addr_expr, gimplify_expr): Use
is_gimple_addressable.
* tree-gimple.c (is_gimple_addressable): Rename from
is_gimple_addr_expr_arg; accept INDIRECT_REF.
(is_gimple_lvalue): Don't test INDIRECT_REF directly.
* tree-gimple.h, tree-sra.c, tree-ssa-loop-im.c: Update for
rename to is_gimple_addressable.
2004-07-28 Alan Modra <amodra@bigpond.net.au> 2004-07-28 Alan Modra <amodra@bigpond.net.au>
* config/rs6000/rs6000.c (function_arg_padding): Pad SFmode upwards. * config/rs6000/rs6000.c (function_arg_padding): Pad SFmode upwards.
......
...@@ -2709,15 +2709,6 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p, ...@@ -2709,15 +2709,6 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
return ret; return ret;
} }
/* Return true if T is either a valid GIMPLE operand or is an
INDIRECT_REF (the latter is valid since we'll strip it off). */
static bool
is_gimple_addr_expr_arg_or_indirect (tree t)
{
return (TREE_CODE (t) == INDIRECT_REF || is_gimple_addr_expr_arg (t));
}
/* Gimplify the MODIFY_EXPR node pointed by EXPR_P. /* Gimplify the MODIFY_EXPR node pointed by EXPR_P.
modify_expr modify_expr
...@@ -2788,7 +2779,7 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value) ...@@ -2788,7 +2779,7 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value)
if (TREE_CODE (from) == CONSTRUCTOR) if (TREE_CODE (from) == CONSTRUCTOR)
return gimplify_modify_expr_to_memset (expr_p, size, want_value); return gimplify_modify_expr_to_memset (expr_p, size, want_value);
if (is_gimple_addr_expr_arg (from)) if (is_gimple_addressable (from))
{ {
*from_p = from; *from_p = from;
return gimplify_modify_expr_to_memcpy (expr_p, size, want_value); return gimplify_modify_expr_to_memcpy (expr_p, size, want_value);
...@@ -3027,7 +3018,7 @@ gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p) ...@@ -3027,7 +3018,7 @@ gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p)
/* We use fb_either here because the C frontend sometimes takes /* We use fb_either here because the C frontend sometimes takes
the address of a call that returns a struct. */ the address of a call that returns a struct. */
ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, post_p, ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, post_p,
is_gimple_addr_expr_arg_or_indirect, fb_either); is_gimple_addressable, fb_either);
if (ret != GS_ERROR) if (ret != GS_ERROR)
{ {
/* The above may have made an INDIRECT ref (e.g, Ada's NULL_EXPR), /* The above may have made an INDIRECT ref (e.g, Ada's NULL_EXPR),
...@@ -3930,7 +3921,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3930,7 +3921,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
postqueue; we need to copy the value out first, which means an postqueue; we need to copy the value out first, which means an
rvalue. */ rvalue. */
if ((fallback & fb_lvalue) && !internal_post if ((fallback & fb_lvalue) && !internal_post
&& is_gimple_addr_expr_arg (*expr_p)) && is_gimple_addressable (*expr_p))
{ {
/* An lvalue will do. Take the address of the expression, store it /* An lvalue will do. Take the address of the expression, store it
in a temporary, and replace the expression with an INDIRECT_REF of in a temporary, and replace the expression with an INDIRECT_REF of
......
...@@ -118,16 +118,17 @@ Boston, MA 02111-1307, USA. */ ...@@ -118,16 +118,17 @@ Boston, MA 02111-1307, USA. */
addr-expr-arg: ID addr-expr-arg: ID
| compref | compref
with-size-arg: addr-expr-arg addressable : addr-expr-arg
| indirectref | indirectref
with-size-arg: addressable
| call-stmt | call-stmt
indirectref : INDIRECT_REF indirectref : INDIRECT_REF
op0 -> val op0 -> val
lhs : addr-expr-arg lhs : addressable
| bitfieldref | bitfieldref
| indirectref
| WITH_SIZE_EXPR | WITH_SIZE_EXPR
op0 -> with-size-arg op0 -> with-size-arg
op1 -> val op1 -> val
...@@ -300,8 +301,7 @@ is_gimple_constructor_elt (tree t) ...@@ -300,8 +301,7 @@ is_gimple_constructor_elt (tree t)
bool bool
is_gimple_lvalue (tree t) is_gimple_lvalue (tree t)
{ {
return (is_gimple_addr_expr_arg (t) return (is_gimple_addressable (t)
|| TREE_CODE (t) == INDIRECT_REF
|| TREE_CODE (t) == WITH_SIZE_EXPR || TREE_CODE (t) == WITH_SIZE_EXPR
/* These are complex lvalues, but don't have addresses, so they /* These are complex lvalues, but don't have addresses, so they
go here. */ go here. */
...@@ -317,13 +317,15 @@ is_gimple_condexpr (tree t) ...@@ -317,13 +317,15 @@ is_gimple_condexpr (tree t)
|| TREE_CODE_CLASS (TREE_CODE (t)) == '<'); || TREE_CODE_CLASS (TREE_CODE (t)) == '<');
} }
/* Return true if T is a valid operand for ADDR_EXPR. */ /* Return true if T is something whose address can be taken. */
bool bool
is_gimple_addr_expr_arg (tree t) is_gimple_addressable (tree t)
{ {
return (is_gimple_id (t) || handled_component_p (t) return (is_gimple_id (t) || handled_component_p (t)
|| TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR); || TREE_CODE (t) == REALPART_EXPR
|| TREE_CODE (t) == IMAGPART_EXPR
|| TREE_CODE (t) == INDIRECT_REF);
} }
/* Return true if T is function invariant. Or rather a restricted /* Return true if T is function invariant. Or rather a restricted
......
...@@ -55,8 +55,8 @@ extern bool is_gimple_tmp_reg (tree); ...@@ -55,8 +55,8 @@ extern bool is_gimple_tmp_reg (tree);
extern bool is_gimple_variable (tree); extern bool is_gimple_variable (tree);
/* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */ /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
extern bool is_gimple_min_lval (tree); extern bool is_gimple_min_lval (tree);
/* Returns true iff T is an lvalue other than an INDIRECT_REF. */ /* Returns true iff T is something whose address can be taken. */
extern bool is_gimple_addr_expr_arg (tree); extern bool is_gimple_addressable (tree);
/* Returns true iff T is any valid GIMPLE lvalue. */ /* Returns true iff T is any valid GIMPLE lvalue. */
extern bool is_gimple_lvalue (tree); extern bool is_gimple_lvalue (tree);
......
...@@ -826,7 +826,7 @@ sra_walk_modify_expr (tree expr, block_stmt_iterator *bsi, ...@@ -826,7 +826,7 @@ sra_walk_modify_expr (tree expr, block_stmt_iterator *bsi,
The lvalue requirement prevents us from trying to directly scalarize The lvalue requirement prevents us from trying to directly scalarize
the result of a function call. Which would result in trying to call the result of a function call. Which would result in trying to call
the function multiple times, and other evil things. */ the function multiple times, and other evil things. */
else if (!lhs_elt->is_scalar && is_gimple_addr_expr_arg (rhs)) else if (!lhs_elt->is_scalar && is_gimple_addressable (rhs))
fns->ldst (lhs_elt, rhs, bsi, true); fns->ldst (lhs_elt, rhs, bsi, true);
/* Otherwise we're being used in some context that requires the /* Otherwise we're being used in some context that requires the
......
...@@ -350,7 +350,7 @@ stmt_cost (tree stmt) ...@@ -350,7 +350,7 @@ stmt_cost (tree stmt)
/* Hoisting memory references out should almost surely be a win. */ /* Hoisting memory references out should almost surely be a win. */
if (!is_gimple_variable (lhs)) if (!is_gimple_variable (lhs))
cost += 20; cost += 20;
if (is_gimple_addr_expr_arg (rhs) && !is_gimple_variable (rhs)) if (is_gimple_addressable (rhs) && !is_gimple_variable (rhs))
cost += 20; cost += 20;
switch (TREE_CODE (rhs)) switch (TREE_CODE (rhs))
......
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