Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang][driver] Add support for
-mllvm
This option is added in both `flang-new` (the compiler driver) and `flang-new -fc1` (the frontend driver). The semantics are consistent with `clang` and `clang -cc1`. As Flang does not run any LLVM passes when invoked with `-emit-llvm` (i.e. `flang-new -S -emit-llvm <file>`), the tests use `-S`/`-c`/`-emit-obj` instead. These options require an LLVM backend to be run by the driver to generate the output (this makese `-mllvm` relevant here). Differential Revision: https://reviews.llvm.org/D121374
- Loading branch information
1 parent
10766b7
commit a7c08bc
Showing
8 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
! Test the `-mllvm` option | ||
|
||
!------------ | ||
! RUN COMMAND | ||
!------------ | ||
! 1. Test typical usage. | ||
! RUN: %flang -S -mllvm -print-before-all %s -o - 2>&1 | FileCheck %s --check-prefix=OUTPUT | ||
! RUN: %flang_fc1 -S -mllvm -print-before-all %s -o - 2>&1 | FileCheck %s --check-prefix=OUTPUT | ||
|
||
! 2. Does the option forwarding from `flang-new` to `flang-new -fc1` work? | ||
! RUN: %flang -### -S -mllvm -print-before-all %s -o - 2>&1 | FileCheck %s --check-prefix=OPTION_FORWARDING | ||
|
||
! 3. Test invalid usage (`-print-before` requires an argument) | ||
! RUN: not %flang -S -mllvm -print-before %s -o - 2>&1 | FileCheck %s --check-prefix=INVALID_USAGE | ||
|
||
!---------------- | ||
! EXPECTED OUTPUT | ||
!---------------- | ||
! OUTPUT: *** IR Dump Before Pre-ISel Intrinsic Lowering (pre-isel-intrinsic-lowering) *** | ||
! OUTPUT-NEXT: ; ModuleID = 'FIRModule' | ||
! OUTPUT-NEXT: source_filename = "FIRModule" | ||
|
||
! Verify that `-mllvm <option>` is forwarded to flang -fc1 | ||
! OPTION_FORWARDING: flang-new" "-fc1" | ||
! OPTION_FORWARDING-SAME: "-mllvm" "-print-before-all" | ||
|
||
! INVALID_USAGE: flang (LLVM option parsing): for the --print-before option: requires a value! | ||
|
||
!------ | ||
! INPUT | ||
!------ | ||
end program |