From patchwork Wed Jan 28 15:12:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 433890 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 E451E1401EF for ; Thu, 29 Jan 2015 02:13:23 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=SMrrnZ44MwdQj5lSP+dS5O4AQkYTIQXveTaBWSI4gAwiNvSXYFSt7 M/7ydh8he5x0geCjblbAIvl65GLaZqOYMEESDlcZlDzjRiYcepM5YUhZLkvfh7yo CPvRJZW69X5YJWzg+fmw5gUWL4S+rkoEkvYD3BElyAG7k9VsjOlddo= 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 :from:to:subject:message-id:mime-version:content-type; s= default; bh=y2YqG4Tfbd0+mI7yvaaOPte7g9M=; b=twWfIkwdYWG9gWjNdjnr WzB+92xketbWFA41ARsXfRa8+8c4Ta8SNws3xel+pyWBft0lsEmA0lWTL8tUJ/C/ GNA17FJtis3Hd31SjW6HGqcmjZw8uskbBtwEf15uZyz9YcEx36Mz8j3C0QaLf2gH IjVTRZSGNjNlQYqZMSbSCLM= Received: (qmail 2739 invoked by alias); 28 Jan 2015 15:12:49 -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 2680 invoked by uid 89); 28 Jan 2015 15:12:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f178.google.com Received: from mail-ie0-f178.google.com (HELO mail-ie0-f178.google.com) (209.85.223.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 28 Jan 2015 15:12:44 +0000 Received: by mail-ie0-f178.google.com with SMTP id rp18so22205898iec.9 for ; Wed, 28 Jan 2015 07:12:42 -0800 (PST) X-Received: by 10.42.236.81 with SMTP id kj17mr3750304icb.60.1422457962181; Wed, 28 Jan 2015 07:12:42 -0800 (PST) Received: from msticlxl57.ims.intel.com (fmdmzpr01-ext.fm.intel.com. [192.55.54.36]) by mx.google.com with ESMTPSA id v64sm2615342ioi.18.2015.01.28.07.12.39 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jan 2015 07:12:41 -0800 (PST) Date: Wed, 28 Jan 2015 18:12:30 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, i386] Never fix register for PIC when pseudo PIC reg is used Message-ID: <20150128151230.GA58846@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, Currently ix86_conditional_register_usage code may mark EBX as a fixed register if it is called when pic_offset_table_rtx is NULL even if we are going to use pseudo PIC register. It already caused some problem in combination with another issue (PR jit/64722). This patch will probably help to avoid problems in the future. BTW if we don't want to support possibility to switch to the fixed PIC register in i386 target then this code may be removed at all. Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk? Thanks, Ilya --- 2015-01-28 Ilya Enkovich * config/i386/i386.c (ix86_conditional_register_usage): Never fix PIC register if we are going to use a pseudo one. (ix86_use_pseudo_pic_reg): Move up. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index d10d3ff..27316a0 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4378,6 +4378,19 @@ ix86_offload_options (void) return xstrdup ("-foffload-abi=ilp32"); } +/* Return 1 if pseudo register should be created and used to hold + GOT address for PIC code. */ +static bool +ix86_use_pseudo_pic_reg (void) +{ + if ((TARGET_64BIT + && (ix86_cmodel == CM_SMALL_PIC + || TARGET_PECOFF)) + || !flag_pic) + return false; + return true; +} + /* Update register usage after having seen the compiler flags. */ static void @@ -4388,7 +4401,7 @@ ix86_conditional_register_usage (void) /* The PIC register, if it exists, is fixed. */ j = PIC_OFFSET_TABLE_REGNUM; - if (j != INVALID_REGNUM) + if (j != INVALID_REGNUM && !ix86_use_pseudo_pic_reg ()) fixed_regs[j] = call_used_regs[j] = 1; /* For 32-bit targets, squash the REX registers. */ @@ -6254,19 +6267,6 @@ ix86_maybe_switch_abi (void) reinit_regs (); } -/* Return 1 if pseudo register should be created and used to hold - GOT address for PIC code. */ -static bool -ix86_use_pseudo_pic_reg (void) -{ - if ((TARGET_64BIT - && (ix86_cmodel == CM_SMALL_PIC - || TARGET_PECOFF)) - || !flag_pic) - return false; - return true; -} - /* Initialize large model PIC register. */ static void