Re: [PATCH v2 30/50] helper-to-tcg: Introduce TcgGenPass

Alessandro Di Federico via qemu development <[email protected]>
Newsgroups org.nongnu.qemu-devel
Message-ID <20260807122720.7bda66c3@spawn>
On Thu, 30 Jul 2026 05:10:04 +0200
Anton Johansson via qemu development <[email protected]> wrote:

> +    std::error_code EC;
> +    ToolOutputFile OutSource(OutputSourceFile, EC, compat::OpenFlags);
> +    ToolOutputFile OutHeader(OutputHeaderFile, EC, compat::OpenFlags);
> +    ToolOutputFile OutHelpers(OutputHelpersFile, EC, compat::OpenFlags);
> +    ToolOutputFile OutEnabled(OutputEnabledFile, EC, compat::OpenFlags);
> +    assert(!EC);
> +
> +    MPM.addPass(TcgGenPass(OutSource.os(), OutHeader.os(), OutHelpers.os(),
> +                           OutEnabled.os(), OutputHeaderFile, Annotations,
> +                           DebugInfo, TcgGlobals, VL));

I'd move all the `cl::opt` from this file to `TcgGenPass`.
Ideally, passes should not have constructor arguments and should be
runnable from `opt`.

Make an effort to have all the passes be default constructible.

> +    MPM.run(*M.get(), MAM);
> +
> +    OutSource.keep();
> +    OutHeader.keep();
> +    OutHelpers.keep();
> +    OutEnabled.keep();
> +
>      return 0;
>  }

-- 
Alessandro Di Federico
rev.ng Labs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.