From: Richard Sandiford <richard.sandiford@arm.com>
To: Michael Matz via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Richard Biener <rguenther@suse.de>, Michael Matz <matz@suse.de>,
hubicka@ucw.cz
Subject: Re: [PATCH][RFC] Introduce TREE_AOREFWRAP to cache ao_ref in the IL
Date: Mon, 18 Oct 2021 10:58:22 +0100 [thread overview]
Message-ID: <mptwnma8xj5.fsf@arm.com> (raw)
In-Reply-To: <alpine.LSU.2.20.2110141323260.3481@wotan.suse.de> (Michael Matz via Gcc-patches's message of "Thu, 14 Oct 2021 13:29:55 +0000 (UTC)")
Michael Matz via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Hello,
>
> On Thu, 14 Oct 2021, Richard Biener wrote:
>
>> > So, at _this_ write-through of the email I think I like the above idea
>> > best: make ao_ref be a tree (at least its storage, because it currently
>> > is a one-member-function class), make ao_ref.volatile_p be
>> > tree_base.volatile_flag (hence TREE_VOLATILE(ao_ref)) (this reduces
>> > sizeof(ao_ref) by 8), increase all nr-of-operand of each tcc_reference by
>> > 1, and make TREE_AO_REF(reftree) be "TREE_OPERAND(reftree,
>> > TREE_CODE_LENGTH(reftree) - 1)", i.e. the last operand of such
>> > tcc_reference tree.
>>
>> Hmm. I'm not sure that's really something I like - it's especially
>> quite some heavy lifting while at the same time lacking true boldness
>> as to changing the representation of memory refs ;)
>
> Well, it would at least enable such changes later in an orderly fashion.
>
>> That said - I've prototyped the TREE_ASM_WRITTEN way now because it's
>> even simpler than the original TREE_AOREFWRAP approach, see below.
>>
>> Note that I'm not embedding it into the tree structure, I'm merely
>> using the same allocation to store two objects, the outermost ref
>> and the ao_ref associated with it. Quote:
>>
>> + size_t length = tree_code_size (TREE_CODE (lhs));
>> + if (!TREE_ASM_WRITTEN (lhs))
>> + {
>> + tree alt_lhs
>> + = ggc_alloc_cleared_tree_node_stat (length + sizeof (ao_ref));
>> + memcpy (alt_lhs, lhs, length);
>> + TREE_ASM_WRITTEN (alt_lhs) = 1;
>> + *ref = new ((char *)alt_lhs + length) ao_ref;
>
> You need to ensure that alt_lhs+length is properly aligned for ao_ref, but
> yeah, for a hack that works. If you really want to go that way you need
> good comments about this hack. It's really somewhat worrisome that the
> size of the allocation depends on a bit in tree_base.
>
> (It's a really cute hack that works as a micro optimization, the question
> is, do we really need to go there already, are all other less hacky
> approaches not bringing similar improvements? The cuter the hacks the
> less often they pay off in the long run of production software :) )
FWIW, having been guilty of adding a similar hack(?) to SYMBOL_REFs
for block_symbol, I like the approach of concatenating/combining structures
based on flags. The main tree and rtl types have too much baggage and
so I think there are some things that are better represented outside
of them.
I suppose cselib VALUE rtxes are also similar, although they're more
of a special case, since cselib data doesn't survive between passes.
Thanks,
Richard
next prev parent reply other threads:[~2021-10-18 9:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 10:24 Richard Biener
2021-10-13 14:57 ` Michael Matz
2021-10-14 13:13 ` Richard Biener
2021-10-14 13:29 ` Michael Matz
2021-10-18 9:58 ` Richard Sandiford [this message]
2021-10-18 13:14 ` Michael Matz
2021-10-18 13:30 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mptwnma8xj5.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=matz@suse.de \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).