Bug 67660 - [SH] Automatically insert atomic rewind code into ISR prologue
Summary: [SH] Automatically insert atomic rewind code into ISR prologue
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-21 01:53 UTC by Oleg Endo
Modified: 2019-06-14 19:21 UTC (History)
0 users

See Also:
Host:
Target: sh*-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Endo 2015-09-21 01:53:03 UTC
This has been originally mentioned here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50457#c16

however it's not really SH2A specific, but rather specific to gUSA-like atomic sequences which need rewinding.

The basic idea is to make the compiler automatically emit the proper atomic rewind code into the ISR prologue, if it is actually needed.  For example, if the ISR doesn't touch anything atomic and contains no function calls, it can be omitted, in a similar way as it's done for FP regs save/store.

This can be useful for bare-metal systems when atomics are used to access shared state from normal code and ISRs.  Probably the easiest way to do that is via an additional function attribute, like "rewind_atomics".
Comment 1 Oleg Endo 2015-09-21 08:30:42 UTC
Just a note ...
It might also make sense to tell the compiler (via function attribute) whether the ISR is re-entrant or not.  On a single-core system, atomic ops in an ISR can be converted into normal load-modify-store ops if the ISR context can't be interrupted.