tree-ssa-structalias.c (get_constraint_for_component_ref): Use ranges_overlap_p.

2008-03-05  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-structalias.c (get_constraint_for_component_ref):
	Use ranges_overlap_p.
	(offset_overlaps_with_access): Rename
	to ranges_overlap_p and move ...
	* tree-flow-inline.h (ranges_overlap_p): ... here.

	* tree.h (get_inner_reference, handled_component_p): Update
	comments.

	* tree.h (record_component_aliases, get_alias_set,
	alias_sets_conflict_p, alias_sets_must_conflict_p,
	objects_must_conflict_p): Move declarations ...
	* alias.h (record_component_aliases, get_alias_set,
	alias_sets_conflict_p, alias_sets_must_conflict_p,
	objects_must_conflict_p): ... here.
	Include coretypes.h.
	* Makefile.in (ALIAS_H): Add coretypes.h dependency.

From-SVN: r132950
This commit is contained in:
Richard Guenther 2008-03-05 19:33:55 +00:00 committed by Richard Biener
parent ea7e6d5ae0
commit 63d195d548
6 changed files with 61 additions and 37 deletions

View file

@ -1,3 +1,23 @@
2008-03-05 Richard Guenther <rguenther@suse.de>
* tree-ssa-structalias.c (get_constraint_for_component_ref):
Use ranges_overlap_p.
(offset_overlaps_with_access): Rename
to ranges_overlap_p and move ...
* tree-flow-inline.h (ranges_overlap_p): ... here.
* tree.h (get_inner_reference, handled_component_p): Update
comments.
* tree.h (record_component_aliases, get_alias_set,
alias_sets_conflict_p, alias_sets_must_conflict_p,
objects_must_conflict_p): Move declarations ...
* alias.h (record_component_aliases, get_alias_set,
alias_sets_conflict_p, alias_sets_must_conflict_p,
objects_must_conflict_p): ... here.
Include coretypes.h.
* Makefile.in (ALIAS_H): Add coretypes.h dependency.
2008-03-05 Aldy Hernandez <aldyh@redhat.com>
* cfg.c: Include tree-flow.h.

View file

@ -790,7 +790,7 @@ GCOV_IO_H = gcov-io.h gcov-iov.h auto-host.h
COVERAGE_H = coverage.h $(GCOV_IO_H)
DEMANGLE_H = $(srcdir)/../include/demangle.h
RECOG_H = recog.h
ALIAS_H = alias.h
ALIAS_H = alias.h coretypes.h
EMIT_RTL_H = emit-rtl.h
FLAGS_H = flags.h options.h
FUNCTION_H = function.h $(TREE_H) $(HASHTAB_H)

View file

@ -20,14 +20,21 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_ALIAS_H
#define GCC_ALIAS_H
#include "coretypes.h"
/* The type of an alias set. */
typedef HOST_WIDE_INT alias_set_type;
extern alias_set_type new_alias_set (void);
extern alias_set_type get_alias_set (tree);
extern alias_set_type get_varargs_alias_set (void);
extern alias_set_type get_frame_alias_set (void);
extern bool component_uses_parent_alias_set (const_tree);
extern bool alias_set_subset_of (alias_set_type, alias_set_type);
extern void record_component_aliases (tree);
extern int alias_sets_conflict_p (alias_set_type, alias_set_type);
extern int alias_sets_must_conflict_p (alias_set_type, alias_set_type);
extern int objects_must_conflict_p (tree, tree);
extern int nonoverlapping_memrefs_p (const_rtx, const_rtx);
/* This alias set can be used to force a memory to conflict with all

View file

@ -1725,7 +1725,30 @@ var_can_have_subvars (const_tree v)
return false;
}
/* Return true, if the two ranges [POS1, SIZE1] and [POS2, SIZE2]
overlap. SIZE1 and/or SIZE2 can be (unsigned)-1 in which case the
range is open-ended. Otherwise return false. */
static inline bool
ranges_overlap_p (unsigned HOST_WIDE_INT pos1,
unsigned HOST_WIDE_INT size1,
unsigned HOST_WIDE_INT pos2,
unsigned HOST_WIDE_INT size2)
{
if (pos1 >= pos2
&& (size2 == (unsigned HOST_WIDE_INT)-1
|| pos1 < (pos2 + size2)))
return true;
if (pos2 >= pos1
&& (size1 == (unsigned HOST_WIDE_INT)-1
|| pos2 < (pos1 + size1)))
return true;
return false;
}
/* Return true if OFFSET and SIZE define a range that overlaps with some
portion of the range of SV, a subvar. If there was an exact overlap,
*EXACT will be set to true upon return. */

View file

@ -2630,25 +2630,6 @@ bitpos_of_field (const tree fdecl)
}
/* Return true if an access to [ACCESSPOS, ACCESSSIZE]
overlaps with a field at [FIELDPOS, FIELDSIZE] */
static bool
offset_overlaps_with_access (const unsigned HOST_WIDE_INT fieldpos,
const unsigned HOST_WIDE_INT fieldsize,
const unsigned HOST_WIDE_INT accesspos,
const unsigned HOST_WIDE_INT accesssize)
{
if (fieldpos == accesspos && fieldsize == accesssize)
return true;
if (accesspos >= fieldpos && accesspos < (fieldpos + fieldsize))
return true;
if (accesspos < fieldpos && (accesspos + accesssize > fieldpos))
return true;
return false;
}
/* Given a COMPONENT_REF T, return the constraint_expr for it. */
static void
@ -2713,8 +2694,8 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
varinfo_t curr;
for (curr = get_varinfo (result->var); curr; curr = curr->next)
{
if (offset_overlaps_with_access (curr->offset, curr->size,
result->offset, bitmaxsize))
if (ranges_overlap_p (curr->offset, curr->size,
result->offset, bitmaxsize))
{
result->var = curr->id;
break;

View file

@ -4564,9 +4564,13 @@ extern tree get_unwidened (tree, tree);
extern tree get_narrower (tree, int *);
/* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF,
look for nested component-refs or array-refs at constant positions
and find the ultimate containing object, which is returned. */
/* Return true if T is an expression that get_inner_reference handles. */
extern int handled_component_p (const_tree);
/* Given an expression EXP that is a handled_component_p,
look for the ultimate containing object, which is returned and specify
the access position and size. */
extern tree get_inner_reference (tree, HOST_WIDE_INT *, HOST_WIDE_INT *,
tree *, enum machine_mode *, int *, int *,
@ -4578,10 +4582,6 @@ extern tree get_inner_reference (tree, HOST_WIDE_INT *, HOST_WIDE_INT *,
extern bool contains_packed_reference (const_tree exp);
/* Return 1 if T is an expression that get_inner_reference handles. */
extern int handled_component_p (const_tree);
/* Return a tree of sizetype representing the size, in bytes, of the element
of EXP, an ARRAY_REF. */
@ -4875,13 +4875,6 @@ extern int get_pointer_alignment (tree, unsigned int);
/* In convert.c */
extern tree strip_float_extensions (tree);
/* In alias.c */
extern void record_component_aliases (tree);
extern alias_set_type get_alias_set (tree);
extern int alias_sets_conflict_p (alias_set_type, alias_set_type);
extern int alias_sets_must_conflict_p (alias_set_type, alias_set_type);
extern int objects_must_conflict_p (tree, tree);
/* In tree.c */
extern int really_constant_p (const_tree);
extern int int_fits_type_p (const_tree, const_tree);