From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20774 invoked by alias); 28 Aug 2014 12:54:48 -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 20755 invoked by uid 89); 28 Aug 2014 12:54:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f175.google.com Received: from mail-ie0-f175.google.com (HELO mail-ie0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 28 Aug 2014 12:54:45 +0000 Received: by mail-ie0-f175.google.com with SMTP id y20so883754ier.34 for ; Thu, 28 Aug 2014 05:54:43 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.43.70.205 with SMTP id yh13mr4346678icb.44.1409230483104; Thu, 28 Aug 2014 05:54:43 -0700 (PDT) Received: by 10.64.143.5 with HTTP; Thu, 28 Aug 2014 05:54:43 -0700 (PDT) In-Reply-To: References: <20140707114750.GB31640@tucnak.redhat.com> <20140822121151.GA60032@msticlxl57.ims.intel.com> <53FB5184.3030500@redhat.com> <53FCA6F5.7020405@redhat.com> <20140826213712.GA39451@msticlxl57.ims.intel.com> <53FE5002.6040005@redhat.com> Date: Thu, 28 Aug 2014 12:54:00 -0000 Message-ID: Subject: Re: Enable EBX for x86 in 32bits PIC code From: Ilya Enkovich To: Uros Bizjak Cc: Jeff Law , Vladimir Makarov , gcc@gnu.org, gcc-patches , Evgeny Stupachenko , Richard Biener Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg02562.txt.bz2 2014-08-28 16:42 GMT+04:00 Uros Bizjak : > On Thu, Aug 28, 2014 at 10:37 AM, Ilya Enkovich wrote: >> 2014-08-28 1:39 GMT+04:00 Jeff Law : >>> On 08/26/14 15:42, Ilya Enkovich wrote: >>>> >>>> diff --git a/gcc/calls.c b/gcc/calls.c >>>> index 4285ec1..85dae6b 100644 >>>> --- a/gcc/calls.c >>>> +++ b/gcc/calls.c >>>> @@ -1122,6 +1122,14 @@ initialize_argument_information (int num_actuals >>>> ATTRIBUTE_UNUSED, >>>> call_expr_arg_iterator iter; >>>> tree arg; >>>> >>>> + if (targetm.calls.implicit_pic_arg (fndecl ? fndecl : fntype)) >>>> + { >>>> + gcc_assert (pic_offset_table_rtx); >>>> + args[j].tree_value = make_tree (ptr_type_node, >>>> + pic_offset_table_rtx); >>>> + j--; >>>> + } >>>> + >>>> if (struct_value_addr_value) >>>> { >>>> args[j].tree_value = struct_value_addr_value; >>> >>> So why do you need this? Can't this be handled in the call/call_value >>> expanders or what about attaching the use to CALL_INSN_FUNCTION_USAGE from >>> inside ix86_expand_call? Basically I'm not seeing the need for another >>> target hook here. I think that would significantly simply the patch as >>> well. >> >> GOT base address become an additional implicit arg with EBX relaxed >> and I handled it as all other args. I can move EBX initialization into >> ix86_expand_call. Would still need some hint from target to init >> pic_offset_table_rtx with proper value in the beginning of function >> expand. > > Maybe you can you use get_hard_reg_initial_val for this? Actually there is no input hard reg holding GOT address. Currently I use initialization with ebx with following ebx initialization in prolog_epilog pass. But this is a temporary workaround. It is inefficient because always uses callee save reg to get GOT address. I suppose we should generate pseudo reg for pic_offset_table_rtx and also set_got with this register as a destination in expand pass. After register allocation set_got may be transformed into get_pc_thunk call with proper hard reg. But some target hook has to be used for this. Ilya > > Uros.