mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-03 07:38:57 +00:00
69c3309d45
This patch adds support for generating MLIR files in Flang's frontend driver (i.e. `flang-new -fc1`). `-emit-fir` is added as an alias for `-emit-mlir`. We may want to decide to split the two in the future. A new parent class for code-gen frontend actions is introduced: `CodeGenAction`. We will be using this class to encapsulate logic shared between all code-generation actions, but not required otherwise. For now, it will: * run prescanning, parsing and semantic checks, * lower the input to MLIR. `EmitObjAction` is updated to inherit from this class. This means that the behaviour of `flang-new -fc1 -emit-obj` is also updated (previously, it would just exit immediately). This change required `flang/test/Driver/syntax-only.f90` to be updated. For `-emit-fir`, a specialisation of `CodeGenAction` is introduced: `EmitMLIRAction`. The key logic for this class is implemented in `EmitMLIRAction::ExecuteAction`. Differential Revision: https://reviews.llvm.org/D118985
29 lines
962 B
Fortran
29 lines
962 B
Fortran
! Verify that the driver correctly processes `-fsyntax-only`.
|
|
!
|
|
! By default, the compiler driver (`flang`) will create actions/phases to
|
|
! generate machine code (i.e. object files). The `-fsyntax-only` flag is a
|
|
! "phase-control" flag that controls this behavior and makes the driver stop
|
|
! once the semantic checks have been run. The frontend driver (`flang -fc1`)
|
|
! runs `-fsyntax-only` by default (i.e. that's the default action), so the flag
|
|
! can be skipped.
|
|
|
|
!-----------
|
|
! RUN LINES
|
|
!-----------
|
|
! RUN: %flang -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty
|
|
! RUN: %flang_fc1 %s 2>&1 | FileCheck %s --allow-empty
|
|
|
|
! RUN: not %flang %s 2>&1 | FileCheck %s --check-prefix=NO_FSYNTAX_ONLY
|
|
! RUN: not %flang_fc1 -emit-obj %s 2>&1 | FileCheck %s --check-prefix=NO_FSYNTAX_ONLY
|
|
|
|
!-----------------
|
|
! EXPECTED OUTPUT
|
|
!-----------------
|
|
! CHECK-NOT: error
|
|
! NO_FSYNTAX_ONLY: error: code-generation is not available yet
|
|
|
|
!-------
|
|
! INPUT
|
|
!-------
|
|
end program
|