Commit 14797075 by Richard Henderson Committed by Richard Henderson

gimplify.c (is_gimple_tmp_var): Move to tree-gimple.c.

        * gimplify.c (is_gimple_tmp_var): Move to tree-gimple.c.
        (gimplify_compound_lval): Use is_gimple_tmp_reg.
        * tree-gimple.c (is_gimple_tmp_var): Move from gimplify.c.
        (is_gimple_tmp_reg): New.
        * tree-gimple.h (is_gimple_tmp_reg): Declare.

From-SVN: r84975
parent 40a37b04
2004-07-20 Richard Henderson <rth@redhat.com> 2004-07-20 Richard Henderson <rth@redhat.com>
* gimplify.c (is_gimple_tmp_var): Move to tree-gimple.c.
(gimplify_compound_lval): Use is_gimple_tmp_reg.
* tree-gimple.c (is_gimple_tmp_var): Move from gimplify.c.
(is_gimple_tmp_reg): New.
* tree-gimple.h (is_gimple_tmp_reg): Declare.
2004-07-20 Richard Henderson <rth@redhat.com>
* tree-pretty-print.c (dump_generic_node): Dump * tree-pretty-print.c (dump_generic_node): Dump
CALL_EXPR_HAS_RETURN_SLOT_ADDR. CALL_EXPR_HAS_RETURN_SLOT_ADDR.
......
...@@ -476,16 +476,6 @@ get_initialized_tmp_var (tree val, tree *pre_p, tree *post_p) ...@@ -476,16 +476,6 @@ get_initialized_tmp_var (tree val, tree *pre_p, tree *post_p)
return internal_get_tmp_var (val, pre_p, post_p, false); return internal_get_tmp_var (val, pre_p, post_p, false);
} }
/* Returns true if T is a GIMPLE temporary variable, false otherwise. */
bool
is_gimple_tmp_var (tree t)
{
/* FIXME this could trigger for other local artificials, too. */
return (TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t)
&& !TREE_STATIC (t) && !DECL_EXTERNAL (t));
}
/* Declares all the variables in VARS in SCOPE. */ /* Declares all the variables in VARS in SCOPE. */
void void
...@@ -1569,7 +1559,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p, ...@@ -1569,7 +1559,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
{ {
TREE_OPERAND (t, 2) = low; TREE_OPERAND (t, 2) = low;
tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p, tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p,
is_gimple_tmp_var, fb_rvalue); is_gimple_tmp_reg, fb_rvalue);
ret = MIN (ret, tret); ret = MIN (ret, tret);
} }
} }
...@@ -1588,7 +1578,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p, ...@@ -1588,7 +1578,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
{ {
TREE_OPERAND (t, 3) = elmt_size; TREE_OPERAND (t, 3) = elmt_size;
tret = gimplify_expr (&TREE_OPERAND (t, 3), pre_p, post_p, tret = gimplify_expr (&TREE_OPERAND (t, 3), pre_p, post_p,
is_gimple_tmp_var, fb_rvalue); is_gimple_tmp_reg, fb_rvalue);
ret = MIN (ret, tret); ret = MIN (ret, tret);
} }
} }
...@@ -1610,7 +1600,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p, ...@@ -1610,7 +1600,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
{ {
TREE_OPERAND (t, 2) = offset; TREE_OPERAND (t, 2) = offset;
tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p, tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p,
is_gimple_tmp_var, fb_rvalue); is_gimple_tmp_reg, fb_rvalue);
ret = MIN (ret, tret); ret = MIN (ret, tret);
} }
} }
...@@ -1641,7 +1631,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p, ...@@ -1641,7 +1631,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
if (!is_gimple_min_invariant (TREE_OPERAND (t, 1))) if (!is_gimple_min_invariant (TREE_OPERAND (t, 1)))
{ {
tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p, tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p,
is_gimple_tmp_var, fb_rvalue); is_gimple_tmp_reg, fb_rvalue);
ret = MIN (ret, tret); ret = MIN (ret, tret);
} }
} }
......
...@@ -447,6 +447,34 @@ is_gimple_reg (tree t) ...@@ -447,6 +447,34 @@ is_gimple_reg (tree t)
&& ! needs_to_live_in_memory (t)); && ! needs_to_live_in_memory (t));
} }
/* Returns true if T is a GIMPLE temporary variable, false otherwise. */
bool
is_gimple_tmp_var (tree t)
{
/* FIXME this could trigger for other local artificials, too. */
return (TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t)
&& !TREE_STATIC (t) && !DECL_EXTERNAL (t));
}
/* Returns true if T is a GIMPLE temporary register variable. */
bool
is_gimple_tmp_reg (tree t)
{
/* The intent of this is to get hold of a value that won't change.
An SSA_NAME qualifies no matter if its of a user variable or not. */
if (TREE_CODE (t) == SSA_NAME)
return true;
/* We don't know the lifetime characteristics of user variables. */
if (TREE_CODE (t) != VAR_DECL || !DECL_ARTIFICIAL (t))
return false;
/* Finally, it must be capable of being placed in a register. */
return is_gimple_reg (t);
}
/* Return true if T is a GIMPLE variable whose address is not needed. */ /* Return true if T is a GIMPLE variable whose address is not needed. */
bool bool
......
...@@ -28,7 +28,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -28,7 +28,6 @@ Boston, MA 02111-1307, USA. */
extern tree create_tmp_var_raw (tree, const char *); extern tree create_tmp_var_raw (tree, const char *);
extern tree create_tmp_var_name (const char *); extern tree create_tmp_var_name (const char *);
extern tree create_tmp_var (tree, const char *); extern tree create_tmp_var (tree, const char *);
extern bool is_gimple_tmp_var (tree);
extern tree get_initialized_tmp_var (tree, tree *, tree *); extern tree get_initialized_tmp_var (tree, tree *, tree *);
extern tree get_formal_tmp_var (tree, tree *); extern tree get_formal_tmp_var (tree, tree *);
extern void declare_tmp_vars (tree, tree); extern void declare_tmp_vars (tree, tree);
...@@ -48,6 +47,10 @@ extern bool is_gimple_stmt (tree); ...@@ -48,6 +47,10 @@ extern bool is_gimple_stmt (tree);
extern bool is_gimple_reg_type (tree); extern bool is_gimple_reg_type (tree);
/* Returns true iff T is a scalar register variable. */ /* Returns true iff T is a scalar register variable. */
extern bool is_gimple_reg (tree); extern bool is_gimple_reg (tree);
/* Returns true if T is a GIMPLE temporary variable, false otherwise. */
extern bool is_gimple_tmp_var (tree);
/* Returns true if T is a GIMPLE temporary register variable. */
extern bool is_gimple_tmp_reg (tree);
/* Returns true iff T is any sort of variable. */ /* Returns true iff T is any sort of variable. */
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). */
......
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