From patchwork Thu Jun 14 23:21:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: ARM: exclude fixed_regs for stack-alignment save/restore Date: Thu, 14 Jun 2012 13:21:29 -0000 From: Roland McGrath X-Patchwork-Id: 165026 Message-Id: To: Mike Stump Cc: gcc-patches@gcc.gnu.org Here's the version of the change that incorporates Mike's suggestion. Thanks, Roland gcc/ 2012-06-14 Roland McGrath * config/arm/arm.c (arm_get_frame_offsets): Never use a fixed register as the extra register to save/restore for stack-alignment padding. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 092e202..13771d9 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -16752,7 +16752,12 @@ arm_get_frame_offsets (void) else for (i = 4; i <= (TARGET_THUMB1 ? LAST_LO_REGNUM : 11); i++) { - if ((offsets->saved_regs_mask & (1 << i)) == 0) + /* While the gratuitous register save/restore is ordinarily + harmless, if a register is marked as fixed or global it + may be entirely forbidden by the system ABI to touch it, + so we should avoid those registers. */ + if (!fixed_regs[i] && !global_regs[i] + && (offsets->saved_regs_mask & (1 << i)) == 0) { reg = i; break;