Commit 095ecc24 by Richard Guenther Committed by Richard Biener

tree.h (fold_indirect_ref_1): Export from fold-const.c.

2005-06-01  Richard Guenther  <rguenth@gcc.gnu.org>

	* tree.h (fold_indirect_ref_1): Export from fold-const.c.
	* fold-const.c (fold_indirect_ref_1): No longer static.
	* tree-inline.c (copy_body_r): Use fold_indirect_ref_1 for
	folding, if possible.

From-SVN: r100458
parent 82c0180d
2005-06-01 Richard Guenther <rguenth@gcc.gnu.org>
* tree.h (fold_indirect_ref_1): Export from fold-const.c.
* fold-const.c (fold_indirect_ref_1): No longer static.
* tree-inline.c (copy_body_r): Use fold_indirect_ref_1 for
folding, if possible.
2005-06-01 Joseph S. Myers <joseph@codesourcery.com> 2005-06-01 Joseph S. Myers <joseph@codesourcery.com>
* common.opt (fjump-tables): New. * common.opt (fjump-tables): New.
......
...@@ -11508,7 +11508,7 @@ build_fold_addr_expr (tree t) ...@@ -11508,7 +11508,7 @@ build_fold_addr_expr (tree t)
of an indirection through OP0, or NULL_TREE if no simplification is of an indirection through OP0, or NULL_TREE if no simplification is
possible. */ possible. */
static tree tree
fold_indirect_ref_1 (tree type, tree op0) fold_indirect_ref_1 (tree type, tree op0)
{ {
tree sub = op0; tree sub = op0;
......
...@@ -615,13 +615,17 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) ...@@ -615,13 +615,17 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
it manually here as we'll eventually get ADDR_EXPRs it manually here as we'll eventually get ADDR_EXPRs
which lie about their types pointed to. In this case which lie about their types pointed to. In this case
build_fold_indirect_ref wouldn't strip the INDIRECT_REF, build_fold_indirect_ref wouldn't strip the INDIRECT_REF,
but we absolutely rely on that. */ but we absolutely rely on that. As fold_indirect_ref
if (TREE_CODE ((tree)n->value) == ADDR_EXPR) does other useful transformations, try that first, though. */
*tp = TREE_OPERAND ((tree)n->value, 0); tree type = TREE_TYPE (TREE_TYPE ((tree)n->value));
else *tp = fold_indirect_ref_1 (type, (tree)n->value);
*tp = build1 (INDIRECT_REF, if (! *tp)
TREE_TYPE (TREE_TYPE ((tree)n->value)), {
(tree)n->value); if (TREE_CODE ((tree)n->value) == ADDR_EXPR)
*tp = TREE_OPERAND ((tree)n->value, 0);
else
*tp = build1 (INDIRECT_REF, type, (tree)n->value);
}
*walk_subtrees = 0; *walk_subtrees = 0;
return NULL; return NULL;
} }
......
...@@ -3539,6 +3539,7 @@ extern tree fold_convert (tree, tree); ...@@ -3539,6 +3539,7 @@ extern tree fold_convert (tree, tree);
extern tree fold_single_bit_test (enum tree_code, tree, tree, tree); extern tree fold_single_bit_test (enum tree_code, tree, tree, tree);
extern tree fold_ignored_result (tree); extern tree fold_ignored_result (tree);
extern tree fold_abs_const (tree, tree); extern tree fold_abs_const (tree, tree);
extern tree fold_indirect_ref_1 (tree, tree);
extern tree force_fit_type (tree, int, bool, bool); extern tree force_fit_type (tree, int, bool, bool);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment