From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28104 invoked by alias); 11 Oct 2015 15:16:35 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 28081 invoked by uid 89); 11 Oct 2015 15:16:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_05,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: COL004-OMC3S15.hotmail.com Received: from col004-omc3s15.hotmail.com (HELO COL004-OMC3S15.hotmail.com) (65.55.34.153) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA256 encrypted) ESMTPS; Sun, 11 Oct 2015 15:16:32 +0000 Received: from COL130-W50 ([65.55.34.137]) by COL004-OMC3S15.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Sun, 11 Oct 2015 08:16:30 -0700 X-TMN: [jtp5f3AuMUBqEy5IEROJKp+UBxZ0wFCi] Message-ID: From: Chen Gang To: Jeff Law , Richard Henderson , "Joseph S. Myers" CC: gcc-patches List Subject: [PATCH] gcc/ira.c: Check !HAVE_FP_INSTEAD_INSNS when frame pointer is needed and as global register Date: Sun, 11 Oct 2015 15:16:00 -0000 In-Reply-To: <561A7D5C.40409@hotmail.com> References: <561A7D5C.40409@hotmail.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg01073.txt.bz2 =46rom fadd991f87dbd5752e9b6a2cce300dfe7cc8af25 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Sun, 11 Oct 2015 22:59:35 +0800 Subject: [PATCH] gcc/ira.c: Check !HAVE_FP_INSTEAD_INSNS when frame pointer= is needed and as global register For some architectures (e.g. bfin), when this case occurs, they will use another instructions instead of frame pointer (e.g. LINK for bfin), so they can still generate correct output assembly code. 2015-10-11 =A0Chen Gang =A0 gcc/ * config.in: Add HAVE_FP_INSTEAD_INSNS. * configure: Check HAVE_FP_INSTEAD_INSNS to set 0 or 1. * ira.c: Check !HAVE_FP_INSTEAD_INSNS when frame pointer is needed and as global register. --- =A0gcc/config.in | =A05 +++++ =A0gcc/configure | 18 ++++++++++++++++++ =A0gcc/ira.c =A0 =A0 | =A03 ++- =A03 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/config.in b/gcc/config.in index 093478c..97f5957 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1154,6 +1154,11 @@ =A0#undef HAVE_FWRITE_UNLOCKED =A0#endif =A0 +/* Define 0/1 if your machine supports frame pointer instead instructions.= */ +#ifndef USED_FOR_TARGET +#undef HAVE_FP_INSTEAD_INSNS +#endif + =A0 =A0/* Define if your assembler supports specifying the alignment of objects =A0 =A0 allocated using the GAS .comm command. */ diff --git a/gcc/configure b/gcc/configure index f6ae9906..a1aa430 100755 --- a/gcc/configure +++ b/gcc/configure @@ -22356,6 +22356,24 @@ fi =A0{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_flags">&5 =A0$as_echo "$gcc_cv_as_flags">&6; } =A0 +# Check if the target have frame pointer instead instructions +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target frame pointer ins= tead instructions">&5 +$as_echo_n "checking target frame pointer instead instructions...">&6; } +case "$cpu_type" in + =A0bfin) + =A0 =A0gcc_cv_fp_instead=3D"yes" + =A0 =A0;; + =A0*) + =A0 =A0gcc_cv_fp_instead=3D"no" + =A0 =A0;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_fp_instead">&5 +$as_echo "$gcc_cv_fp_instead">&6; } + +cat>>confdefs.h <<_ACEOF +#define HAVE_FP_INSTEAD_INSNS `if test $gcc_cv_fp_instead =3D yes; then ec= ho 1; else echo 0; fi` +_ACEOF + =A0{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .balign = and .p2align">&5 =A0$as_echo_n "checking assembler for .balign and .p2align... ">&6; } =A0if test "${gcc_cv_as_balign_and_p2align+set}" =3D set; then : diff --git a/gcc/ira.c b/gcc/ira.c index 28517c1..998d11b 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5471,7 +5471,8 @@ do_reload (void) =A0 =A0 =A0 register. =A0Often we can get away with letting the user approp= riate =A0 =A0 =A0 the frame pointer, but we should let them know when code genera= tion =A0 =A0 =A0 makes that impossible. =A0*/ - =A0if (global_regs[HARD_FRAME_POINTER_REGNUM] && frame_pointer_needed) + =A0if (global_regs[HARD_FRAME_POINTER_REGNUM] && frame_pointer_needed + =A0 =A0 =A0&& !HAVE_FP_INSTEAD_INSNS) =A0 =A0 =A0{ =A0 =A0 =A0 =A0tree decl =3D global_regs_decl[HARD_FRAME_POINTER_REGNUM]; =A0 =A0 =A0 =A0error_at (DECL_SOURCE_LOCATION (current_function_decl), --=A0 1.9.3 =20=09=09=20=09=20=20=20=09=09=20=20