From patchwork Wed Dec 9 02:59:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 554211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 067D41402B4 for ; Wed, 9 Dec 2015 13:59:25 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=WAem2inA; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject; q=dns; s=default; b=a4UyHuzBRthW0YL QdQl40zkJdYnn4kvpJKxSPXHwgVk9qRk0yPBL0GbBy6sBGpOZmt68qRdp2luoKEr VfRIU9ChpOdwvcjAgNylXruKNHu8YWAAgcQ23w8GEWH6yca29gTVproJWm+E4rgI oghFV10uRcV0UUG3Vtx2ENpUMAuI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject; s=default; bh=Bvoxj2VeIpxkFy13fTJTo QFSuXM=; b=WAem2inAQKW2wri18ThhCMRItYbbV1vul6i5lnNYwWtZPEwhCyURc XX69yaT8r95+XSAUEkhmRgddqwfGKgx85tWGRnmh1nsgFnTGC7X1/XP81yOJsO4x n2zaYvQqKg6RAiKg8SZon91BsaHKKdNP1GDXomGmVIXAdb8u/9ZrDM= Received: (qmail 65347 invoked by alias); 9 Dec 2015 02:59:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 65329 invoked by uid 89); 9 Dec 2015 02:59:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_05, KAM_ASCII_DIVIDERS, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 09 Dec 2015 02:59:15 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 0B3D4C00127D for ; Wed, 9 Dec 2015 02:59:14 +0000 (UTC) Received: from greed.delorie.com ([10.3.113.2]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tB92xDac008745 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 8 Dec 2015 21:59:13 -0500 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.14.4/8.14.4) with ESMTP id tB92xCZY024072 for ; Tue, 8 Dec 2015 21:59:12 -0500 Received: (from dj@localhost) by greed.delorie.com (8.14.4/8.14.4/Submit) id tB92xC95024070; Tue, 8 Dec 2015 21:59:12 -0500 Date: Tue, 8 Dec 2015 21:59:12 -0500 Message-Id: <201512090259.tB92xC95024070@greed.delorie.com> From: DJ Delorie To: gcc-patches@gcc.gnu.org Subject: [rx] avoid long calls X-IsSubscribed: yes Immediate mode jumps have limits; this new option tells gcc to avoid those instructions (by using indirect mode ones) in those rare cases where the user has a program that big. Committed. * config/rx/rx.opt (-mjsr): Add. * config/rx/predicates.md (rx_call_operand): Avoid overflowing calls when -mjsr. * config/rx/rx.c (rx_function_ok_for_sibcall): Likewise for overflowing jumps. * doc/invoke.texi (-mjsr): Document it. Index: doc/invoke.texi =================================================================== --- doc/invoke.texi (revision 231438) +++ doc/invoke.texi (working copy) @@ -965,12 +965,13 @@ See RS/6000 and PowerPC Options. -mas100-syntax -mno-as100-syntax@gol -mrelax@gol -mmax-constant-size=@gol -mint-register=@gol -mpid@gol -mallow-string-insns -mno-allow-string-insns@gol +-mjsr@gol -mno-warn-multiple-fast-interrupts@gol -msave-acc-in-interrupts} @emph{S/390 and zSeries Options} @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol @@ -20682,12 +20683,21 @@ disabled automatically. Instead it is r use the @option{-mno-allow-string-insns} option if their program accesses I/O space. When the instructions are enabled GCC defines the C preprocessor symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the symbol @code{__RX_DISALLOW_STRING_INSNS__}. + +@item -mjsr +@itemx -mno-jsr +@opindex mjsr +@opindex mno-jsr +Use only (or not only) @code{JSR} instructions to access functions. +This option can be used when code size exceeds the range of @code{BSR} +instructions. Note that @option{-mno-jsr} does not mean to not use +@code{JSR} but instead means that any type of branch may be used. @end table @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} has special significance to the RX port when used with the @code{interrupt} function attribute. This attribute indicates a function intended to process fast interrupts. GCC ensures Index: config/rx/predicates.md =================================================================== --- config/rx/predicates.md (revision 231438) +++ config/rx/predicates.md (working copy) @@ -21,13 +21,15 @@ ;; Check that the operand is suitable for a call insn. ;; Only registers and symbol refs are allowed. (define_predicate "rx_call_operand" - (match_code "symbol_ref,reg") + (ior (match_code "reg") + (and (match_test "!TARGET_JSR") + (match_code "symbol_ref"))) ) ;; For sibcall operations we can only use a symbolic address. (define_predicate "rx_symbolic_call_operand" (match_code "symbol_ref") Index: config/rx/rx.c =================================================================== --- config/rx/rx.c (revision 231438) +++ config/rx/rx.c (working copy) @@ -2854,12 +2854,15 @@ rx_warn_func_return (tree decl) /* Return nonzero if it is ok to make a tail-call to DECL, a function_decl or NULL if this is an indirect call, using EXP */ static bool rx_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) { + if (TARGET_JSR) + return false; + /* Do not allow indirect tailcalls. The sibcall patterns do not support them. */ if (decl == NULL) return false; /* Never tailcall from inside interrupt handlers or naked functions. */ Index: config/rx/rx.opt =================================================================== --- config/rx/rx.opt (revision 231438) +++ config/rx/rx.opt (working copy) @@ -146,6 +146,12 @@ Enable the use of the LRA register alloc ;--------------------------------------------------- mallow-string-insns Target Report Var(rx_allow_string_insns) Init(1) Enables or disables the use of the SMOVF, SMOVB, SMOVU, SUNTIL, SWHILE and RMPA instructions. Enabled by default. + +;--------------------------------------------------- + +mjsr +Target Report Mask(JSR) +Always use JSR, never BSR, for calls.