This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: GCC driver to "Compile twice, score the assembly, choose the best"?
- From: Paulo Matos <pmatos at broadcom dot com>
- To: Ian Bolton <ian dot bolton at arm dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 15 May 2014 12:12:46 +0000
- Subject: RE: GCC driver to "Compile twice, score the assembly, choose the best"?
- Authentication-results: sourceware.org; auth=none
- References: <000601cf7033$5dd09ef0$1971dcd0$ at bolton@arm.com>
> -----Original Message-----
> From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org] On Behalf
> Of Ian Bolton
> Sent: 15 May 2014 12:47
> To: gcc@gcc.gnu.org
> Subject: GCC driver to "Compile twice, score the assembly, choose the
> best"?
>
> Hi, fellow GCC developers!
>
> I was wondering if the "gcc" driver could be made to invoke "cc1"
> twice, with different flags, and then just keep the better of the two
> .s files that comes out?
>
> I'm sure this is not a new idea, but I'm not aware of anything being
> done in this area, so I've made this post to gather your views. :)
>
> The kinds of flags I am thinking could be toggled are register
> allocation and instruction scheduling ones, since it's very hard to
> find one-size-fits-all there and we don't really want to have the user
> depend on knowing the right one.
>
> Obviously, compilation time will go up, but the run-time benefits
> could be huge.
>
> What are your thoughts? What work in this area have I failed to dig
> up in my limited research?
This looks like something that should be done outside of cc1. Other people have thought about it and what you suggest is exactly the example found in OpenTuner (http://opentuner.org/) announcement paper:
http://dspace.mit.edu/handle/1721.1/81958
The difference is that you don't compare .s files but instead choose the metric based on the execution of the program on a test bench.
HTH,
Paulo Matos