tree-flow.h (struct var_ann_d): Remove has_hidden_use.

* tree-flow.h (struct var_ann_d): Remove has_hidden_use.
        * gimple-low.c (expand_var_p): Don't check it.
        * tree-ssa-alias.c (setup_pointers_and_addressables): Likewise.
        * tree-ssa-copyrename.c (rename_ssa_copies): Likewise.
        * tree-ssa-operands.c (add_stmt_operand): Likewise.
        * tree-dfa.c (find_hidden_use_vars, find_hidden_use_vars_r): Kill.
        (find_referenced_vars): Don't call them.
        * tree-flow-inline.h (has_hidden_use, set_has_hidden_use): Kill.

From-SVN: r84830
This commit is contained in:
Richard Henderson 2004-07-16 13:40:25 -07:00 committed by Richard Henderson
parent d58247a321
commit 26e79d1018
8 changed files with 18 additions and 154 deletions

View File

@ -1,3 +1,14 @@
2004-07-16 Richard Henderson <rth@redhat.com>
* tree-flow.h (struct var_ann_d): Remove has_hidden_use.
* gimple-low.c (expand_var_p): Don't check it.
* tree-ssa-alias.c (setup_pointers_and_addressables): Likewise.
* tree-ssa-copyrename.c (rename_ssa_copies): Likewise.
* tree-ssa-operands.c (add_stmt_operand): Likewise.
* tree-dfa.c (find_hidden_use_vars, find_hidden_use_vars_r): Kill.
(find_referenced_vars): Don't call them.
* tree-flow-inline.h (has_hidden_use, set_has_hidden_use): Kill.
2004-07-16 Richard Henderson <rth@redhat.com>
* function.c (pass_by_reference): True for all variable sized types.

View File

@ -482,7 +482,6 @@ expand_var_p (tree var)
if (ann
&& ! ann->may_aliases
&& ! ann->used
&& ! ann->has_hidden_use
&& ! TREE_ADDRESSABLE (var)
&& ! TREE_THIS_VOLATILE (var)
&& (DECL_ARTIFICIAL (var) || optimize >= 2))

View File

@ -81,8 +81,6 @@ static tree find_vars_r (tree *, int *, void *);
static void add_referenced_var (tree, struct walk_state *);
static void compute_immediate_uses_for_phi (tree, bool (*)(tree));
static void compute_immediate_uses_for_stmt (tree, int, bool (*)(tree));
static void find_hidden_use_vars (tree);
static tree find_hidden_use_vars_r (tree *, int *, void *);
/* Global declarations. */
@ -109,21 +107,6 @@ find_referenced_vars (void)
basic_block bb;
block_stmt_iterator si;
struct walk_state walk_state;
tree block;
/* Walk the lexical blocks in the function looking for variables that may
have been used to declare VLAs and for nested functions. Both
constructs create hidden uses of variables.
Note that at this point we may have multiple blocks hung off
DECL_INITIAL chained through the BLOCK_CHAIN field due to
how inlining works. Egad. */
block = DECL_INITIAL (current_function_decl);
while (block)
{
find_hidden_use_vars (block);
block = BLOCK_CHAIN (block);
}
vars_found = htab_create (50, htab_hash_pointer, htab_eq_pointer, NULL);
memset (&walk_state, 0, sizeof (walk_state));
@ -570,9 +553,6 @@ dump_variable (FILE *file, tree var)
fprintf (file, ", UID %u", (unsigned) ann->uid);
if (ann->has_hidden_use)
fprintf (file, ", has hidden uses");
if (ann->type_mem_tag)
{
fprintf (file, ", type memory tag: ");
@ -958,82 +938,6 @@ get_virtual_var (tree var)
return var;
}
/* Mark variables in BLOCK that have hidden uses. A hidden use can
occur due to VLA declarations or nested functions. */
static void
find_hidden_use_vars (tree block)
{
tree sub, decl, tem;
/* Check all the arrays declared in the block for VLAs.
While scanning the block's variables, also see if there is
a nested function at this scope. */
for (decl = BLOCK_VARS (block); decl; decl = TREE_CHAIN (decl))
{
int inside_vla = 0;
walk_tree (&decl, find_hidden_use_vars_r, &inside_vla, NULL);
}
/* Now repeat the search in any sub-blocks. */
for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
find_hidden_use_vars (sub);
/* A VLA parameter may use a variable which as set from another
parameter to declare the size of the VLA. We need to mark the
variable as having a hidden use since it is used to declare the
VLA parameter and that declaration is not seen by the SSA code.
Note get_pending_sizes clears the PENDING_SIZES chain, so we
must restore it. */
tem = get_pending_sizes ();
put_pending_sizes (tem);
for (; tem; tem = TREE_CHAIN (tem))
{
int inside_vla = 1;
walk_tree (&TREE_VALUE (tem), find_hidden_use_vars_r, &inside_vla, NULL);
}
}
/* Callback for walk_tree used by find_hidden_use_vars to analyze each
variable in a lexical block. If the variable's size has a variable
size, then mark all objects needed to compute the variable's size
as having hidden uses. */
static tree
find_hidden_use_vars_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED)
{
int *inside_vla = (int *) data;
/* We need to look for hidden uses due to VLAs in variable
definitions. We originally used to look for these hidden
uses in the variable's type, but that's unreliable if the
type's size contains a SAVE_EXPR for a different function
context than the variable is used within. */
if (SSA_VAR_P (*tp)
&& ((DECL_SIZE (*tp)
&& ! really_constant_p (DECL_SIZE (*tp)))
|| (DECL_SIZE_UNIT (*tp)
&& ! really_constant_p (DECL_SIZE_UNIT (*tp)))))
{
int save = *inside_vla;
*inside_vla = 1;
walk_tree (&DECL_SIZE (*tp), find_hidden_use_vars_r, inside_vla, NULL);
walk_tree (&DECL_SIZE_UNIT (*tp), find_hidden_use_vars_r,
inside_vla, NULL);
*inside_vla = save;
}
else if (*inside_vla && SSA_VAR_P (*tp))
set_has_hidden_use (*tp);
return NULL_TREE;
}
/* Add a temporary variable to REFERENCED_VARS. This is similar to
add_referenced_var, but is used by passes that need to add new temps to
the REFERENCED_VARS array after the program has been scanned for

View File

@ -97,24 +97,6 @@ may_aliases (tree var)
return ann ? ann->may_aliases : NULL;
}
/* Return true if VAR has a hidden use, false if it does not. */
static inline bool
has_hidden_use (tree var)
{
var_ann_t ann = var_ann (var);
return ann ? ann->has_hidden_use : false;
}
/* Set the hidden use flag on VAR. */
static inline void
set_has_hidden_use (tree var)
{
var_ann_t ann = var_ann (var);
if (ann == NULL)
ann = create_var_ann (var);
ann->has_hidden_use = 1;
}
/* Return the line number for EXPR, or return -1 if we have no line
number information for it. */
static inline int

View File

@ -138,17 +138,6 @@ struct var_ann_d GTY(())
{
struct tree_ann_common_d common;
/* Nonzero if this variable has uses which may not appear
in the IL. This can happen in the following cases:
1. If the variable is used in a variable length
array declaration.
2. If the variable is the return value in a C++
function where the named return value optimization
has been performed. */
unsigned has_hidden_use : 1;
/* Used by the out of SSA pass to determine whether this variable has
been seen yet or not. */
unsigned out_of_ssa_tag : 1;
@ -334,8 +323,6 @@ static inline bitmap addresses_taken (tree);
static inline int num_immediate_uses (dataflow_t);
static inline tree immediate_use (dataflow_t, int);
static inline dataflow_t get_immediate_uses (tree);
static inline bool has_hidden_use (tree);
static inline void set_has_hidden_use (tree);
static inline void set_default_def (tree, tree);
static inline tree default_def (tree);
static inline bool may_be_aliased (tree);

View File

@ -1219,12 +1219,10 @@ setup_pointers_and_addressables (struct alias_info *ai)
if (POINTER_TYPE_P (TREE_TYPE (var)))
{
/* Since we don't keep track of volatile variables nor
variables with hidden uses, assume that these pointers
are used in indirect store operations. */
var_ann_t ann = var_ann (var);
if (TREE_THIS_VOLATILE (var) || ann->has_hidden_use)
bitmap_set_bit (ai->dereferenced_ptrs_store, ann->uid);
/* Since we don't keep track of volatile variables, assume that
these pointers are used in indirect store operations. */
if (TREE_THIS_VOLATILE (var))
bitmap_set_bit (ai->dereferenced_ptrs_store, var_ann (var)->uid);
num_pointers++;
}
@ -1266,7 +1264,6 @@ setup_pointers_and_addressables (struct alias_info *ai)
if (TREE_ADDRESSABLE (var))
{
if (!bitmap_bit_p (ai->addresses_needed, v_ann->uid)
&& !v_ann->has_hidden_use
&& v_ann->mem_tag_kind == NOT_A_TAG
&& !needs_to_live_in_memory (var))
{

View File

@ -309,9 +309,7 @@ rename_ssa_copies (void)
tree lhs = TREE_OPERAND (stmt, 0);
tree rhs = TREE_OPERAND (stmt, 1);
if (TREE_CODE (lhs) == SSA_NAME
&& !has_hidden_use (SSA_NAME_VAR (lhs))
&& TREE_CODE (rhs) == SSA_NAME)
if (TREE_CODE (lhs) == SSA_NAME && TREE_CODE (rhs) == SSA_NAME)
copy_rename_partition_coalesce (map, lhs, rhs, debug);
}
}
@ -325,10 +323,8 @@ rename_ssa_copies (void)
int i;
tree res = PHI_RESULT (phi);
/* Do not process virtual SSA_NAMES or variables which have
hidden uses. */
if (!is_gimple_reg (SSA_NAME_VAR (res))
|| has_hidden_use (SSA_NAME_VAR (res)))
/* Do not process virtual SSA_NAMES. */
if (!is_gimple_reg (SSA_NAME_VAR (res)))
continue;
for (i = 0; i < PHI_NUM_ARGS (phi); i++)

View File

@ -1298,18 +1298,6 @@ add_stmt_operand (tree *var_p, tree stmt, int flags, voperands_t prev_vops)
sym = (TREE_CODE (var) == SSA_NAME ? SSA_NAME_VAR (var) : var);
v_ann = var_ann (sym);
/* FIXME: We currently refuse to optimize variables that have hidden uses
(variables used in VLA declarations, MD builtin calls and variables
from the parent function in nested functions). This is because not
all uses of these variables are exposed in the IL or the statements
that reference them are not in GIMPLE form. If that's the case, mark
the statement as having volatile operands and return. */
if (v_ann->has_hidden_use)
{
s_ann->has_volatile_ops = true;
return;
}
/* Don't expose volatile variables to the optimizers. */
if (TREE_THIS_VOLATILE (sym))
{