From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27155 invoked by alias); 21 Sep 2015 01:53:08 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 27103 invoked by uid 48); 21 Sep 2015 01:53:04 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67660] New: [SH] Automatically insert atomic rewind code into ISR prologue Date: Mon, 21 Sep 2015 01:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone cf_gcctarget Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg01620.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67660 Bug ID: 67660 Summary: [SH] Automatically insert atomic rewind code into ISR prologue Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target Milestone: --- Target: sh*-*-* 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".