[clang] [C++20] [Modules] Introduce -fexperimental-modules-reduced-bmi (PR #85050)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 14 20:55:33 PDT 2024


================
@@ -1061,6 +1070,16 @@ CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
     CI.getPreprocessor().addPPCallbacks(std::move(Callbacks));
   }
 
+  if (CI.getFrontendOpts().GenReducedBMI &&
+      !CI.getFrontendOpts().ModuleOutputPath.empty()) {
+    std::vector<std::unique_ptr<ASTConsumer>> Consumers{2};
+    Consumers[0] = std::make_unique<ReducedBMIGenerator>(
+        CI.getPreprocessor(), CI.getModuleCache(),
+        CI.getFrontendOpts().ModuleOutputPath);
+    Consumers[1] = std::move(Result);
+    return std::make_unique<MultiplexConsumer>(std::move(Consumers));
+  }
----------------
ChuanqiXu9 wrote:

For full BMI, the workflow is:

```
.cpp -> .pcm -> .o
```

no matter if `-fmodule-output` is specified or not. If `-fmodule-output` is not specified, the `.pcm` file will be generated in `/tmp` directory.

And for reduced BMI, the workflow is:

```
.cpp ---------> .o
               -----> .pcm
```

that said, we generate the .o directly from the .cpp then we don't need the .pcm to contain the full information to generate the .o . 

Then for the original question, can we make the full BMI in the same way with the reduced BMI? Maybe we can, but it looks like an overkill. Since if the .o don't need the .pcm, we don't need the .pcm to be full.
 

https://github.com/llvm/llvm-project/pull/85050


More information about the cfe-commits mailing list