This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][1/2] Move mult synthesis definitions into a separate file
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 14 Jun 2016 09:19:07 +0200
- Subject: Re: [PATCH][1/2] Move mult synthesis definitions into a separate file
- Authentication-results: sourceware.org; auth=none
- References: <575EA5B6 dot 3040707 at foss dot arm dot com> <CAFiYyc3zHG0Ka0p_DG6HNHPhGXGzrFdnHFXLWRZ-CC=BS0Ovpw at mail dot gmail dot com> <575EC06F dot 4020108 at foss dot arm dot com>
On Mon, Jun 13, 2016 at 4:17 PM, Kyrill Tkachov
<kyrylo.tkachov@foss.arm.com> wrote:
> Hi Richard,
>
> On 13/06/16 15:07, Richard Biener wrote:
>>
>> On Mon, Jun 13, 2016 at 2:23 PM, Kyrill Tkachov
>> <kyrylo.tkachov@foss.arm.com> wrote:
>>>
>>> Hi all,
>>>
>>> There are other places besides expand where we might want to synthesize
>>> an
>>> integer
>>> multiplication by a constant. Thankfully the algorithm selection code in
>>> expmed.c
>>> is already quite well separated from the RTL implementation, so if we can
>>> just factor
>>> out the prototype of choose_mult_variant and some enums and structs that
>>> it
>>> needs into
>>> a separate header file we can reuse them from other parts of the
>>> compiler.
>>>
>>> I need this for patch 2/2 which hooks up the vectorizer to synthesize
>>> vector
>>> multiplications using sequences of shifts and other arithmetic ops when
>>> appropriate.
>>>
>>> The new header is called mult-synthesis.h. Should I add it to some
>>> makefile?
>>> grepping around for a bit I'm not sure what to do about it.
>>
>> Possibly PLUGIN_HEADERS.
>
>
> Ok.
>
>> You could have included expmed.h from the vectorizer, no? After all this
>> patch now breaks that things declared in A.h are defined in A.c as you
>> didn't move choose_mult_variant itself.
>
>
> I think including expmed.h would work. I thought it defined too many
> irrelevant RTL-specific things that you wouldn't want in the vectoriser.
> If you don't mind I'm happy to just include expmed.h.
Yes, please do so.
> Do we have a rule for defining things delcared in A.h in A.c?
We worked hard toward that with the header file cleanup and I think it
is a natural
thing to do.
> I notice we declare various extern things in rtl.h that aren't defined in
> rtl.c, though I suppose that would be an exception...
Similar for tree.h - but those are really just not fully cleaned up yet.
Richard.
> Thanks,
> Kyrill
>
>
>> Thanks,
>> Richard.
>>
>>> Bootstrapped and tested on arm, aarch64, x86_64.
>>>
>>> Thanks,
>>> Kyrill
>>>
>>> 2016-06-13 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>>>
>>> * mult-synthesis.h: New file. Add choose_mult_variant prototype.
>>> * expmed.h: Include mult-synthesis.h
>>> (enum alg_code): Move to mult-synthesis.h
>>> (struct mult_cost): Likewise.
>>> (struct algorithm): Likewise.
>>> * expmed.c (enum mult_variant): Move to mult-synthesis.h
>>> (choose_mult_variant): Delete prototype. Remove static qualifier.
>
>