From 06d72ee6e3ede175130413390d15726c09678cfb Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Fri, 18 Jun 2004 14:05:20 +0000 Subject: [PATCH] tree-dfa.c (create_var_ann): tree_ann -> tree_ann_t. 2004-06-18 Daniel Berlin Diego Novillo * tree-dfa.c (create_var_ann): tree_ann -> tree_ann_t. (create_stmt_ann): Ditto. (create_tree_ann): New function. (create_cst_ann): Remove. (create_expr_ann): Ditto. * tree-flow-inline.h (cst_ann): Remove. (get_cst_ann): Ditto. (get_expr_ann): Ditto. (expr_ann): Ditto. (get_tree_ann): New function. (tree_ann): Ditto. (ann_type): tree_ann -> tree_ann_t. * tree-flow.h (tree_ann_type): CST_ANN, EXPR_ANN removed. (struct cst_ann_d): Removed. (struct expr_ann_d): Ditto. (union tree_ann_d): Removed cst and expr. (tree_ann): Renamed to tree_ann_t. * tree-ssa-ccp.c (set_rhs): tree_ann -> tree_ann_t. * tree-ssa-pre.c (get_value_handle): Rewrite for single common annotation. (set_value_handle): Ditto. (phi_translate): Ditto. * tree-tailcall.c (adjust_return_value): tree_ann -> tree_ann_t. Co-Authored-By: Diego Novillo From-SVN: r83349 --- gcc/ChangeLog | 28 +++++++++++++++++ gcc/tree-dfa.c | 41 ++++++------------------- gcc/tree-flow-inline.h | 69 +++++++++++------------------------------- gcc/tree-flow.h | 38 +++++------------------ gcc/tree-ssa-ccp.c | 2 +- gcc/tree-ssa-pre.c | 23 +++++--------- gcc/tree-tailcall.c | 2 +- 7 files changed, 72 insertions(+), 131 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9d87e1b5c81..aa0a6dd1d4e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,31 @@ +2004-06-18 Daniel Berlin + Diego Novillo + + * tree-dfa.c (create_var_ann): tree_ann -> tree_ann_t. + (create_stmt_ann): Ditto. + (create_tree_ann): New function. + (create_cst_ann): Remove. + (create_expr_ann): Ditto. + + * tree-flow-inline.h (cst_ann): Remove. + (get_cst_ann): Ditto. + (get_expr_ann): Ditto. + (expr_ann): Ditto. + (get_tree_ann): New function. + (tree_ann): Ditto. + (ann_type): tree_ann -> tree_ann_t. + * tree-flow.h (tree_ann_type): CST_ANN, EXPR_ANN removed. + (struct cst_ann_d): Removed. + (struct expr_ann_d): Ditto. + (union tree_ann_d): Removed cst and expr. + (tree_ann): Renamed to tree_ann_t. + * tree-ssa-ccp.c (set_rhs): tree_ann -> tree_ann_t. + * tree-ssa-pre.c (get_value_handle): Rewrite for single common + annotation. + (set_value_handle): Ditto. + (phi_translate): Ditto. + * tree-tailcall.c (adjust_return_value): tree_ann -> tree_ann_t. + 2004-06-18 Kaz Kojima * config/sh/t-linux64: New file. diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index ca8004387ee..e1445be4874 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -429,7 +429,7 @@ create_var_ann (tree t) ann->common.type = VAR_ANN; - t->common.ann = (tree_ann) ann; + t->common.ann = (tree_ann_t) ann; return ann; } @@ -457,54 +457,31 @@ create_stmt_ann (tree t) /* Since we just created the annotation, mark the statement modified. */ ann->modified = true; - t->common.ann = (tree_ann) ann; + t->common.ann = (tree_ann_t) ann; return ann; } -/* Create a new annotation for a constant T. */ +/* Create a new annotation for a tree T. */ -cst_ann_t -create_cst_ann (tree t) +tree_ann_t +create_tree_ann (tree t) { - cst_ann_t ann; + tree_ann_t ann; #if defined ENABLE_CHECKING if (t == NULL_TREE || (t->common.ann - && t->common.ann->common.type != CST_ANN)) + && t->common.ann->common.type != TREE_ANN_COMMON)) abort (); #endif ann = ggc_alloc (sizeof (*ann)); memset ((void *) ann, 0, sizeof (*ann)); - ann->common.type = CST_ANN; - t->common.ann = (tree_ann) ann; - - return ann; -} - -/* Create a new annotation for an expression T. */ - -expr_ann_t -create_expr_ann (tree t) -{ - expr_ann_t ann; - -#if defined ENABLE_CHECKING - if (t == NULL_TREE - || (t->common.ann - && t->common.ann->common.type != EXPR_ANN)) - abort (); -#endif - - ann = ggc_alloc (sizeof (*ann)); - memset ((void *) ann, 0, sizeof (*ann)); - - ann->common.type = EXPR_ANN; - t->common.ann = (tree_ann) ann; + ann->common.type = TREE_ANN_COMMON; + t->common.ann = ann; return ann; } diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index fbca4082b76..722259d3970 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -50,56 +50,6 @@ get_var_ann (tree var) return (ann) ? ann : create_var_ann (var); } - -/* Return the constant annotation for T, which must be a _CST node. - Return NULL if the constant annotation doesn't already exist. */ -static inline cst_ann_t -cst_ann (tree t) -{ -#if defined ENABLE_CHECKING - if (TREE_CODE_CLASS (TREE_CODE (t)) != 'c' - || (t->common.ann - && t->common.ann->common.type != CST_ANN)) - abort (); -#endif - - return (cst_ann_t) t->common.ann; -} - -/* Return the constant annotation for T, which must be a _CST node. - Create the constant annotation if it doesn't exist. */ -static inline cst_ann_t -get_cst_ann (tree var) -{ - cst_ann_t ann = cst_ann (var); - return (ann) ? ann : create_cst_ann (var); -} - -/* Return the expression annotation for T, which must be an expression - node. Return NULL if the expression annotation doesn't already - exist. */ -static inline expr_ann_t -expr_ann (tree t) -{ -#if defined ENABLE_CHECKING - if (!EXPR_P (t) - || (t->common.ann - && t->common.ann->common.type != EXPR_ANN)) - abort (); -#endif - - return (expr_ann_t) t->common.ann; -} - -/* Return the expression annotation for T, which must be an expression - node. Create the expression annotation if it doesn't exist. */ -static inline expr_ann_t -get_expr_ann (tree t) -{ - expr_ann_t ann = expr_ann (t); - return (ann) ? ann : create_expr_ann (t); -} - /* 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 @@ -125,7 +75,7 @@ get_stmt_ann (tree stmt) /* Return the annotation type for annotation ANN. */ static inline enum tree_ann_type -ann_type (tree_ann ann) +ann_type (tree_ann_t ann) { return ann->common.type; } @@ -798,4 +748,21 @@ mark_non_addressable (tree var) TREE_ADDRESSABLE (var) = 0; } +/* Return the common annotation for T. Return NULL if the annotation + doesn't already exist. */ +static inline tree_ann_t +tree_ann (tree t) +{ + return t->common.ann; +} + +/* Return a common annotation for T. Create the constant annotation if it + doesn't exist. */ +static inline tree_ann_t +get_tree_ann (tree t) +{ + tree_ann_t ann = tree_ann (t); + return (ann) ? ann : create_tree_ann (t); +} + #endif /* _TREE_FLOW_INLINE_H */ diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 12b3b0961de..d440c8bad6b 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -40,7 +40,7 @@ typedef struct basic_block_def *basic_block; /*--------------------------------------------------------------------------- Tree annotations stored in tree_common.ann ---------------------------------------------------------------------------*/ -enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, CST_ANN, EXPR_ANN, STMT_ANN }; +enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, STMT_ANN }; struct tree_ann_common_d GTY(()) { @@ -263,44 +263,24 @@ struct stmt_ann_d GTY(()) unsigned int uid; }; - -struct cst_ann_d GTY (()) -{ - struct tree_ann_common_d common; - -}; - -struct expr_ann_d GTY(()) -{ - struct tree_ann_common_d common; - -}; - - -union tree_ann_d GTY((desc ("ann_type ((tree_ann)&%h)"))) +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 expr_ann_d GTY((tag ("EXPR_ANN"))) expr; - struct cst_ann_d GTY((tag ("CST_ANN"))) cst; struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt; }; -typedef union tree_ann_d *tree_ann; +typedef union tree_ann_d *tree_ann_t; typedef struct var_ann_d *var_ann_t; typedef struct stmt_ann_d *stmt_ann_t; -typedef struct expr_ann_d *expr_ann_t; -typedef struct cst_ann_d *cst_ann_t; -static inline cst_ann_t cst_ann (tree); -static inline cst_ann_t get_cst_ann (tree); -static inline expr_ann_t expr_ann (tree); -static inline expr_ann_t get_expr_ann (tree); +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 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); +static inline enum tree_ann_type ann_type (tree_ann_t); static inline basic_block bb_for_stmt (tree); extern void set_bb_for_stmt (tree, basic_block); static inline void modify_stmt (tree); @@ -495,9 +475,8 @@ extern void dump_generic_bb (FILE *, basic_block, int, int); /* In tree-dfa.c */ extern var_ann_t create_var_ann (tree); -extern cst_ann_t create_cst_ann (tree); -extern expr_ann_t create_expr_ann (tree); extern stmt_ann_t create_stmt_ann (tree); +extern tree_ann_t create_tree_ann (tree); extern tree create_phi_node (tree, basic_block); extern void add_phi_arg (tree *, tree, edge); extern void remove_phi_arg (tree, basic_block); @@ -568,9 +547,6 @@ extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *); /* In tree-into-ssa.c */ extern void rewrite_into_ssa (void); -/* In tree-ssa-pre.c */ -extern void tree_perform_ssapre (tree, enum tree_dump_index); - /* In tree-ssa-ccp.c */ bool fold_stmt (tree *); tree widen_bitfield (tree, tree, tree); diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 53a67a63b85..fb7a8258f69 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -2077,7 +2077,7 @@ set_rhs (tree *stmt_p, tree expr) effects, then replace *STMT_P with an empty statement. */ stmt_ann_t ann = stmt_ann (stmt); *stmt_p = TREE_SIDE_EFFECTS (expr) ? expr : build_empty_stmt (); - (*stmt_p)->common.ann = (tree_ann) ann; + (*stmt_p)->common.ann = (tree_ann_t) ann; if (TREE_SIDE_EFFECTS (expr)) { diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 5109934c5bc..7c0aeb7dca3 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -372,16 +372,10 @@ get_value_handle (tree expr) { return SSA_NAME_VALUE (expr); } - else if (TREE_CODE_CLASS (TREE_CODE (expr)) == 'c') + else if (TREE_CODE_CLASS (TREE_CODE (expr)) == 'c' + || EXPR_P (expr)) { - cst_ann_t ann = cst_ann (expr); - if (ann) - return ann->common.value_handle; - return NULL; - } - else if (EXPR_P (expr)) - { - expr_ann_t ann = expr_ann (expr); + tree_ann_t ann = tree_ann (expr); if (ann) return ann->common.value_handle; return NULL; @@ -399,10 +393,9 @@ set_value_handle (tree e, tree v) abort (); else if (TREE_CODE (e) == SSA_NAME) SSA_NAME_VALUE (e) = v; - else if (TREE_CODE_CLASS (TREE_CODE (e)) == 'c') - get_cst_ann (e)->common.value_handle = v; - else if (EXPR_P (e)) - get_expr_ann (e)->common.value_handle = v; + else if (TREE_CODE_CLASS (TREE_CODE (e)) == 'c' + || EXPR_P (e)) + get_tree_ann (e)->common.value_handle = v; } /* A three tuple {e, pred, v} used to cache phi translations in the @@ -978,7 +971,7 @@ phi_translate (tree expr, value_set_t set, basic_block pred, { newexpr = pool_alloc (binary_node_pool); memcpy (newexpr, expr, tree_size (expr)); - create_expr_ann (newexpr); + create_tree_ann (newexpr); TREE_OPERAND (newexpr, 0) = newop1 == oldop1 ? oldop1 : get_value_handle (newop1); TREE_OPERAND (newexpr, 1) = newop2 == oldop2 ? oldop2 : get_value_handle (newop2); lookup_or_add (value_table, newexpr); @@ -1001,7 +994,7 @@ phi_translate (tree expr, value_set_t set, basic_block pred, { newexpr = pool_alloc (unary_node_pool); memcpy (newexpr, expr, tree_size (expr)); - create_expr_ann (newexpr); + create_tree_ann (newexpr); TREE_OPERAND (newexpr, 0) = get_value_handle (newop1); lookup_or_add (value_table, newexpr); expr = newexpr; diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 54597bb7973..7a703d5485d 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -594,7 +594,7 @@ adjust_return_value (basic_block bb, tree m, tree a) if (TREE_CODE (ret_var) == MODIFY_EXPR) { - ret_var->common.ann = (tree_ann) stmt_ann (ret_stmt); + ret_var->common.ann = (tree_ann_t) stmt_ann (ret_stmt); bsi_replace (&bsi, ret_var, true); SSA_NAME_DEF_STMT (TREE_OPERAND (ret_var, 0)) = ret_var; ret_var = TREE_OPERAND (ret_var, 0); -- 2.30.2