This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Move some alias stuff
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 5 Mar 2008 20:32:20 +0100 (CET)
- Subject: [PATCH] Move some alias stuff
This is the move-things-around part of the SCCVN alias oracle patch.
Separated out, bootstrapped and tested on x86_64-unknown-linux-gnu,
applied to trunk.
Richard.
2007-12-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.
Index: trunk/gcc/tree-flow-inline.h
===================================================================
*** trunk.orig/gcc/tree-flow-inline.h 2008-03-03 11:28:17.000000000 +0100
--- trunk/gcc/tree-flow-inline.h 2008-03-03 15:05:56.000000000 +0100
*************** var_can_have_subvars (const_tree v)
*** 1725,1731 ****
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. */
--- 1725,1754 ----
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. */
Index: trunk/gcc/tree-ssa-structalias.c
===================================================================
*** trunk.orig/gcc/tree-ssa-structalias.c 2008-03-03 14:59:40.000000000 +0100
--- trunk/gcc/tree-ssa-structalias.c 2008-03-03 15:05:56.000000000 +0100
*************** bitpos_of_field (const tree fdecl)
*** 2630,2654 ****
}
- /* 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
--- 2630,2635 ----
*************** get_constraint_for_component_ref (tree t
*** 2713,2720 ****
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))
{
result->var = curr->id;
break;
--- 2694,2701 ----
varinfo_t curr;
for (curr = get_varinfo (result->var); curr; curr = curr->next)
{
! if (ranges_overlap_p (curr->offset, curr->size,
! result->offset, bitmaxsize))
{
result->var = curr->id;
break;
Index: trunk/gcc/tree.h
===================================================================
*** trunk.orig/gcc/tree.h 2008-03-03 14:59:40.000000000 +0100
--- trunk/gcc/tree.h 2008-03-03 15:12:51.000000000 +0100
*************** extern tree get_unwidened (tree, tree);
*** 4564,4572 ****
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. */
extern tree get_inner_reference (tree, HOST_WIDE_INT *, HOST_WIDE_INT *,
tree *, enum machine_mode *, int *, int *,
--- 4564,4576 ----
extern tree get_narrower (tree, int *);
! /* 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 *,
*************** extern tree get_inner_reference (tree, H
*** 4578,4587 ****
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. */
--- 4582,4587 ----
*************** extern int get_pointer_alignment (tree,
*** 4875,4887 ****
/* 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);
--- 4875,4880 ----
Index: trunk/gcc/alias.h
===================================================================
*** trunk.orig/gcc/alias.h 2008-02-26 10:52:21.000000000 +0100
--- trunk/gcc/alias.h 2008-03-03 15:06:58.000000000 +0100
*************** along with GCC; see the file COPYING3.
*** 20,33 ****
--- 20,40 ----
#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
Index: trunk/gcc/Makefile.in
===================================================================
*** trunk.orig/gcc/Makefile.in 2008-03-03 11:28:17.000000000 +0100
--- trunk/gcc/Makefile.in 2008-03-03 15:12:34.000000000 +0100
*************** GCOV_IO_H = gcov-io.h gcov-iov.h auto-ho
*** 790,796 ****
COVERAGE_H = coverage.h $(GCOV_IO_H)
DEMANGLE_H = $(srcdir)/../include/demangle.h
RECOG_H = recog.h
! ALIAS_H = alias.h
EMIT_RTL_H = emit-rtl.h
FLAGS_H = flags.h options.h
FUNCTION_H = function.h $(TREE_H) $(HASHTAB_H)
--- 790,796 ----
COVERAGE_H = coverage.h $(GCOV_IO_H)
DEMANGLE_H = $(srcdir)/../include/demangle.h
RECOG_H = recog.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)