mirror of
https://github.com/intel/llvm.git
synced 2026-02-08 08:57:43 +08:00
[flang][driver] add -flang-deprecated-no-hlfir hidden option (#71820)
Patch 1/3 of the transition to use the HLFIR step by default in lowering as described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7 This option will allow to lower code without the HLFIR step during a grace period as described in the RFC. It is not meant to be a long term switch for flang.
This commit is contained in:
@@ -6218,6 +6218,10 @@ def flang_experimental_hlfir : Flag<["-"], "flang-experimental-hlfir">,
|
||||
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
|
||||
HelpText<"Use HLFIR lowering (experimental)">;
|
||||
|
||||
def flang_deprecated_no_hlfir : Flag<["-"], "flang-deprecated-no-hlfir">,
|
||||
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
|
||||
HelpText<"Do not use HLFIR lowering (deprecated)">;
|
||||
|
||||
def flang_experimental_polymorphism : Flag<["-"], "flang-experimental-polymorphism">,
|
||||
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
|
||||
HelpText<"Enable Fortran 2003 polymorphism (experimental)">;
|
||||
|
||||
@@ -143,6 +143,7 @@ void Flang::addCodegenOptions(const ArgList &Args,
|
||||
CmdArgs.push_back("-fversion-loops-for-stride");
|
||||
|
||||
Args.addAllArgs(CmdArgs, {options::OPT_flang_experimental_hlfir,
|
||||
options::OPT_flang_deprecated_no_hlfir,
|
||||
options::OPT_flang_experimental_polymorphism,
|
||||
options::OPT_fno_ppc_native_vec_elem_order,
|
||||
options::OPT_fppc_native_vec_elem_order,
|
||||
|
||||
@@ -1073,6 +1073,19 @@ bool CompilerInvocation::createFromArgs(
|
||||
res.loweringOpts.setLowerToHighLevelFIR(true);
|
||||
}
|
||||
|
||||
// -flang-deprecated-no-hlfir
|
||||
if (args.hasArg(clang::driver::options::OPT_flang_deprecated_no_hlfir) &&
|
||||
!args.hasArg(clang::driver::options::OPT_emit_hlfir)) {
|
||||
if (args.hasArg(clang::driver::options::OPT_flang_experimental_hlfir)) {
|
||||
const unsigned diagID = diags.getCustomDiagID(
|
||||
clang::DiagnosticsEngine::Error,
|
||||
"Options '-flang-experimental-hlfir' and "
|
||||
"'-flang-deprecated-no-hlfir' cannot be both specified");
|
||||
diags.Report(diagID);
|
||||
}
|
||||
res.loweringOpts.setLowerToHighLevelFIR(false);
|
||||
}
|
||||
|
||||
if (args.hasArg(clang::driver::options::OPT_flang_experimental_polymorphism)) {
|
||||
res.loweringOpts.setPolymorphicTypeImpl(true);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
! CHECK-NEXT: -fintegrated-as Enable the integrated assembler
|
||||
! CHECK-NEXT: -fintrinsic-modules-path <dir>
|
||||
! CHECK-NEXT: Specify where to find the compiled intrinsic modules
|
||||
! CHECK-NEXT: -flang-deprecated-no-hlfir
|
||||
! CHECK-NEXT: Do not use HLFIR lowering (deprecated)
|
||||
! CHECK-NEXT: -flang-experimental-hlfir
|
||||
! CHECK-NEXT: Use HLFIR lowering (experimental)
|
||||
! CHECK-NEXT: -flang-experimental-polymorphism
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
! RUN: -fversion-loops-for-stride \
|
||||
! RUN: -flang-experimental-polymorphism \
|
||||
! RUN: -flang-experimental-hlfir \
|
||||
! RUN: -flang-deprecated-no-hlfir \
|
||||
! RUN: -fno-ppc-native-vector-element-order \
|
||||
! RUN: -fppc-native-vector-element-order \
|
||||
! RUN: -mllvm -print-before-all \
|
||||
@@ -49,6 +50,7 @@
|
||||
! CHECK: "-fversion-loops-for-stride"
|
||||
! CHECK: "-flang-experimental-polymorphism"
|
||||
! CHECK: "-flang-experimental-hlfir"
|
||||
! CHECK: "-flang-deprecated-no-hlfir"
|
||||
! CHECK: "-fno-ppc-native-vector-element-order"
|
||||
! CHECK: "-fppc-native-vector-element-order"
|
||||
! CHECK: "-Rpass"
|
||||
|
||||
16
flang/test/Driver/hlfir-no-hlfir-error.f90
Normal file
16
flang/test/Driver/hlfir-no-hlfir-error.f90
Normal file
@@ -0,0 +1,16 @@
|
||||
! Test that -flang-experimental-hlfir and -flang-deprecated-no-hlfir
|
||||
! options cannot be both used.
|
||||
|
||||
!--------------------------
|
||||
! FLANG DRIVER (flang-new)
|
||||
!--------------------------
|
||||
! RUN: not %flang -flang-experimental-hlfir -flang-deprecated-no-hlfir %s 2>&1 | FileCheck %s
|
||||
|
||||
!-----------------------------------------
|
||||
! FRONTEND FLANG DRIVER (flang-new -fc1)
|
||||
!-----------------------------------------
|
||||
! RUN: not %flang_fc1 -emit-llvm -flang-experimental-hlfir -flang-deprecated-no-hlfir %s 2>&1 | FileCheck %s
|
||||
|
||||
! CHECK:error: Options '-flang-experimental-hlfir' and '-flang-deprecated-no-hlfir' cannot be both specified
|
||||
|
||||
end
|
||||
@@ -4,6 +4,7 @@
|
||||
! RUN: %flang_fc1 -emit-hlfir -flang-experimental-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
|
||||
! RUN: bbc -emit-hlfir -hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
|
||||
! RUN: %flang_fc1 -emit-fir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
|
||||
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
|
||||
! RUN: bbc -emit-fir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
|
||||
! RUN: %flang_fc1 -emit-fir -flang-experimental-hlfir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
|
||||
! RUN: bbc -emit-fir -hlfir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
|
||||
|
||||
Reference in New Issue
Block a user