summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-05 19:33:55 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-05 19:33:55 +0000
commita306ee43540f4e4782dff4a4e09d1befa205405e (patch)
tree42fdab63279de985eda1b5dc05468e61bbddbb5d
parentd03ba86f0cc373f30e8838c73e598cc767491b92 (diff)
downloadgcc-a306ee43540f4e4782dff4a4e09d1befa205405e.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132950 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog20
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/alias.h7
-rw-r--r--gcc/tree-flow-inline.h25
-rw-r--r--gcc/tree-ssa-structalias.c23
-rw-r--r--gcc/tree.h21
6 files changed, 61 insertions, 37 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fd052fbe3a5..d53c99461c8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 4522e1dffbf..8e4daf52eda 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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)
diff --git a/gcc/alias.h b/gcc/alias.h
index 772aea09010..b9d954eea02 100644
--- a/gcc/alias.h
+++ b/gcc/alias.h
@@ -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
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index 7bc21b8bd3d..d8593bd19d3 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -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. */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 70a9d3212c6..31ab38f8cfa 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -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;
diff --git a/gcc/tree.h b/gcc/tree.h
index 02682683769..d59d3fa9a3b 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -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);