Skip to content

cmd/compile: improve the help message of go tool compile -d ssa/help #20349

@dlespiau

Description

@dlespiau

I noticed it was somewhat difficult to read the ssa/help output:

  $ go tool compile -d ssa/help
  compile: GcFlag -d=ssa/<phase>/<flag>[=<value>]|[:<function_name>]
  <phase> is one of:
  check, all, build, intrinsics, early_phielim, early_copyelim
  early_deadcode, short_circuit, decompose_user, opt, zero_arg_cse
  opt_deadcode, generic_cse, phiopt, nilcheckelim, prove, loopbce
  decompose_builtin, dec, late_opt, generic_deadcode, check_bce
  writebarrier, fuse, dse, insert_resched_checks, tighten, lower
  lowered_cse, lowered_deadcode, checkLower, late_phielim, late_copyelim
  phi_tighten, late_deadcode, critical, likelyadjust, layout, schedule
  late_nilcheck, flagalloc, regalloc, stackframe, trim
  <flag> is one of on, off, debug, mem, time, test, stats, dump
  <value> defaults to 1
  <function_name> is required for "dump", specifies name of function to dump after <phase>
  Except for dump, output is directed to standard out; dump appears in a file.
  Phase "all" supports flags "time", "mem", and "dump".
  Phases "intrinsics" supports flags "on", "off", and "debug".
  Interpretation of the "debug" value depends on the phase.
  Dump files are named <phase>__<function_name>_<seq>.dump.

With a few tweaks here and there it looks more pleasing to the eye:

  $ go tool compile -d ssa/help
  compile: usage: -d=ssa/<phase>/<flag>[=<value>|<function_name>]

  <phase> is one of:

  	check, all, build, intrinsics, early_phielim, early_copyelim, early_deadcode
  	short_circuit, decompose_user, opt, zero_arg_cse, opt_deadcode, generic_cse
  	phiopt, nilcheckelim, prove, loopbce, decompose_builtin, dec, late_opt
  	generic_deadcode, check_bce, writebarrier, fuse, dse, insert_resched_checks
  	tighten, lower, lowered_cse, lowered_deadcode, checkLower, late_phielim
  	late_copyelim, phi_tighten, late_deadcode, critical, likelyadjust, layout
  	schedule, late_nilcheck, flagalloc, regalloc, stackframe, trim

  <flag> is one of on, off, debug, mem, time, test, stats, dump.
  Phase all supports flags time, mem, and dump.
  Phase intrinsics supports flags on, off, and debug.

  <value> defaults to 1.

  <function_name> is required for dump, specifies name of function to dump after <phase>.

  Except for dump, output is directed to standard out; dump appears in a file.
  Dump files are named <phase>__<function_name>_<seq>.dump.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions