[PATCH] D119012: [flang][driver] Add support for the `-emit-llvm` option
Andrzej Warzynski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 7 06:11:56 PST 2022
awarzynski added inline comments.
================
Comment at: flang/lib/Frontend/FrontendActions.cpp:421
+ // Set-up the MLIR pass manager
+ fir::setTargetTriple(*mlirModule_, "native");
+ auto &defKinds = ci.invocation().semanticsContext().defaultKinds();
----------------
rovka wrote:
> Nit: Should we assert that mlirModule exists?
> Also, why doesn't it already have a triple and a kind mapping?
> Nit: Should we assert that mlirModule exists?
We could do, yes. However, `mlirModule` is created in `CodeGenAction::BeginSourceFileAction`. If that method fails, the driver should stop immediately. So perhaps that would be a better for place for an assert?
On a related note, `mlirModule` is obtained via [[ https://github.com/llvm/llvm-project/blob/79b3fe80707b2eb9a38c1517a829fb58062fb687/flang/include/flang/Lower/Bridge.h#L67 | LoweringBridge::getModule ]]. But if the corresponding module is `nullptr` than that getter should probably assert. See https://reviews.llvm.org/D119133.
> Also, why doesn't it already have a triple and a kind mapping?
Good catch, this is not needed yet. I didn't notice this when going over `tco`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119012/new/
https://reviews.llvm.org/D119012
More information about the cfe-commits
mailing list