diff options
author | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2022-04-22 09:07:31 +0000 |
---|---|---|
committer | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2022-05-05 14:05:06 +0000 |
commit | bb177edc44f412f368c4c5983df15b7364fc3122 (patch) | |
tree | 18d6502cb3a5498d3624e2ecfcb3fd44393f4acf /flang/lib/FrontendTool | |
parent | c894e85fc64dd8d83b460de81080fff93c5ca334 (diff) | |
download | llvm-bb177edc44f412f368c4c5983df15b7364fc3122.zip llvm-bb177edc44f412f368c4c5983df15b7364fc3122.tar.gz llvm-bb177edc44f412f368c4c5983df15b7364fc3122.tar.bz2 |
[flang][driver] Re-organise the code-gen actions (nfc)
All frontend actions that generate code (MLIR, LLVM IR/BC,
Assembly/Object Code) are re-factored as essentially one action,
`CodeGenAction`, with minor specialisations. To facilate all this,
`CodeGenAction` is extended to hold `TargetMachine` and backend action
type (MLIR vs LLVM IR vs LLVM BC vs Assembly vs Object Code).
`CodeGenAction` is no longer a pure abstract class and the
corresponding `ExecuteAction` is implemented so that it covers all use
cases. All this allows a much better code re-use.
Key functionality is extracted into some helpful hooks:
* `SetUpTargetMachine`
* `GetOutputStream`
* `EmitObjectCodeHelper`
* `EmitBCHelper`
I hope that this clarifies the overall structure. I suspect that we may
need to revisit this again as the functionality grows in complexity.
Differential Revision: https://reviews.llvm.org/D124665
Diffstat (limited to 'flang/lib/FrontendTool')
-rw-r--r-- | flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 8f5b313..7aef815 100644 --- a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -41,11 +41,9 @@ static std::unique_ptr<FrontendAction> CreateFrontendAction( case EmitLLVMBitcode: return std::make_unique<EmitLLVMBitcodeAction>(); case EmitObj: - return std::make_unique<BackendAction>( - BackendAction::BackendActionTy::Backend_EmitObj); + return std::make_unique<EmitObjAction>(); case EmitAssembly: - return std::make_unique<BackendAction>( - BackendAction::BackendActionTy::Backend_EmitAssembly); + return std::make_unique<EmitAssemblyAction>(); case DebugUnparse: return std::make_unique<DebugUnparseAction>(); case DebugUnparseNoSema: |