forked from flang-compiler/classic-flang-llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit is motivated by reducing the merge burden by shrinking the diff between llvm upstream and classic-flang-llvm-project. Outside of Flang, Fortran code is fed through the Compile phase, and the appropriate tooling is picked up through ToolChain::SelectTool. Classic Flang introduced a FortranFrontend, but these days this seems unnecessary. Fortran can go through the same machinery as everything else. * Use the Preprocess phase to preprocess Fortran code. This phase is always combined with the Compile phase. * Use the Compile phase to lower Fortran code to LLVM IR, and use the Backend phase to compile and optimize the IR. These phases are never combined. * Remove FortranFrontendJobClass. * Remove FortranFrontend tool (instead it's just the Flang tool, which in Classic Flang mode is Classic Flang). * Update tests which inspect the output of the Classic Flang tooling, and ensures that the driver does the right thing for various types of inputs. Based on a patch from Peter Waller <[email protected]>.
- Loading branch information
Showing
15 changed files
with
125 additions
and
102 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ namespace phases { | |
enum ID { | ||
Preprocess, | ||
Precompile, | ||
FortranFrontend, | ||
Compile, | ||
Backend, | ||
Assemble, | ||
|
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,12 @@ | ||
! REQUIRES: classic_flang | ||
|
||
! Check that the driver invokes flang1 correctly for fixed-form Fortran code | ||
! which requires preprocessing. | ||
|
||
! RUN: %clang --driver-mode=flang -target x86_64-unknown-linux-gnu -c %s -### 2>&1 \ | ||
! RUN: | FileCheck %s | ||
! CHECK: "flang1" | ||
! CHECK-SAME: "-preprocess" | ||
! CHECK-SAME: "-nofreeform" | ||
! CHECK-NEXT: "flang2" | ||
! CHECK-NEXT: {{clang.* "-cc1"}} |
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,12 @@ | ||
! REQUIRES: classic_flang | ||
|
||
! Check that the driver invokes flang1 correctly for free-form Fortran code | ||
! which requires preprocessing. | ||
|
||
! RUN: %clang --driver-mode=flang -target x86_64-unknown-linux-gnu -c %s -### 2>&1 \ | ||
! RUN: | FileCheck %s | ||
! CHECK: "flang1" | ||
! CHECK-SAME: "-preprocess" | ||
! CHECK-SAME: "-freeform" | ||
! CHECK-NEXT: "flang2" | ||
! CHECK-NEXT: {{clang.* "-cc1"}} |
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,26 @@ | ||
! REQUIRES: classic_flang | ||
|
||
! Check that the driver invokes flang1 correctly for preprocessed fixed-form | ||
! Fortran code. | ||
|
||
! RUN: %clang --driver-mode=flang -target x86_64-unknown-linux-gnu -c %s -### 2>&1 \ | ||
! RUN: | FileCheck %s | ||
! CHECK: "flang1" | ||
! CHECK-NOT: "-preprocess" | ||
! CHECK-SAME: "-nofreeform" | ||
! CHECK-NEXT: "flang2" | ||
! CHECK-NEXT: {{clang.* "-cc1"}} | ||
|
||
! Check that the driver invokes flang1 correctly when preprocessing is | ||
! explicitly requested. | ||
|
||
! RUN: %clang --driver-mode=flang -target x86_64-unknown-linux-gnu -E %s -### 2>&1 \ | ||
! RUN: | FileCheck --check-prefix=CHECK-PREPROCESS %s | ||
! CHECK-PREPROCESS: "flang1" | ||
! CHECK-PREPROCESS-SAME: "-preprocess" | ||
! CHECK-PREPROCESS-SAME: "-es" | ||
! CHECK-PREPROCESS-SAME: "-pp" | ||
! CHECK-PREPROCESS-NOT: "flang1" | ||
! CHECK-PREPROCESS-NOT: "flang2" | ||
! CHECK-PREPROCESS-NOT: {{clang.* "-cc1"}} | ||
! CHECK-PREPROCESS-NOT: {{clang.* "-cc1as"}} |
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,43 @@ | ||
! REQUIRES: classic_flang | ||
|
||
! Check that the driver invokes flang1 correctly for preprocessed free-form | ||
! Fortran code. Also check that the backend is invoked correctly. | ||
|
||
! RUN: %clang --driver-mode=flang -target x86_64-unknown-linux-gnu -c %s -### 2>&1 \ | ||
! RUN: | FileCheck --check-prefix=CHECK-OBJECT %s | ||
! CHECK-OBJECT: "flang1" | ||
! CHECK-OBJECT-NOT: "-preprocess" | ||
! CHECK-OBJECT-SAME: "-freeform" | ||
! CHECK-OBJECT-NEXT: "flang2" | ||
! CHECK-OBJECT-SAME: "-asm" [[LLFILE:.*.ll]] | ||
! CHECK-OBJECT-NEXT: {{clang.* "-cc1"}} | ||
! CHECK-OBJECT-SAME: "-o" "classic-flang.o" | ||
! CHECK-OBJECT-SAME: "-x" "ir" | ||
! CHECK-OBJECT-SAME: [[LLFILE]] | ||
|
||
! Check that the driver invokes flang1 correctly when preprocessing is | ||
! explicitly requested. | ||
|
||
! RUN: %clang --driver-mode=flang -target x86_64-unknown-linux-gnu -E %s -### 2>&1 \ | ||
! RUN: | FileCheck --check-prefix=CHECK-PREPROCESS %s | ||
! CHECK-PREPROCESS: "flang1" | ||
! CHECK-PREPROCESS-SAME: "-preprocess" | ||
! CHECK-PREPROCESS-SAME: "-es" | ||
! CHECK-PREPROCESS-SAME: "-pp" | ||
! CHECK-PREPROCESS-NOT: "flang1" | ||
! CHECK-PREPROCESS-NOT: "flang2" | ||
! CHECK-PREPROCESS-NOT: {{clang.* "-cc1"}} | ||
! CHECK-PREPROCESS-NOT: {{clang.* "-cc1as"}} | ||
|
||
! Check that the backend job (clang -cc1) is not combined into the compile job | ||
! (flang2) even if -integrated-as is specified. | ||
|
||
! RUN: %clang --driver-mode=flang -target x86_64-unknown-linux-gnu -integrated-as -S %s -### 2>&1 \ | ||
! RUN: | FileCheck --check-prefix=CHECK-ASM %s | ||
! CHECK-ASM: "flang1" | ||
! CHECK-ASM-NEXT: "flang2" | ||
! CHECK-ASM-SAME: "-asm" [[LLFILE:.*.ll]] | ||
! CHECK-ASM-NEXT: {{clang.* "-cc1"}} | ||
! CHECK-ASM-SAME: "-o" "classic-flang.s" | ||
! CHECK-ASM-SAME: "-x" "ir" | ||
! CHECK-ASM-SAME: [[LLFILE]] |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -12,6 +12,9 @@ config.suffixes = [ | |
".f90", | ||
".F90", | ||
".f95", | ||
'.F95', | ||
'.f', | ||
'.F', | ||
".cu", | ||
".rs", | ||
".cl", | ||
|