[PATCH v3 3/8] tree-object-size: Save sizes as trees and support negative offsets

Jakub Jelinek jakub@redhat.com
Fri Nov 26 16:56:34 GMT 2021


On Fri, Nov 26, 2021 at 10:58:46AM +0530, Siddhesh Poyarekar wrote:
> Transform tree-object-size to operate on tree objects instead of host
> wide integers.  This makes it easier to extend to dynamic expressions
> for object sizes.
> 
> The compute_builtin_object_size interface also now returns a tree
> expression instead of HOST_WIDE_INT, so callers have been adjusted to
> account for that.
> 
> The trees in object_sizes are each a TREE_VEC with the first element
> being the bytes from the pointer to the end of the object and the
> second, the size of the whole object.  This allows analysis of negative
> offsets, which can now be allowed to the extent of the object bounds.
> Tests have been added to verify that it actually works.

If you need pairs of trees, just use pairs of trees, using TREE_VEC for it
will create lots of extra garbage.
Either std::pair<tree, tree>, but most likely gengtype won't handle that
right, so just create your own
struct GTY(()) whatever {
  /* Comment explaining what it is.  */
  tree whatever1;
  /* Comment explaining what it is.  */
  tree whatever2;
};
and if that needs to go into e.g. object_sizes vectors, use vec<whatever>.

	Jakub



More information about the Gcc-patches mailing list