Skip to content

Commit

Permalink
[Driver] Make some options visible to Classic Flang
Browse files Browse the repository at this point in the history
Classic Flang accepts some options that LLVM Flang (F18) does not.
The Visibility of such options are modified to include "FlangOption".
  • Loading branch information
bryanpkc committed Apr 4, 2024
1 parent 391a23a commit 0045ba9
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ def _DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>,
def A : JoinedOrSeparate<["-"], "A">, Flags<[RenderJoined]>,
Group<gfortran_Group>;
def B : JoinedOrSeparate<["-"], "B">, MetaVarName<"<prefix>">,
Visibility<[ClangOption, FlangOption]>,
HelpText<"Search $prefix$file for executables, libraries, and data files. "
"If $prefix is a directory, search $prefix/$file">;
def gcc_install_dir_EQ : Joined<["--"], "gcc-install-dir=">,
Expand Down Expand Up @@ -1450,6 +1451,7 @@ def emit_ast : Flag<["-"], "emit-ast">,
HelpText<"Emit Clang AST files for source inputs">;
#ifdef ENABLE_CLASSIC_FLANG
def emit_flang_llvm : Flag<["-"], "emit-flang-llvm">,
Visibility<[FlangOption]>,
HelpText<"Emit Flang LLVM files for source inputs">;
#endif
def emit_llvm : Flag<["-"], "emit-llvm">,
Expand Down Expand Up @@ -5492,7 +5494,7 @@ def : Flag<["-"], "mtune=help">, Alias<print_supported_cpus>;
def time : Flag<["-"], "time">,
HelpText<"Time individual commands">;
def traditional_cpp : Flag<["-", "--"], "traditional-cpp">,
Visibility<[ClangOption, CC1Option]>,
Visibility<[ClangOption, CC1Option, FlangOption]>,
HelpText<"Enable some traditional CPP emulation">,
MarshallingInfoFlag<LangOpts<"TraditionalCPP">>;
def traditional : Flag<["-", "--"], "traditional">;
Expand Down Expand Up @@ -5569,7 +5571,8 @@ def fno_integrated_objemitter : Flag<["-"], "fno-integrated-objemitter">,
Group<f_Group>,
HelpText<"Use external machine object code emitter.">;

def : Flag<["-"], "integrated-as">, Alias<fintegrated_as>;
def : Flag<["-"], "integrated-as">, Alias<fintegrated_as>,
Visibility<[ClangOption, CC1Option, FlangOption]>;
def : Flag<["-"], "no-integrated-as">, Alias<fno_integrated_as>,
Visibility<[ClangOption, CC1Option, FlangOption]>;

Expand Down Expand Up @@ -6479,7 +6482,7 @@ defm loop_versioning : BoolOptionWithoutMarshalling<"f", "version-loops-for-stri

#ifdef ENABLE_CLASSIC_FLANG
def J : JoinedOrSeparate<["-"], "J">,
Flags<[RenderJoined]>,
Flags<[RenderJoined]>, Visibility<[FlangOption, FC1Option]>,
Group<gfortran_Group>;
#else
def J : JoinedOrSeparate<["-"], "J">,
Expand Down Expand Up @@ -8539,6 +8542,27 @@ def fcgl : DXCFlag<"fcgl">, Alias<emit_pristine_llvm>;
def enable_16bit_types : DXCFlag<"enable-16bit-types">, Alias<fnative_half_type>,
HelpText<"Enable 16-bit types and disable min precision types."
"Available in HLSL 2018 and shader model 6.2.">;
def hlsl_entrypoint : Option<["-"], "hlsl-entry", KIND_SEPARATE>,
Group<dxc_Group>,
Visibility<[ClangOption, CC1Option]>,
MarshallingInfoString<TargetOpts<"HLSLEntry">, "\"main\"">,
HelpText<"Entry point name for hlsl">;
def dxc_entrypoint : Option<["--", "/", "-"], "E", KIND_JOINED_OR_SEPARATE>,
Group<dxc_Group>,
Visibility<[DXCOption]>,
HelpText<"Entry point name">;
def dxc_validator_path_EQ : Joined<["--"], "dxv-path=">, Group<dxc_Group>,
HelpText<"DXIL validator installation path">;
def dxc_disable_validation : DXCFlag<"Vd">,
HelpText<"Disable validation">;
def : Option<["/", "-"], "Qembed_debug", KIND_FLAG>, Group<dxc_Group>,
Flags<[Ignored]>, Visibility<[DXCOption]>,
HelpText<"Embed PDB in shader container (ignored)">;
def spirv : DXCFlag<"spirv">,
HelpText<"Generate SPIR-V code">;
def fspv_target_env_EQ : Joined<["-"], "fspv-target-env=">, Group<dxc_Group>,
HelpText<"Specify the target environment">,
Values<"vulkan1.2, vulkan1.3">;

#ifdef ENABLE_CLASSIC_FLANG
// Classic Flang options that we recognize in the driver and pass along when
Expand All @@ -8558,6 +8582,8 @@ multiclass BooleanMFlag<string name> {
def _off : Flag<["-"], "Mno"#name>;
}

let Visibility = [FlangOption] in {

def Mfixed : Flag<["-"], "Mfixed">, Group<fortran_format_Group>,
HelpText<"Force fixed-form format Fortran">,
Flags<[HelpHidden]>;
Expand Down Expand Up @@ -8677,25 +8703,6 @@ def Hq_EQ : Joined<["-"], "Hq,">, Group<pgi_fortran_Group>;
def Mqq_EQ : Joined<["-"], "Mqq,">, Group<pgi_fortran_Group>;
def Hqq_EQ : Joined<["-"], "Hqq,">, Group<pgi_fortran_Group>;
def Wh_EQ : Joined<["-"], "Wh,">, Group<pgi_fortran_Group>;

} // let Visibility = [FlangOption]
#endif
def hlsl_entrypoint : Option<["-"], "hlsl-entry", KIND_SEPARATE>,
Group<dxc_Group>,
Visibility<[ClangOption, CC1Option]>,
MarshallingInfoString<TargetOpts<"HLSLEntry">, "\"main\"">,
HelpText<"Entry point name for hlsl">;
def dxc_entrypoint : Option<["--", "/", "-"], "E", KIND_JOINED_OR_SEPARATE>,
Group<dxc_Group>,
Visibility<[DXCOption]>,
HelpText<"Entry point name">;
def dxc_validator_path_EQ : Joined<["--"], "dxv-path=">, Group<dxc_Group>,
HelpText<"DXIL validator installation path">;
def dxc_disable_validation : DXCFlag<"Vd">,
HelpText<"Disable validation">;
def : Option<["/", "-"], "Qembed_debug", KIND_FLAG>, Group<dxc_Group>,
Flags<[Ignored]>, Visibility<[DXCOption]>,
HelpText<"Embed PDB in shader container (ignored)">;
def spirv : DXCFlag<"spirv">,
HelpText<"Generate SPIR-V code">;
def fspv_target_env_EQ : Joined<["-"], "fspv-target-env=">, Group<dxc_Group>,
HelpText<"Specify the target environment">,
Values<"vulkan1.2, vulkan1.3">;

0 comments on commit 0045ba9

Please sign in to comment.