+2004-06-18 Daniel Berlin <dberlin@dberlin.org>
+ Diego Novillo <dnovillo@redhat.com>
+
+ * 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 <kkojima@gcc.gnu.org>
* config/sh/t-linux64: New file.
ann->common.type = VAR_ANN;
- t->common.ann = (tree_ann) ann;
+ t->common.ann = (tree_ann_t) ann;
return ann;
}
/* 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;
}
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
/* 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;
}
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 */
/*---------------------------------------------------------------------------
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(())
{
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);
/* 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);
/* 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);
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))
{
{
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;
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
{
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);
{
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;
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);