diff options
| author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-01 18:43:02 +0000 |
|---|---|---|
| committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-01 18:43:02 +0000 |
| commit | 9ea9fcf0bcb5d466a36bd6ecd5536e09f1d53dc9 (patch) | |
| tree | 991227bc41638e17a027fb12fa3ce93c50321a30 | |
| parent | 51d8e657d0087d91e4000f241de335121ea3810d (diff) | |
| download | ppe42-gcc-9ea9fcf0bcb5d466a36bd6ecd5536e09f1d53dc9.tar.gz ppe42-gcc-9ea9fcf0bcb5d466a36bd6ecd5536e09f1d53dc9.zip | |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100458 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 7 | ||||
| -rw-r--r-- | gcc/fold-const.c | 2 | ||||
| -rw-r--r-- | gcc/tree-inline.c | 18 | ||||
| -rw-r--r-- | gcc/tree.h | 1 |
4 files changed, 20 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index adfecf5de16..29603148a2c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +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> * common.opt (fjump-tables): New. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 13984d1c8be..ad5039bba6e 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -11508,7 +11508,7 @@ build_fold_addr_expr (tree t) of an indirection through OP0, or NULL_TREE if no simplification is possible. */ -static tree +tree fold_indirect_ref_1 (tree type, tree op0) { tree sub = op0; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 224004e0ebd..28bdf6cc478 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -615,13 +615,17 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) it manually here as we'll eventually get ADDR_EXPRs which lie about their types pointed to. In this case build_fold_indirect_ref wouldn't strip the INDIRECT_REF, - but we absolutely rely on that. */ - if (TREE_CODE ((tree)n->value) == ADDR_EXPR) - *tp = TREE_OPERAND ((tree)n->value, 0); - else - *tp = build1 (INDIRECT_REF, - TREE_TYPE (TREE_TYPE ((tree)n->value)), - (tree)n->value); + but we absolutely rely on that. As fold_indirect_ref + does other useful transformations, try that first, though. */ + tree type = TREE_TYPE (TREE_TYPE ((tree)n->value)); + *tp = fold_indirect_ref_1 (type, (tree)n->value); + if (! *tp) + { + 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; return NULL; } diff --git a/gcc/tree.h b/gcc/tree.h index e842f694025..c9fdb9336c3 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -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_ignored_result (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); |

