Commit a0c33338 by Richard Kenner Committed by Richard Kenner

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
parent 0dab8f8a
Mon May 22 06:57:49 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* 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.
2000-05-22 Richard Henderson <rth@cygnus.com>
* simplify-rtx.c (simplify_ternary_operation): Try to simplify
......@@ -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
......
......@@ -5621,10 +5621,15 @@ int
get_alias_set (t)
tree t;
{
/* If we're not doing any lanaguage-specific alias analysis, just
assume everything aliases everything else. */
if (! flag_strict_aliasing || lang_get_alias_set == 0)
/* If we're not doing any lanaguage-specific alias analysis, just
assume everything aliases everything else. */
return 0;
/* If this is a type with a known alias set, return it since this must
be the correct thing to do. */
else if (TYPE_P (t) && TYPE_ALIAS_SET_KNOWN_P (t))
return TYPE_ALIAS_SET (t);
else
return (*lang_get_alias_set) (t);
}
......
......@@ -2605,18 +2605,17 @@ extern void rest_of_type_compilation PARAMS ((tree, int));
extern void push_obstacks_nochange PARAMS ((void));
extern void permanent_allocation PARAMS ((int));
extern void push_momentary PARAMS ((void));
extern void clear_momentary PARAMS ((void));
extern void pop_momentary PARAMS ((void));
extern void end_temporary_allocation PARAMS ((void));
/* Pop the obstack selection stack. */
extern void pop_obstacks PARAMS ((void));
/* In alias.c */
void record_component_aliases PARAMS ((tree));
/* In tree.c */
extern int really_constant_p PARAMS ((tree));
extern void push_obstacks PARAMS ((struct obstack *,
......@@ -2654,10 +2653,12 @@ extern void dump_tree_statistics PARAMS ((void));
extern void print_obstack_statistics PARAMS ((const char *,
struct obstack *));
#ifdef BUFSIZ
extern void print_obstack_name PARAMS ((char *, FILE *, const char *));
extern void print_obstack_name PARAMS ((char *, FILE *,
const char *));
#endif
extern void expand_function_end PARAMS ((const char *, int, int));
extern void expand_function_start PARAMS ((tree, int));
extern int real_onep PARAMS ((tree));
extern int real_twop PARAMS ((tree));
extern void start_identifier_warnings PARAMS ((void));
......@@ -2707,8 +2708,10 @@ extern void print_rtl PARAMS ((FILE *, struct rtx_def *));
/* In print-tree.c */
extern void debug_tree PARAMS ((tree));
#ifdef BUFSIZ
extern void print_node PARAMS ((FILE *, const char *, tree, int));
extern void print_node_brief PARAMS ((FILE *, const char *, tree, int));
extern void print_node PARAMS ((FILE *, const char *, tree,
int));
extern void print_node_brief PARAMS ((FILE *, const char *, tree,
int));
extern void indent_to PARAMS ((FILE *, int));
#endif
......@@ -2718,8 +2721,10 @@ extern int apply_args_register_offset PARAMS ((int));
extern struct rtx_def *expand_builtin_return_addr
PARAMS ((enum built_in_function, int, struct rtx_def *));
extern void do_pending_stack_adjust PARAMS ((void));
extern struct rtx_def *expand_assignment PARAMS ((tree, tree, int, int));
extern struct rtx_def *store_expr PARAMS ((tree, struct rtx_def *,
extern struct rtx_def *expand_assignment PARAMS ((tree, tree, int,
int));
extern struct rtx_def *store_expr PARAMS ((tree,
struct rtx_def *,
int));
extern void check_max_integer_computation_mode PARAMS ((tree));
......@@ -2732,21 +2737,15 @@ extern struct rtx_def *emit_line_note_force PARAMS ((const char *, int));
/* In calls.c */
/* Flags used by special_function_p. */
extern int setjmp_call_p PARAMS ((tree));
/* In c-typeck.c */
/* In front end. */
extern int mark_addressable PARAMS ((tree));
extern void incomplete_type_error PARAMS ((tree, tree));
/* In c-lang.c */
extern void print_lang_statistics PARAMS ((void));
/* In c-common.c */
extern tree truthvalue_conversion PARAMS ((tree));
extern void split_specs_attrs PARAMS ((tree, tree *, tree *));
/* In c-decl.c */
#ifdef BUFSIZ
extern void print_lang_decl PARAMS ((FILE *, tree, int));
extern void print_lang_type PARAMS ((FILE *, tree, int));
......@@ -2762,7 +2761,7 @@ extern void set_decl_abstract_flags PARAMS ((tree, int));
extern void output_inline_function PARAMS ((tree));
extern void set_decl_origin_self PARAMS ((tree));
/* In c-lex.c */
/* In front end. */
extern void set_yydebug PARAMS ((int));
/* In stor-layout.c */
......
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