aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ipa-reference.c12
-rw-r--r--gcc/tree-dfa.c20
-rw-r--r--gcc/tree-flow-inline.h22
-rw-r--r--gcc/tree-flow.h22
4 files changed, 64 insertions, 12 deletions
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 5317052..ec8d3b8 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -111,7 +111,7 @@ tree memory_identifier_string;
static inline ipa_reference_vars_info_t
get_reference_vars_info_from_cgraph (struct cgraph_node * node)
{
- return get_var_ann (node->decl)->reference_vars_info;
+ return get_function_ann (node->decl)->reference_vars_info;
}
/* Get a bitmap that contains all of the locally referenced static
@@ -119,7 +119,7 @@ get_reference_vars_info_from_cgraph (struct cgraph_node * node)
static ipa_reference_local_vars_info_t
get_local_reference_vars_info (tree fn)
{
- ipa_reference_vars_info_t info = get_var_ann (fn)->reference_vars_info;
+ ipa_reference_vars_info_t info = get_function_ann (fn)->reference_vars_info;
if (info)
return info->local;
@@ -134,7 +134,7 @@ get_local_reference_vars_info (tree fn)
static ipa_reference_global_vars_info_t
get_global_reference_vars_info (tree fn)
{
- ipa_reference_vars_info_t info = get_var_ann (fn)->reference_vars_info;
+ ipa_reference_vars_info_t info = get_function_ann (fn)->reference_vars_info;
if (info)
return info->global;
@@ -790,7 +790,7 @@ analyze_function (struct cgraph_node *fn)
tree decl = fn->decl;
/* Add the info to the tree's annotation. */
- get_var_ann (fn->decl)->reference_vars_info = info;
+ get_function_ann (fn->decl)->reference_vars_info = info;
info->local = l;
l->statics_read = BITMAP_ALLOC (&ipa_obstack);
@@ -874,8 +874,8 @@ clean_function (struct cgraph_node *fn)
}
- free (get_var_ann (fn->decl)->reference_vars_info);
- get_var_ann (fn->decl)->reference_vars_info = NULL;
+ free (get_function_ann (fn->decl)->reference_vars_info);
+ get_function_ann (fn->decl)->reference_vars_info = NULL;
}
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 89cdd6e..5af9753 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -167,6 +167,26 @@ create_var_ann (tree t)
return ann;
}
+/* Create a new annotation for a FUNCTION_DECL node T. */
+
+function_ann_t
+create_function_ann (tree t)
+{
+ function_ann_t ann;
+
+ gcc_assert (t);
+ gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
+ gcc_assert (!t->common.ann || t->common.ann->common.type == FUNCTION_ANN);
+
+ ann = ggc_alloc (sizeof (*ann));
+ memset ((void *) ann, 0, sizeof (*ann));
+
+ ann->common.type = FUNCTION_ANN;
+
+ t->common.ann = (tree_ann_t) ann;
+
+ return ann;
+}
/* Create a new annotation for a statement node T. */
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index 057b249..94e1972 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -126,6 +126,7 @@ var_ann (tree t)
{
gcc_assert (t);
gcc_assert (DECL_P (t));
+ gcc_assert (TREE_CODE (t) != FUNCTION_DECL);
gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN);
return (var_ann_t) t->common.ann;
@@ -140,6 +141,27 @@ get_var_ann (tree var)
return (ann) ? ann : create_var_ann (var);
}
+/* Return the function annotation for T, which must be a FUNCTION_DECL node.
+ Return NULL if the function annotation doesn't already exist. */
+static inline function_ann_t
+function_ann (tree t)
+{
+ gcc_assert (t);
+ gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
+ gcc_assert (!t->common.ann || t->common.ann->common.type == FUNCTION_ANN);
+
+ return (function_ann_t) t->common.ann;
+}
+
+/* Return the function annotation for T, which must be a FUNCTION_DECL node.
+ Create the function annotation if it doesn't exist. */
+static inline function_ann_t
+get_function_ann (tree var)
+{
+ function_ann_t ann = function_ann (var);
+ return (ann) ? ann : create_function_ann (var);
+}
+
/* Return the statement annotation for T, which must be a statement
node. Return NULL if the statement annotation doesn't exist. */
static inline stmt_ann_t
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index e59e809..a507ced 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -98,7 +98,7 @@ struct ptr_info_def GTY(())
/*---------------------------------------------------------------------------
Tree annotations stored in tree_common.ann
---------------------------------------------------------------------------*/
-enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, STMT_ANN };
+enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, FUNCTION_ANN, STMT_ANN };
struct tree_ann_common_d GTY(())
{
@@ -209,16 +209,21 @@ struct var_ann_d GTY(())
current version of this variable (an SSA_NAME). */
tree current_def;
- /* Pointer to the structure that contains the sets of global
- variables modified by function calls. This field is only used
- for FUNCTION_DECLs. */
- ipa_reference_vars_info_t GTY ((skip)) reference_vars_info;
/* If this variable is a structure, this fields holds a list of
symbols representing each of the fields of the structure. */
subvar_t subvars;
};
+struct function_ann_d GTY(())
+{
+ struct tree_ann_common_d common;
+
+ /* Pointer to the structure that contains the sets of global
+ variables modified by function calls. This field is only used
+ for FUNCTION_DECLs. */
+ ipa_reference_vars_info_t GTY ((skip)) reference_vars_info;
+};
typedef struct immediate_use_iterator_d
{
@@ -287,7 +292,8 @@ struct stmt_ann_d GTY(())
union tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
{
struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
- struct var_ann_d GTY((tag ("VAR_ANN"))) decl;
+ struct var_ann_d GTY((tag ("VAR_ANN"))) vdecl;
+ struct function_ann_d GTY((tag ("FUNCTION_ANN"))) fdecl;
struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
};
@@ -295,12 +301,15 @@ extern GTY(()) VEC(tree,gc) *modified_noreturn_calls;
typedef union tree_ann_d *tree_ann_t;
typedef struct var_ann_d *var_ann_t;
+typedef struct function_ann_d *function_ann_t;
typedef struct stmt_ann_d *stmt_ann_t;
static inline tree_ann_t tree_ann (tree);
static inline tree_ann_t get_tree_ann (tree);
static inline var_ann_t var_ann (tree);
static inline var_ann_t get_var_ann (tree);
+static inline function_ann_t function_ann (tree);
+static inline function_ann_t get_function_ann (tree);
static inline stmt_ann_t stmt_ann (tree);
static inline stmt_ann_t get_stmt_ann (tree);
static inline enum tree_ann_type ann_type (tree_ann_t);
@@ -533,6 +542,7 @@ extern void dump_generic_bb (FILE *, basic_block, int, int);
/* In tree-dfa.c */
extern var_ann_t create_var_ann (tree);
+extern function_ann_t create_function_ann (tree);
extern stmt_ann_t create_stmt_ann (tree);
extern tree_ann_t create_tree_ann (tree);
extern void dump_dfa_stats (FILE *);