summaryrefslogtreecommitdiff
path: root/gcc/tree-dfa.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-29 12:48:34 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-29 12:48:34 +0000
commit134f0957100ce9bb6fb123dfcafd4bf743af2711 (patch)
treea14fb2aa71ea28c1801fca31518dc9b62e83ce77 /gcc/tree-dfa.c
parentd6443ebe8dc9e266a21ee321f3dd81ebe5be6445 (diff)
downloadgcc-134f0957100ce9bb6fb123dfcafd4bf743af2711.tar.gz
2012-05-29 Richard Guenther <rguenther@suse.de>
* tree-dfa.c (find_vars_r): Do not call add_referenced_vars for globals. (add_referenced_var_1): Re-organize. Assert we are not called for globals. (remove_referenced_var): Likewise. * varpool.c (add_new_static_var): Use create_tmp_var_raw. * tree-mudflap.c (execute_mudflap_function_ops): Do not call add_referenced_var on globals. * matrix-reorg.c (transform_access_sites): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187955 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r--gcc/tree-dfa.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 2c6393367d5..fe477ff5ee5 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -430,7 +430,10 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data)
/* If T is a regular variable that the optimizers are interested
in, add it to the list of variables. */
- else if (SSA_VAR_P (*tp))
+ else if ((TREE_CODE (*tp) == VAR_DECL
+ && !is_global_var (*tp))
+ || TREE_CODE (*tp) == PARM_DECL
+ || TREE_CODE (*tp) == RESULT_DECL)
add_referenced_var_1 (*tp, fn);
/* Type, _DECL and constant nodes have no interesting children.
@@ -560,22 +563,24 @@ add_referenced_var_1 (tree var, struct function *fn)
|| TREE_CODE (var) == PARM_DECL
|| TREE_CODE (var) == RESULT_DECL);
- if (!(TREE_CODE (var) == VAR_DECL
- && VAR_DECL_IS_VIRTUAL_OPERAND (var))
- && is_global_var (var))
- return false;
+ gcc_checking_assert ((TREE_CODE (var) == VAR_DECL
+ && VAR_DECL_IS_VIRTUAL_OPERAND (var))
+ || !is_global_var (var));
- if (!*DECL_VAR_ANN_PTR (var))
- *DECL_VAR_ANN_PTR (var) = ggc_alloc_cleared_var_ann_d ();
-
- /* Insert VAR into the referenced_vars hash table if it isn't present. */
+ /* Insert VAR into the referenced_vars hash table if it isn't present
+ and allocate its var-annotation. */
if (referenced_var_check_and_insert (var, fn))
- return true;
+ {
+ gcc_checking_assert (!*DECL_VAR_ANN_PTR (var));
+ *DECL_VAR_ANN_PTR (var) = ggc_alloc_cleared_var_ann_d ();
+ return true;
+ }
return false;
}
-/* Remove VAR from the list. */
+/* Remove VAR from the list of referenced variables and clear its
+ var-annotation. */
void
remove_referenced_var (tree var)
@@ -585,14 +590,16 @@ remove_referenced_var (tree var)
void **loc;
unsigned int uid = DECL_UID (var);
- /* Preserve var_anns of globals. */
- if (!is_global_var (var)
- && (v_ann = var_ann (var)))
- {
- ggc_free (v_ann);
- *DECL_VAR_ANN_PTR (var) = NULL;
- }
- gcc_assert (DECL_P (var));
+ gcc_checking_assert (TREE_CODE (var) == VAR_DECL
+ || TREE_CODE (var) == PARM_DECL
+ || TREE_CODE (var) == RESULT_DECL);
+
+ gcc_checking_assert (!is_global_var (var));
+
+ v_ann = var_ann (var);
+ ggc_free (v_ann);
+ *DECL_VAR_ANN_PTR (var) = NULL;
+
in.uid = uid;
loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid,
NO_INSERT);