aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-12-21 07:02:28 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-12-21 07:02:28 +0000
commit0ddcd294d54bf049bb48fd7face88a1d8254877f (patch)
treecab559861d82df23cb110c4a88e09d7c00fcea80
parentf7ed31955b00970413b202e0b4c3144aeec136d5 (diff)
downloadgcc-0ddcd294d54bf049bb48fd7face88a1d8254877f.zip
gcc-0ddcd294d54bf049bb48fd7face88a1d8254877f.tar.gz
gcc-0ddcd294d54bf049bb48fd7face88a1d8254877f.tar.bz2
poly_int: get_binfo_at_offset
This patch changes the offset parameter to get_binfo_at_offset from HOST_WIDE_INT to poly_int64. This function probably doesn't need to handle polynomial offsets in practice, but it's easy to do and avoids forcing the caller to check first. 2017-12-21 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * tree.h (get_binfo_at_offset): Take the offset as a poly_int64 rather than a HOST_WIDE_INT. * tree.c (get_binfo_at_offset): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255932
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree.c8
-rw-r--r--gcc/tree.h2
3 files changed, 13 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d206c34..9aa16a3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -2,6 +2,14 @@
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
+ * tree.h (get_binfo_at_offset): Take the offset as a poly_int64
+ rather than a HOST_WIDE_INT.
+ * tree.c (get_binfo_at_offset): Likewise.
+
+2017-12-21 Richard Sandiford <richard.sandiford@linaro.org>
+ Alan Hayward <alan.hayward@arm.com>
+ David Sherwood <david.sherwood@arm.com>
+
* ipa-prop.h (build_ref_for_offset): Take the offset as a poly_int64
rather than a HOST_WIDE_INT.
* tree-sra.c (build_ref_for_offset): Likewise.
diff --git a/gcc/tree.c b/gcc/tree.c
index 97c9f81..aa647de 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -12351,7 +12351,7 @@ lookup_binfo_at_offset (tree binfo, tree type, HOST_WIDE_INT pos)
found, return, otherwise return NULL_TREE. */
tree
-get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
+get_binfo_at_offset (tree binfo, poly_int64 offset, tree expected_type)
{
tree type = BINFO_TYPE (binfo);
@@ -12363,7 +12363,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
if (types_same_for_odr (type, expected_type))
return binfo;
- if (offset < 0)
+ if (maybe_lt (offset, 0))
return NULL_TREE;
for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
@@ -12373,7 +12373,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
pos = int_bit_position (fld);
size = tree_to_uhwi (DECL_SIZE (fld));
- if (pos <= offset && (pos + size) > offset)
+ if (known_in_range_p (offset, pos, size))
break;
}
if (!fld || TREE_CODE (TREE_TYPE (fld)) != RECORD_TYPE)
@@ -12381,7 +12381,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
/* Offset 0 indicates the primary base, whose vtable contents are
represented in the binfo for the derived class. */
- else if (offset != 0)
+ else if (maybe_ne (offset, 0))
{
tree found_binfo = NULL, base_binfo;
/* Offsets in BINFO are in bytes relative to the whole structure
diff --git a/gcc/tree.h b/gcc/tree.h
index e8a2470..aedd48d 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4856,7 +4856,7 @@ extern void tree_set_block (tree, tree);
extern location_t *block_nonartificial_location (tree);
extern location_t tree_nonartificial_location (tree);
extern tree block_ultimate_origin (const_tree);
-extern tree get_binfo_at_offset (tree, HOST_WIDE_INT, tree);
+extern tree get_binfo_at_offset (tree, poly_int64, tree);
extern bool virtual_method_call_p (const_tree);
extern tree obj_type_ref_class (const_tree ref);
extern bool types_same_for_odr (const_tree type1, const_tree type2,