From c2514472e15476dac16d57406e535ccc2ed0fa08 Mon Sep 17 00:00:00 2001 From: rth Date: Wed, 28 Jul 2004 01:17:00 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85243 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/gimplify.c | 15 +++------------ gcc/tree-gimple.c | 18 ++++++++++-------- gcc/tree-gimple.h | 4 ++-- gcc/tree-sra.c | 2 +- gcc/tree-ssa-loop-im.c | 2 +- 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e76b32b1670..f19695ff364 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2004-07-27 Richard Henderson + + * 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 * config/rs6000/rs6000.c (function_arg_padding): Pad SFmode upwards. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 079622b78d8..fc260c8ce4d 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2709,15 +2709,6 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p, 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. modify_expr @@ -2788,7 +2779,7 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value) if (TREE_CODE (from) == CONSTRUCTOR) 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; 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) /* We use fb_either here because the C frontend sometimes takes the address of a call that returns a struct. */ 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) { /* 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, postqueue; we need to copy the value out first, which means an rvalue. */ 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 in a temporary, and replace the expression with an INDIRECT_REF of diff --git a/gcc/tree-gimple.c b/gcc/tree-gimple.c index 3d2fff897ed..4f26a084fc0 100644 --- a/gcc/tree-gimple.c +++ b/gcc/tree-gimple.c @@ -118,16 +118,17 @@ Boston, MA 02111-1307, USA. */ addr-expr-arg: ID | compref - with-size-arg: addr-expr-arg + addressable : addr-expr-arg | indirectref + + with-size-arg: addressable | call-stmt indirectref : INDIRECT_REF op0 -> val - lhs : addr-expr-arg + lhs : addressable | bitfieldref - | indirectref | WITH_SIZE_EXPR op0 -> with-size-arg op1 -> val @@ -300,8 +301,7 @@ is_gimple_constructor_elt (tree t) bool is_gimple_lvalue (tree t) { - return (is_gimple_addr_expr_arg (t) - || TREE_CODE (t) == INDIRECT_REF + return (is_gimple_addressable (t) || TREE_CODE (t) == WITH_SIZE_EXPR /* These are complex lvalues, but don't have addresses, so they go here. */ @@ -317,13 +317,15 @@ is_gimple_condexpr (tree 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 -is_gimple_addr_expr_arg (tree t) +is_gimple_addressable (tree 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 diff --git a/gcc/tree-gimple.h b/gcc/tree-gimple.h index 3a87503f76d..0fb376694e4 100644 --- a/gcc/tree-gimple.h +++ b/gcc/tree-gimple.h @@ -55,8 +55,8 @@ extern bool is_gimple_tmp_reg (tree); extern bool is_gimple_variable (tree); /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */ extern bool is_gimple_min_lval (tree); -/* Returns true iff T is an lvalue other than an INDIRECT_REF. */ -extern bool is_gimple_addr_expr_arg (tree); +/* Returns true iff T is something whose address can be taken. */ +extern bool is_gimple_addressable (tree); /* Returns true iff T is any valid GIMPLE lvalue. */ extern bool is_gimple_lvalue (tree); diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 73866b4972a..30d8e34d32b 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -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 result of a function call. Which would result in trying to call 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); /* Otherwise we're being used in some context that requires the diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index e7afc24cb78..d8c70a9489f 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -350,7 +350,7 @@ stmt_cost (tree stmt) /* Hoisting memory references out should almost surely be a win. */ if (!is_gimple_variable (lhs)) cost += 20; - if (is_gimple_addr_expr_arg (rhs) && !is_gimple_variable (rhs)) + if (is_gimple_addressable (rhs) && !is_gimple_variable (rhs)) cost += 20; switch (TREE_CODE (rhs)) -- 2.11.4.GIT