summaryrefslogtreecommitdiff
path: root/gcc/alias.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-22 10:51:28 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-22 10:51:28 +0000
commit9501a338193d5a68c1c1e5328ef23a988c591e97 (patch)
tree5a971ff1a41b82727bc3c9c1a8d6d1a9dacb842f /gcc/alias.c
parent111f23890394d3c2902d922ef63048d640cf6a80 (diff)
downloadgcc-9501a338193d5a68c1c1e5328ef23a988c591e97.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34078 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/alias.c')
-rw-r--r--gcc/alias.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/gcc/alias.c b/gcc/alias.c
index 2f0392b8388..9d3ff8bca0e 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