public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Question on not sharing trees (tree_node_can_be_shared)
@ 2022-03-21 10:56 Erick Ochoa
  2022-03-21 13:39 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Erick Ochoa @ 2022-03-21 10:56 UTC (permalink / raw)
  To: richard.guenther, gcc

Hi,

I am interested in annotating INTEGER_CSTs. I have added a field to
typed_trees and set the value in some cases. However, INTEGER_CSTs can be
shared and copied across the function and even copied to other functions. I
don't want all INTEGER_CSTs with the same value to be shared as now they
have an annotation which may make them somewhat unique. My question is, is
there a way to disable sharing of INTEGER_CSTs?

I have tried modifying tree_node_can_be_shared to return false when the
argument is an INTEGER_CST. However, the verifier then fails stating that
there was an incorrect sharing of tree nodes. My intuition tells me that
this means that some pass assumes that INTEGER_CSTs can be shared and
therefore the information gets copied. However, during the verifier this
gets caught and returns an error. Is this correct? How would one go around
and disable sharing INTEGER_CSTs?

Is there a tree comparison for INTEGER_CSTs that I can set such that if an
INTEGER_CST has my field set then it registers as a different INTEGER_CST
even if they have the same constant value?

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question on not sharing trees (tree_node_can_be_shared)
  2022-03-21 10:56 Question on not sharing trees (tree_node_can_be_shared) Erick Ochoa
@ 2022-03-21 13:39 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-03-21 13:39 UTC (permalink / raw)
  To: Erick Ochoa; +Cc: GCC Development

On Mon, Mar 21, 2022 at 11:56 AM Erick Ochoa <eochoa@gcc.gnu.org> wrote:
>
> Hi,
>
> I am interested in annotating INTEGER_CSTs. I have added a field to typed_trees and set the value in some cases. However, INTEGER_CSTs can be shared and copied across the function and even copied to other functions. I don't want all INTEGER_CSTs with the same value to be shared as now they have an annotation which may make them somewhat unique. My question is, is there a way to disable sharing of INTEGER_CSTs?

Not really.  There's a special "kind" of INTEGER_CSTs not shared,
those with TREE_OVERFLOW set.

But I'd advise against un-sharing of INTEGER_CSTs, can't you annotate
sth higher level up?

>
> I have tried modifying tree_node_can_be_shared to return false when the argument is an INTEGER_CST. However, the verifier then fails stating that there was an incorrect sharing of tree nodes. My intuition tells me that this means that some pass assumes that INTEGER_CSTs can be shared and therefore the information gets copied. However, during the verifier this gets caught and returns an error. Is this correct? How would one go around and disable sharing INTEGER_CSTs?
>
> Is there a tree comparison for INTEGER_CSTs that I can set such that if an INTEGER_CST has my field set then it registers as a different INTEGER_CST even if they have the same constant value?
>
> Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-21 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 10:56 Question on not sharing trees (tree_node_can_be_shared) Erick Ochoa
2022-03-21 13:39 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).