[PATCH] Refactor `execute` from gcc.c

Richard Biener richard.guenther@gmail.com
Wed May 20 08:30:09 GMT 2020


On Tue, May 19, 2020 at 2:24 AM Giuliano Belinassi via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> After having so much trouble working on the `execute' function inside
> gcc.c, I decided to refactor it so that it could be more digestible.
> Since I am using it on my branch, I am submitting this patch for
> "battlefield" testing.
>
> Bootstrapped and ran the testsuite on Linux x86_64.

The ChangeLog misses the new print_verbose function (the diff is also
incredibly hard to read there - I guess a context diff might be easier.
Also there's append_valgrind, so the changelog needs some work.

I wonder how print_verbose can fail?  It also seems to have an odd
name given it contains

  if (verbose_only_flag != 0)
    {
      /* verbose_only_flag should act as if the spec was
         executed, so increment execution_count before
         returning.  This prevents spurious warnings about
         unused linker input files, etc.  */
      execution_count++;
      return 1;
    }

maybe the (this?) verbose_only_flag processing should be in the caller.

I wonder if splitting up the patch helps review.  Note I'm not very familiar
with the code either (now you clearly beat me here!).  Joseph is listed
as official maintainer (CCing him), he might be able to give advice.
As a short summary if you didn't follow this GSoC project there's
need for the driver to process multiple assembler outputs from
a single compiler invocation, assembling them and (partially)
linking the result (based on the requested output).  We're trying to get
away without adding anything to the specs language here.

Richard.

> -----
>
> Refactor `execute' function to avoid exposing unnecessary details of
> how it works, encapsulating each important step into a function.
>
> gcc/ChangeLog
> 2020-05-18  Giuliano Belinassi  <giuliano.belinassi@usp.brr>
>
>         * gcc.c (struct command): Move from execute.
>         (await_commands_to_finish): New function.
>         (split_commands): Same as above.
>         (parse_argbuf): Same as above.
>         (execute): Refactor based on new functions.


More information about the Gcc-patches mailing list