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

Jakub Jelinek jakub@redhat.com
Fri Nov 26 18:04:28 GMT 2021

On Fri, Nov 26, 2021 at 11:29:41PM +0530, Siddhesh Poyarekar wrote:
> > > 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>.
> Got it, I'll make a new struct GTY(()).  I'm also using TREE_VEC to store
> PHI nodes args and the result (in patch 5/8) until they're emitted in
> gimplify_size_expressions.  It needs to be a tree since it would be stored
> in whatever1 and whatever2, would that be acceptable use?

Maybe yes, I'll need to look at it.  What I didn't like is using TREE_VEC
for something that will come in pairs all the time.


More information about the Gcc-patches mailing list