From ce78f97c8718ca6879e02f278fc10d0e4839ed7c Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Sun, 9 Jul 2023 01:33:35 +0300 Subject: [PATCH] Improve crossgen2 --help layout (#88544) --- .../tools/aot/ILCompiler/ILCompilerRootCommand.cs | 7 ++++--- .../tools/aot/crossgen2/Crossgen2RootCommand.cs | 22 ++++++++++++++++------ .../tools/aot/crossgen2/Properties/Resources.resx | 19 ++++++++++++++----- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs index aff106e..6ac3e5a 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs +++ b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs @@ -319,9 +319,6 @@ namespace ILCompiler foreach (string arch in ValidArchitectures) { - Console.Write(arch); - Console.Write(": "); - TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch); bool first = true; foreach (var instructionSet in Internal.JitInterface.InstructionSetFlags.ArchitectureToValidInstructionSets(targetArch)) @@ -331,6 +328,8 @@ namespace ILCompiler { if (first) { + Console.Write(arch); + Console.Write(": "); first = false; } else @@ -341,6 +340,8 @@ namespace ILCompiler } } + if (first) continue; // no instruction-set found for this architecture + Console.WriteLine(); } diff --git a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs index 0b58657..4e97b67 100644 --- a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs +++ b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs @@ -40,7 +40,7 @@ namespace ILCompiler public CliOption OptimizeTime { get; } = new("--optimize-time", "--Ot") { Description = SR.OptimizeSpeedOption }; public CliOption TypeValidation { get; } = - new("--type-validation") { DefaultValueFactory = _ => TypeValidationRule.Automatic, Description = SR.TypeValidation }; + new("--type-validation") { DefaultValueFactory = _ => TypeValidationRule.Automatic, Description = SR.TypeValidation, HelpName = "arg" }; public CliOption InputBubble { get; } = new("--inputbubble") { Description = SR.InputBubbleOption }; public CliOption> InputBubbleReferenceFilePaths { get; } = @@ -126,9 +126,9 @@ namespace ILCompiler public CliOption NonLocalGenericsModule { get; } = new("--non-local-generics-module") { DefaultValueFactory = _ => string.Empty, Description = SR.NonLocalGenericsModule }; public CliOption MethodLayout { get; } = - new("--method-layout") { CustomParser = MakeReadyToRunMethodLayoutAlgorithm, DefaultValueFactory = MakeReadyToRunMethodLayoutAlgorithm, Description = SR.MethodLayoutOption }; + new("--method-layout") { CustomParser = MakeReadyToRunMethodLayoutAlgorithm, DefaultValueFactory = MakeReadyToRunMethodLayoutAlgorithm, Description = SR.MethodLayoutOption, HelpName = "arg" }; public CliOption FileLayout { get; } = - new("--file-layout") { CustomParser = MakeReadyToRunFileLayoutAlgorithm, DefaultValueFactory = MakeReadyToRunFileLayoutAlgorithm, Description = SR.FileLayoutOption }; + new("--file-layout") { CustomParser = MakeReadyToRunFileLayoutAlgorithm, DefaultValueFactory = MakeReadyToRunFileLayoutAlgorithm, Description = SR.FileLayoutOption, HelpName = "arg" }; public CliOption VerifyTypeAndFieldLayout { get; } = new("--verify-type-and-field-layout") { Description = SR.VerifyTypeAndFieldLayoutOption }; public CliOption CallChainProfileFile { get; } = @@ -301,13 +301,19 @@ namespace ILCompiler Console.WriteLine(); Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetarch", String.Join("', '", ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant())); Console.WriteLine(); + Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--type-validation", String.Join("', '", Enum.GetNames()), nameof(TypeValidationRule.Automatic))); + Console.WriteLine(); + + Console.WriteLine(SR.CrossModuleInliningExtraHelp); + Console.WriteLine(); + Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--method-layout", String.Join("', '", Enum.GetNames()))); + Console.WriteLine(); + Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--file-layout", String.Join("', '", Enum.GetNames()))); + Console.WriteLine(); Console.WriteLine(SR.InstructionSetHelp); foreach (string arch in ValidArchitectures) { - Console.Write(arch); - Console.Write(": "); - TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch); bool first = true; foreach (var instructionSet in Internal.JitInterface.InstructionSetFlags.ArchitectureToValidInstructionSets(targetArch)) @@ -317,6 +323,8 @@ namespace ILCompiler { if (first) { + Console.Write(arch); + Console.Write(": "); first = false; } else @@ -327,6 +335,8 @@ namespace ILCompiler } } + if (first) continue; // no instruction-set found for this architecture + Console.WriteLine(); } diff --git a/src/coreclr/tools/aot/crossgen2/Properties/Resources.resx b/src/coreclr/tools/aot/crossgen2/Properties/Resources.resx index 0b8a1f4..59bfc79 100644 --- a/src/coreclr/tools/aot/crossgen2/Properties/Resources.resx +++ b/src/coreclr/tools/aot/crossgen2/Properties/Resources.resx @@ -313,10 +313,13 @@ Error: multiple input files are only supported in composite build mode: {0} - Layout algorithm used by profile-driven optimization for arranging methods in a file: DefaultSort, ExclusiveWeight, HotCold, or HotWarmCold). The default value is DefaultSort, which indicates that complex layout is disabled. + Layout algorithm used by profile-driven optimization for arranging methods in a file. - Layout algorithm used by profile-driven optimization for arranging non-method contents in a file: DefaultSort or MethodOrder. The default value is DefaultSort, which indicates that complex layout is disabled. + Layout algorithm used by profile-driven optimization for arranging non-method contents in a file. + + + Note for {0}: Valid options are {1}. The default value is DefaultSort, which indicates that complex layout is disabled. Logical root folder for composite builds; defaults to directory of 1st input file. @@ -382,13 +385,19 @@ Hexadecimal value to set target PE-file ImageBase field - Allow inclusion of code from the specified module into the module being compiled. In addition to specifying an assembly by name, the special value of "*" is recognized as indicating that code from all modules may be included. Any module specified in this way MUST be loadable from the first moment the R2R module is loaded, as loads of these modules may be triggered unpredictably. + Allow inclusion of code from the specified module into the module being compiled. + + + Note for --opt-cross-module: In addition to specifying an assembly by name, the special value of "*" is recognized as indicating that code from all modules may be included. Any module specified in this way MUST be loadable from the first moment the R2R module is loaded, as loads of these modules may be triggered unpredictably. Attempt to compile as much async infrastructure as possible for async methods. Defaults to enabled. To disable, specify false to this flag explicitly. - Specify the module which is permitted to contain generics defined or instantiated in any other module. Specify "*" to indicate that any module may hold arbitrary generics. + Specify "*" to indicate that any module may hold arbitrary generics. + + + Note for --non-local-generics-module: Specify "*" to indicate that any module may hold arbitrary generics. "{0}" was specified to the --non-local-generics-module switch, but was not in the set of modules associated with the compile @@ -414,4 +423,4 @@ Number of nested occurrences of a potentially cyclic generic type to cut off - \ No newline at end of file + -- 2.7.4