[PATCH] D120568: [flang][driver] Add support for -S and implement -c/-emit-obj
Andrzej Warzynski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 25 08:29:41 PST 2022
awarzynski created this revision.
awarzynski added reviewers: rovka, clementval, schweitz, Leporacanthicus.
Herald added subscribers: Chia-hungDuan, mehdi_amini, dang, rriddle, pengfei, kristof.beyls, mgorny.
Herald added a reviewer: sscalpone.
Herald added a project: Flang.
awarzynski requested review of this revision.
Herald added subscribers: cfe-commits, stephenneuendorffer, jdoerfert.
Herald added a project: clang.
This patch adds support for:
- `-S` in Flang's compiler and frontend drivers
and implements (these options were already available as placeholders):
- `-emit-obj` in Flang's frontend driver and `-c` in Flang's compiler driver
The semantics of these options in Clang and Flang are identical.
The `EmitObjAction` frontend action is renamed as `BackendAction`. The
new name more accurately reflects the fact that this action will
primarily run the code-gen/backend pipeline in LLVM. It also makes more
sense as an action implementing both `-emit-obj` and `-S` (originally it
was just `-emit-obj`).
`tripleName` in FirContext.cpp is updated from `fir.triple` to
`llvm.target_triple`. The former was effectively ignored. The latter is
used when lowering from the LLVM dialect in MLIR to LLVM IR (i.e. it's
embedded in the generated LLVM IR module). The driver can then re-use
that when configuring the backend. With this change, the LLVM IR files
generated by e.g. `tco` will from now on contain the correct target
triple.
The code-gen.f90 test is replaced with code-gen-x86.f90 and
code-gen-aarch64.f90. With 2 seperate files we can verify that
`--target` is correctly taken into account. LIT configuration is updated
to enable e.g.:
! REQUIRES: aarch64-registered-target
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120568
Files:
clang/include/clang/Driver/Options.td
flang/include/flang/Frontend/FrontendActions.h
flang/include/flang/Frontend/FrontendOptions.h
flang/lib/Frontend/CMakeLists.txt
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/FrontendActions.cpp
flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
flang/lib/Optimizer/Support/FIRContext.cpp
flang/test/CMakeLists.txt
flang/test/Driver/code-gen-aarch64.f90
flang/test/Driver/code-gen-x86.f90
flang/test/Driver/code-gen.f90
flang/test/Driver/driver-help-hidden.f90
flang/test/Driver/driver-help.f90
flang/test/Driver/emit-asm-aarch64.f90
flang/test/Driver/emit-asm-x86.f90
flang/test/Driver/syntax-only.f90
flang/test/Fir/target-rewrite-triple.fir
flang/test/lit.cfg.py
flang/test/lit.site.cfg.py.in
flang/tools/flang-driver/fc1_main.cpp
flang/unittests/Frontend/CMakeLists.txt
flang/unittests/Frontend/FrontendActionTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120568.411426.patch
Type: text/x-patch
Size: 22032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220225/e5517fe2/attachment-0001.bin>
More information about the cfe-commits
mailing list