From: Daniel Santos <daniel.santos@pobox.com>
To: Bernd Edlinger <bernd.edlinger@hotmail.de>,
Uros Bizjak <ubizjak@gmail.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] [i386] Recompute the frame layout less often
Date: Sun, 14 May 2017 20:37:00 -0000 [thread overview]
Message-ID: <6ec28d93-d2a5-5cba-0fac-0ea950f44bf1@pobox.com> (raw)
In-Reply-To: <AM4PR0701MB2162D3540559BE802A5C44C0E4E00@AM4PR0701MB2162.eurprd07.prod.outlook.com>
On 05/14/2017 11:31 AM, Bernd Edlinger wrote:
> Hi Daniel,
>
> there is one thing I don't understand in your patch:
> That is, it introduces a static value:
>
> /* Registers who's save & restore will be managed by stubs called from
> pro/epilogue. */
> static HARD_REG_SET GTY(()) stub_managed_regs;
>
> This seems to be set as a side effect of ix86_compute_frame_layout,
> and depends on the register usage of the current function.
> But values that depend on the current function need usually be
> attached to cfun->machine, because the passes can run in parallel
> unless I am completely mistaken, and the stub_managed_regs may
> therefore be computed from a different function.
>
>
> Bernd.
I'm relatively new to GCC and still learning. However, there are quite
a lot of static TU variables in i386.c like this. I am not aware of gcc
having parallelism support, but if it were to be added then all of these
TU variables should probably be moved to some class or struct (like
cfun->machine) to reduce the number of TLS lookups required (which I
presume is a little more expensive than a this/offset calculation).
Having this (as well as other variables) in such a struct is better
design IMO, but as I said, I'm still learning GCC's architecture, idioms
and patterns. (I should add that I don't really understand the GTY
memory management either. :)
To be clear on class xlogue_layout, the only instances of this class are
const and could be shared across multiple threads. It is dependent upon
the cfun->machine as well as the global struct rtl_data crtl, but is not
so entangled that were these proper C++ classes (with private data) that
it would need to be a friend -- it only needs read-access to their data
members.
To be honest, it's a strange feeling programming in a mixture of C and
C++ idioms, but I know it was only recently converted to C++ so I think
it's better to try to use only one or the other in a given function.
But if I were going to do this all OO, then ix86_compute_frame_layout
would be a member function of ix86_frame (which would be a
specialization of some generic "frame" class), machine_function would be
class ix86_machine_function with it's own compute_frame_layout that
called ix86_frame::compute_frame_layout, etc. If I really wanted to go
nuts, I would consider making class function, et.al. template classes
with machine_function and machine_function_state part of the object
instead of pointers to separate objects to reduce accesses down to a
single this/offset, but now I I'm *really* digressing...
Please free to move it.
Thanks,
Daniel
next prev parent reply other threads:[~2017-05-14 20:20 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-14 9:11 Bernd Edlinger
2017-05-14 9:58 ` Daniel Santos
2017-05-14 10:27 ` Uros Bizjak
2017-05-14 18:11 ` Bernd Edlinger
2017-05-14 20:37 ` Daniel Santos [this message]
2017-05-15 2:23 ` Daniel Santos
2017-05-15 20:41 ` Bernd Edlinger
2017-05-15 23:52 ` Daniel Santos
2017-05-16 5:42 ` Daniel Santos
2017-05-16 8:52 ` Bernd Edlinger
2017-05-16 15:11 ` Daniel Santos
2017-05-16 17:38 ` Ian Lance Taylor via gcc-patches
2017-05-16 20:10 ` Bernd Edlinger
2017-05-16 21:05 ` Bernd Edlinger
2017-05-17 2:12 ` Daniel Santos
2017-05-17 17:43 ` Bernd Edlinger
2017-05-18 7:05 ` Daniel Santos
2017-05-18 13:48 ` Bernd Edlinger
2017-05-19 3:13 ` Daniel Santos
2017-05-22 18:32 ` Bernd Edlinger
2017-05-23 14:34 ` Bernd Edlinger
2017-05-24 6:49 ` Daniel Santos
2017-06-01 16:06 ` [PING][PATCH] " Bernd Edlinger
2017-06-01 18:18 ` [PATCH] " Uros Bizjak
2017-05-23 23:01 ` Daniel Santos
2017-05-16 21:35 ` Daniel Santos
2017-05-17 18:41 ` Bernd Edlinger
2017-05-18 7:14 ` Daniel Santos
2017-05-19 5:12 ` Daniel Santos
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=6ec28d93-d2a5-5cba-0fac-0ea950f44bf1@pobox.com \
--to=daniel.santos@pobox.com \
--cc=bernd.edlinger@hotmail.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=ubizjak@gmail.com \
/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).