This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Enable EBX for x86 in 32bits PIC code
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Evgeny Stupachenko <evstupac at gmail dot com>
- Date: Mon, 25 Aug 2014 07:24:30 -0400 (EDT)
- Subject: Re: Enable EBX for x86 in 32bits PIC code
- Authentication-results: sourceware.org; auth=none
- References: <CAOvf_xxsQ_oYGqNAVQ1+BW+CuD3mzebZ2xma0jpF=WfyZMCRCA at mail dot gmail dot com> <CAFiYyc1mFtTezkTJORmJJq+yht=qPSwiN7KDn19+bSuSdaqvMQ at mail dot gmail dot com> <CAOvf_xyeVeg2oB9Xxz8RMEQ6gyfJY5whd9s4ygoAAEaMU9efnA at mail dot gmail dot com> <20140707114750 dot GB31640 at tucnak dot redhat dot com> <CAMbmDYZV_fx0jxmKHhLsC2pJ7pDzuu6toEAH72izOdpq6KGyfg at mail dot gmail dot com> <20140822121151 dot GA60032 at msticlxl57 dot ims dot intel dot com> <alpine dot BSF dot 2 dot 02 dot 1408222137320 dot 29125 at arjuna dot pair dot com> <CAMbmDYbLkdZ6sxh0D08Xc9moWzNo7eHtOHDBmvrPJDM5ptVePg at mail dot gmail dot com>
On Mon, 25 Aug 2014, Ilya Enkovich wrote:
> 2014-08-23 5:47 GMT+04:00 Hans-Peter Nilsson <hp@bitrange.com>:
> > ...did you send the right version of the patch?
> > This one uses the RTX-returning hook only in boolean tests,
> > unless I misread.
(I did, but not by much.)
> NULL returned by hook means we do not have implicit pic arg to
> pass/receive and there are pieces of code which should be executed
> only when implicit pic arg exists. This causes these boolean tests.
Well, obviously, but...
> There are also non boolean usages. E.g.:
I thing singular ("usage") is more correct?
I saw only one such use. :)
> + rtx old_reg = targetm.calls.implicit_pic_arg (fndecl);
> + rtx new_reg = gen_reg_rtx (GET_MODE (old_reg));
> + emit_move_insn (new_reg, old_reg);
> + pic_offset_table_rtx = new_reg;
And before that, it's called as a boolean test, throwing away
the result!
I suggest you change the hook to return a boolean, with a
pointer argument to a variable to set, passed as NULL from
callers not interested in the actual value.
I.e. instead of:
> >> +@deftypefn {Target Hook} rtx TARGET_IMPLICIT_PIC_ARG (const_tree @var{fntype_or_decl})
make it a:
@deftypefn {Target Hook} bool TARGET_IMPLICIT_PIC_ARG
(const_tree @var{fntype_or_decl}, rtx *@var{addr})
brgds, H-P