[PATCH] D137059: [Driver] [Modules] Introduce -fsave-std-c++-module-file= to specify the path of the module file (2/2)

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 19:28:13 PDT 2022


ChuanqiXu added a comment.

In D137059#3899339 <https://reviews.llvm.org/D137059#3899339>, @ben.boeckel wrote:

> There is another motivating factor for 1-phase: the build graph is far simpler. With 2-phase, CMake will have to write out rules to perform:
>
> - source -> .bmi
> - .bmi -> .withbmi.o
> - source -> .o
>
> because we do not know if a BMI is needed or not. If it isn't we use the latter. If it is, we use the former. Note that this also means we need 2 different `.o` filenames (as neither `make` nor `ninja` doesn't support multiple rules making the same output). This also means that the collator needs to generate a response file for the linker to direct which `.o` file to use for each TU based on the contents.
>
> Also with 2-phase, it is an open question of whether it actually helps with distributed builds (or anywhere process execution and I/O are expensive compared to some minimal work unit such as, say, Windows compiling from a network drive). Since this is not a bright line, giving the option to say "I know that split BMI is better for me in this instance" and "please combine here" would be handy (depending on actual real-world perf results on real-world projects). Yes, this is a chicken-and-egg cycle :) .

In my mind, it is OK for CMake to support one-phase compilation model in the short term. And  the fact that clang also supports the 2-phase compilation wouldn't affect CMake. Do I understand right?  I mean, if the 2-phase compilation wouldn't affect CMake, CMake should be able to ignore it. My thought is that there are many more build systems in the world. And I know many of them would handle the dependency them self fully instead of translate the dependency to other build scripts like `make` and `ninja`. And I think it should be good for the compiler to remain different possibilities for different build systems (or tools).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137059/new/

https://reviews.llvm.org/D137059



More information about the cfe-commits mailing list