Skip to content

Commit 5f298a8

Browse files
committed
RequirementMachine: Add -analyze-requirement-machine flag to print statistics
1 parent b7c4d82 commit 5f298a8

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@ namespace swift {
464464
/// Enables debugging output from the requirement machine.
465465
bool DebugRequirementMachine = false;
466466

467+
/// Enables statistics output from the requirement machine.
468+
bool AnalyzeRequirementMachine = false;
469+
467470
/// Maximum iteration count for requirement machine confluent completion
468471
/// algorithm.
469472
unsigned RequirementMachineStepLimit = 2000;

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ def disable_named_lazy_member_loading : Flag<["-"], "disable-named-lazy-member-l
276276
def debug_requirement_machine : Flag<["-"], "debug-requirement-machine">,
277277
HelpText<"Enables debugging output from the generics implementation">;
278278

279+
def analyze_requirement_machine : Flag<["-"], "analyze-requirement-machine">,
280+
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
281+
HelpText<"Print out requirement machine statistics at the end of the compilation job">;
282+
279283
def requirement_machine_step_limit : Separate<["-"], "requirement-machine-step-limit">,
280284
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
281285
HelpText<"Set the maximum steps before we give up on confluent completion">;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
829829

830830
Opts.DebugRequirementMachine = Args.hasArg(
831831
OPT_debug_requirement_machine);
832+
Opts.AnalyzeRequirementMachine = Args.hasArg(
833+
OPT_analyze_requirement_machine);
832834

833835
if (const Arg *A = Args.getLastArg(OPT_requirement_machine_step_limit)) {
834836
unsigned limit;

0 commit comments

Comments
 (0)