Commit 26e79d10 by Richard Henderson Committed by Richard Henderson

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
parent d58247a3
2004-07-16 Richard Henderson <rth@redhat.com> 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. * function.c (pass_by_reference): True for all variable sized types.
2004-07-16 Sebastian Pop <pop@cri.ensmp.fr> 2004-07-16 Sebastian Pop <pop@cri.ensmp.fr>
......
...@@ -482,7 +482,6 @@ expand_var_p (tree var) ...@@ -482,7 +482,6 @@ expand_var_p (tree var)
if (ann if (ann
&& ! ann->may_aliases && ! ann->may_aliases
&& ! ann->used && ! ann->used
&& ! ann->has_hidden_use
&& ! TREE_ADDRESSABLE (var) && ! TREE_ADDRESSABLE (var)
&& ! TREE_THIS_VOLATILE (var) && ! TREE_THIS_VOLATILE (var)
&& (DECL_ARTIFICIAL (var) || optimize >= 2)) && (DECL_ARTIFICIAL (var) || optimize >= 2))
......
...@@ -81,8 +81,6 @@ static tree find_vars_r (tree *, int *, void *); ...@@ -81,8 +81,6 @@ static tree find_vars_r (tree *, int *, void *);
static void add_referenced_var (tree, struct walk_state *); 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_phi (tree, bool (*)(tree));
static void compute_immediate_uses_for_stmt (tree, int, 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. */ /* Global declarations. */
...@@ -109,21 +107,6 @@ find_referenced_vars (void) ...@@ -109,21 +107,6 @@ find_referenced_vars (void)
basic_block bb; basic_block bb;
block_stmt_iterator si; block_stmt_iterator si;
struct walk_state walk_state; 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); vars_found = htab_create (50, htab_hash_pointer, htab_eq_pointer, NULL);
memset (&walk_state, 0, sizeof (walk_state)); memset (&walk_state, 0, sizeof (walk_state));
...@@ -570,9 +553,6 @@ dump_variable (FILE *file, tree var) ...@@ -570,9 +553,6 @@ dump_variable (FILE *file, tree var)
fprintf (file, ", UID %u", (unsigned) ann->uid); fprintf (file, ", UID %u", (unsigned) ann->uid);
if (ann->has_hidden_use)
fprintf (file, ", has hidden uses");
if (ann->type_mem_tag) if (ann->type_mem_tag)
{ {
fprintf (file, ", type memory tag: "); fprintf (file, ", type memory tag: ");
...@@ -958,82 +938,6 @@ get_virtual_var (tree var) ...@@ -958,82 +938,6 @@ get_virtual_var (tree var)
return 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 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 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 the REFERENCED_VARS array after the program has been scanned for
......
...@@ -97,24 +97,6 @@ may_aliases (tree var) ...@@ -97,24 +97,6 @@ may_aliases (tree var)
return ann ? ann->may_aliases : NULL; 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 /* Return the line number for EXPR, or return -1 if we have no line
number information for it. */ number information for it. */
static inline int static inline int
......
...@@ -138,17 +138,6 @@ struct var_ann_d GTY(()) ...@@ -138,17 +138,6 @@ struct var_ann_d GTY(())
{ {
struct tree_ann_common_d common; 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 /* Used by the out of SSA pass to determine whether this variable has
been seen yet or not. */ been seen yet or not. */
unsigned out_of_ssa_tag : 1; unsigned out_of_ssa_tag : 1;
...@@ -334,8 +323,6 @@ static inline bitmap addresses_taken (tree); ...@@ -334,8 +323,6 @@ static inline bitmap addresses_taken (tree);
static inline int num_immediate_uses (dataflow_t); static inline int num_immediate_uses (dataflow_t);
static inline tree immediate_use (dataflow_t, int); static inline tree immediate_use (dataflow_t, int);
static inline dataflow_t get_immediate_uses (tree); 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 void set_default_def (tree, tree);
static inline tree default_def (tree); static inline tree default_def (tree);
static inline bool may_be_aliased (tree); static inline bool may_be_aliased (tree);
......
...@@ -1219,12 +1219,10 @@ setup_pointers_and_addressables (struct alias_info *ai) ...@@ -1219,12 +1219,10 @@ setup_pointers_and_addressables (struct alias_info *ai)
if (POINTER_TYPE_P (TREE_TYPE (var))) if (POINTER_TYPE_P (TREE_TYPE (var)))
{ {
/* Since we don't keep track of volatile variables nor /* Since we don't keep track of volatile variables, assume that
variables with hidden uses, assume that these pointers these pointers are used in indirect store operations. */
are used in indirect store operations. */ if (TREE_THIS_VOLATILE (var))
var_ann_t ann = var_ann (var); bitmap_set_bit (ai->dereferenced_ptrs_store, var_ann (var)->uid);
if (TREE_THIS_VOLATILE (var) || ann->has_hidden_use)
bitmap_set_bit (ai->dereferenced_ptrs_store, ann->uid);
num_pointers++; num_pointers++;
} }
...@@ -1266,7 +1264,6 @@ setup_pointers_and_addressables (struct alias_info *ai) ...@@ -1266,7 +1264,6 @@ setup_pointers_and_addressables (struct alias_info *ai)
if (TREE_ADDRESSABLE (var)) if (TREE_ADDRESSABLE (var))
{ {
if (!bitmap_bit_p (ai->addresses_needed, v_ann->uid) if (!bitmap_bit_p (ai->addresses_needed, v_ann->uid)
&& !v_ann->has_hidden_use
&& v_ann->mem_tag_kind == NOT_A_TAG && v_ann->mem_tag_kind == NOT_A_TAG
&& !needs_to_live_in_memory (var)) && !needs_to_live_in_memory (var))
{ {
......
...@@ -309,9 +309,7 @@ rename_ssa_copies (void) ...@@ -309,9 +309,7 @@ rename_ssa_copies (void)
tree lhs = TREE_OPERAND (stmt, 0); tree lhs = TREE_OPERAND (stmt, 0);
tree rhs = TREE_OPERAND (stmt, 1); tree rhs = TREE_OPERAND (stmt, 1);
if (TREE_CODE (lhs) == SSA_NAME if (TREE_CODE (lhs) == SSA_NAME && TREE_CODE (rhs) == SSA_NAME)
&& !has_hidden_use (SSA_NAME_VAR (lhs))
&& TREE_CODE (rhs) == SSA_NAME)
copy_rename_partition_coalesce (map, lhs, rhs, debug); copy_rename_partition_coalesce (map, lhs, rhs, debug);
} }
} }
...@@ -325,10 +323,8 @@ rename_ssa_copies (void) ...@@ -325,10 +323,8 @@ rename_ssa_copies (void)
int i; int i;
tree res = PHI_RESULT (phi); tree res = PHI_RESULT (phi);
/* Do not process virtual SSA_NAMES or variables which have /* Do not process virtual SSA_NAMES. */
hidden uses. */ if (!is_gimple_reg (SSA_NAME_VAR (res)))
if (!is_gimple_reg (SSA_NAME_VAR (res))
|| has_hidden_use (SSA_NAME_VAR (res)))
continue; continue;
for (i = 0; i < PHI_NUM_ARGS (phi); i++) for (i = 0; i < PHI_NUM_ARGS (phi); i++)
......
...@@ -1298,18 +1298,6 @@ add_stmt_operand (tree *var_p, tree stmt, int flags, voperands_t prev_vops) ...@@ -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); sym = (TREE_CODE (var) == SSA_NAME ? SSA_NAME_VAR (var) : var);
v_ann = var_ann (sym); 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. */ /* Don't expose volatile variables to the optimizers. */
if (TREE_THIS_VOLATILE (sym)) if (TREE_THIS_VOLATILE (sym))
{ {
......
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