Skip to content

Commit

Permalink
Improve crossgen2 --help layout (#88544)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored Jul 8, 2023
1 parent 045b526 commit ce78f97
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
7 changes: 4 additions & 3 deletions src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,6 @@ public static IEnumerable<Action<HelpContext>> GetExtendedHelp(HelpContext _)
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))
Expand All @@ -331,6 +328,8 @@ public static IEnumerable<Action<HelpContext>> GetExtendedHelp(HelpContext _)
{
if (first)
{
Console.Write(arch);
Console.Write(": ");
first = false;
}
else
Expand All @@ -341,6 +340,8 @@ public static IEnumerable<Action<HelpContext>> GetExtendedHelp(HelpContext _)
}
}
if (first) continue; // no instruction-set found for this architecture
Console.WriteLine();
}
Expand Down
22 changes: 16 additions & 6 deletions src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal class Crossgen2RootCommand : CliRootCommand
public CliOption<bool> OptimizeTime { get; } =
new("--optimize-time", "--Ot") { Description = SR.OptimizeSpeedOption };
public CliOption<TypeValidationRule> TypeValidation { get; } =
new("--type-validation") { DefaultValueFactory = _ => TypeValidationRule.Automatic, Description = SR.TypeValidation };
new("--type-validation") { DefaultValueFactory = _ => TypeValidationRule.Automatic, Description = SR.TypeValidation, HelpName = "arg" };
public CliOption<bool> InputBubble { get; } =
new("--inputbubble") { Description = SR.InputBubbleOption };
public CliOption<Dictionary<string, string>> InputBubbleReferenceFilePaths { get; } =
Expand Down Expand Up @@ -126,9 +126,9 @@ internal class Crossgen2RootCommand : CliRootCommand
public CliOption<string> NonLocalGenericsModule { get; } =
new("--non-local-generics-module") { DefaultValueFactory = _ => string.Empty, Description = SR.NonLocalGenericsModule };
public CliOption<ReadyToRunMethodLayoutAlgorithm> 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<ReadyToRunFileLayoutAlgorithm> 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<bool> VerifyTypeAndFieldLayout { get; } =
new("--verify-type-and-field-layout") { Description = SR.VerifyTypeAndFieldLayoutOption };
public CliOption<string> CallChainProfileFile { get; } =
Expand Down Expand Up @@ -301,13 +301,19 @@ public static IEnumerable<Action<HelpContext>> GetExtendedHelp(HelpContext _)
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<TypeValidationRule>()), nameof(TypeValidationRule.Automatic)));
Console.WriteLine();
Console.WriteLine(SR.CrossModuleInliningExtraHelp);
Console.WriteLine();
Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--method-layout", String.Join("', '", Enum.GetNames<ReadyToRunMethodLayoutAlgorithm>())));
Console.WriteLine();
Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--file-layout", String.Join("', '", Enum.GetNames<ReadyToRunFileLayoutAlgorithm>())));
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))
Expand All @@ -317,6 +323,8 @@ public static IEnumerable<Action<HelpContext>> GetExtendedHelp(HelpContext _)
{
if (first)
{
Console.Write(arch);
Console.Write(": ");
first = false;
}
else
Expand All @@ -327,6 +335,8 @@ public static IEnumerable<Action<HelpContext>> GetExtendedHelp(HelpContext _)
}
}
if (first) continue; // no instruction-set found for this architecture
Console.WriteLine();
}
Expand Down
19 changes: 14 additions & 5 deletions src/coreclr/tools/aot/crossgen2/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,13 @@
<value>Error: multiple input files are only supported in composite build mode: {0}</value>
</data>
<data name="MethodLayoutOption" xml:space="preserve">
<value>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.</value>
<value>Layout algorithm used by profile-driven optimization for arranging methods in a file.</value>
</data>
<data name="FileLayoutOption" xml:space="preserve">
<value>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.</value>
<value>Layout algorithm used by profile-driven optimization for arranging non-method contents in a file.</value>
</data>
<data name="LayoutOptionExtraHelp" xml:space="preserve">
<value>Note for {0}: Valid options are {1}. The default value is DefaultSort, which indicates that complex layout is disabled.</value>
</data>
<data name="CompositeRootPath" xml:space="preserve">
<value>Logical root folder for composite builds; defaults to directory of 1st input file.</value>
Expand Down Expand Up @@ -382,13 +385,19 @@
<value>Hexadecimal value to set target PE-file ImageBase field</value>
</data>
<data name="CrossModuleInlining" xml:space="preserve">
<value>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.</value>
<value>Allow inclusion of code from the specified module into the module being compiled.</value>
</data>
<data name="CrossModuleInliningExtraHelp" xml:space="preserve">
<value>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.</value>
</data>
<data name="AsyncModuleOptimization" xml:space="preserve">
<value>Attempt to compile as much async infrastructure as possible for async methods. Defaults to enabled. To disable, specify false to this flag explicitly.</value>
</data>
<data name="NonLocalGenericsModule" xml:space="preserve">
<value>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.</value>
<value>Specify "*" to indicate that any module may hold arbitrary generics.</value>
</data>
<data name="NonLocalGenericsModuleExtraHelp" xml:space="preserve">
<value>Note for --non-local-generics-module: Specify "*" to indicate that any module may hold arbitrary generics.</value>
</data>
<data name="ErrorNonLocalGenericsModule" xml:space="preserve">
<value>"{0}" was specified to the --non-local-generics-module switch, but was not in the set of modules associated with the compile</value>
Expand All @@ -414,4 +423,4 @@
<data name="GenericCycleDepthCutoff" xml:space="preserve">
<value>Number of nested occurrences of a potentially cyclic generic type to cut off</value>
</data>
</root>
</root>

0 comments on commit ce78f97

Please sign in to comment.