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
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;
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;
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);
}
- 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;
}
\f
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. */
{
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;
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
/*---------------------------------------------------------------------------
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(())
{
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
{
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;
};
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);
/* 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 *);