[all-commits] [llvm/llvm-project] bb177e: [flang][driver] Re-organise the code-gen actions (...

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Thu May 5 07:07:01 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb177edc44f412f368c4c5983df15b7364fc3122
      https://github.com/llvm/llvm-project/commit/bb177edc44f412f368c4c5983df15b7364fc3122
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2022-05-05 (Thu, 05 May 2022)

  Changed paths:
    M flang/include/flang/Frontend/FrontendActions.h
    M flang/lib/Frontend/FrontendActions.cpp
    M flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list