From: Alexander Monakov <amonakov@ispras.ru>
To: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Cc: gcc@gcc.gnu.org
Subject: Re: [RFC] Disabling ICF for interrupt functions
Date: Fri, 19 Jul 2019 13:32:00 -0000 [thread overview]
Message-ID: <alpine.LNX.2.20.13.1907191617110.29891@monopod.intra.ispras.ru> (raw)
In-Reply-To: <20190719134511.3d9101e5@jozef-kubuntu>
On Fri, 19 Jul 2019, Jozef Lawrynowicz wrote:
> For MSP430, the folding of identical functions marked with the "interrupt"
> attribute by -fipa-icf-functions results in wrong code being generated.
> Interrupts have different calling conventions than regular functions, so
> inserting a CALL from one identical interrupt to another is not correct and
> will result in stack corruption.
But ICF by creating an alias would be fine, correct? As I understand, the
real issue here is that gcc does not know how to correctly emit a call to
"interrupt" functions (because they have unusual ABI and exist basically to
have their address stored somewhere).
So I think the solution shouldn't be in disabling ICF altogether, but rather
in adding a way to recognize that a function has quasi-unknown ABI and thus
not directly callable (so any other optimization can see that it may not emit
a call to this function), then teaching ICF to check that when deciding to
fold by creating a wrapper.
(would it be possible to tell ICF that addresses of interrupt functions are
not significant so it can fold them by creating aliases?)
Alexander
next prev parent reply other threads:[~2019-07-19 13:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 12:45 Jozef Lawrynowicz
2019-07-19 13:32 ` Alexander Monakov [this message]
2019-07-22 17:01 ` Jozef Lawrynowicz
2019-07-22 18:50 ` Alexander Monakov
2019-07-26 17:39 ` Richard Sandiford
2019-07-30 13:41 ` Jozef Lawrynowicz
2019-07-31 9:50 ` Richard Biener
2019-07-31 12:22 ` Jozef Lawrynowicz
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=alpine.LNX.2.20.13.1907191617110.29891@monopod.intra.ispras.ru \
--to=amonakov@ispras.ru \
--cc=gcc@gcc.gnu.org \
--cc=jozef.l@mittosystems.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).