diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2000-05-22 10:51:28 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2000-05-22 06:51:28 -0400 |
commit | a0c3333844ecd8ff6ee6a5cb3bdf4221b0a6f167 (patch) | |
tree | 5a971ff1a41b82727bc3c9c1a8d6d1a9dacb842f /gcc/alias.c | |
parent | 0dab8f8aa3ba781aeb8d6b6c49afe51e9dde78fa (diff) | |
download | gcc-a0c3333844ecd8ff6ee6a5cb3bdf4221b0a6f167.zip gcc-a0c3333844ecd8ff6ee6a5cb3bdf4221b0a6f167.tar.gz gcc-a0c3333844ecd8ff6ee6a5cb3bdf4221b0a6f167.tar.bz2 |
alias.c (record_component_aliases): New function.
* alias.c (record_component_aliases): New function.
* tree.h: Clean up some declarations and comments.
(record_component_aliases): New declaration.
* tree.c (get_alias_set): If type and has alias set, use it.
From-SVN: r34078
Diffstat (limited to 'gcc/alias.c')
-rw-r--r-- | gcc/alias.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/gcc/alias.c b/gcc/alias.c index 2f0392b8..9d3ff8b 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -271,8 +271,7 @@ insert_subset_children (node, data) not vice versa. For example, in C, a store to an `int' can alias a structure containing an `int', but not vice versa. Here, the structure would be the SUPERSET and `int' the SUBSET. This - function should be called only once per SUPERSET/SUBSET pair. At - present any given alias set may only be a subset of one superset. + function should be called only once per SUPERSET/SUBSET pair. It is illegal for SUPERSET to be zero; everything is implicitly a subset of alias set zero. */ @@ -317,6 +316,48 @@ record_alias_subset (superset, subset) (splay_tree_key) subset, 0); } +/* Record that component types of TYPE, if any, are part of that type for + aliasing purposes. For record types, we only record component types + for fields that are marked addressable. For array types, we always + record the component types, so the front end should not call this + function if the individual component aren't addressable. */ + +void +record_component_aliases (type) + tree type; +{ + int superset = get_alias_set (type); + int subset; + tree field; + + if (superset == 0) + return; + + switch (TREE_CODE (type)) + { + case ARRAY_TYPE: + case COMPLEX_TYPE: + subset = get_alias_set (TREE_TYPE (type)); + if (subset != 0) + record_alias_subset (superset, subset); + break; + + case RECORD_TYPE: + case UNION_TYPE: + case QUAL_UNION_TYPE: + for (field = TYPE_FIELDS (type); field != 0; field = TREE_CHAIN (field)) + { + subset = get_alias_set (TREE_TYPE (field)); + if (TREE_ADDRESSABLE (field) && subset != 0 && subset != superset) + record_alias_subset (superset, subset); + } + break; + + default: + break; + } +} + /* Inside SRC, the source of a SET, find a base address. */ static rtx |