diff --git a/src/cli/Exec_test.go b/src/cli/Exec_test.go index bebb43e..229bb3a 100644 --- a/src/cli/Exec_test.go +++ b/src/cli/Exec_test.go @@ -16,8 +16,8 @@ func TestExec(t *testing.T) { assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "mac", "--arch", "x86"}), 0) assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "windows", "--arch", "arm"}), 0) assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "windows", "--arch", "x86"}), 0) - assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--assembly"}), 0) - assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--intermediate"}), 0) + assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--asm"}), 0) + assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--ssa"}), 0) assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--verbose"}), 0) assert.Equal(t, cli.Exec([]string{"help"}), 0) assert.Equal(t, cli.Exec([]string{"run", "../../examples/hello"}), 0) diff --git a/src/cli/build.go b/src/cli/build.go index a1e2944..986f022 100644 --- a/src/cli/build.go +++ b/src/cli/build.go @@ -56,14 +56,14 @@ func newBuild(args []string) (*config.Build, error) { return nil, &InvalidValue{Value: args[i], Parameter: "arch"} } - case "--assembly", "-asm": + case "--asm": build.ShowASM = true case "--dry": build.Dry = true - case "--intermediate", "-ir": - build.ShowIR = true + case "--ssa": + build.ShowSSA = true case "--os": i++ diff --git a/src/cli/help.go b/src/cli/help.go index c8b7e3a..282aeb5 100644 --- a/src/cli/help.go +++ b/src/cli/help.go @@ -16,7 +16,7 @@ func help() int { for line := range strings.Lines(helpText) { switch { case strings.HasPrefix(line, " "): - startDimmed := strings.IndexByte(line, '(') + startDimmed := strings.IndexByte(line, '#') dimmed := "" if startDimmed != -1 { diff --git a/src/cli/help.txt b/src/cli/help.txt index de3ab0e..0e15341 100644 --- a/src/cli/help.txt +++ b/src/cli/help.txt @@ -8,25 +8,15 @@ Compiler for the q programming language. q build [file] - Build for another architecture: + Build for another system: - q build [file] --arch [x86|arm] + q build [file] --os [linux|mac|windows] --arch [x86|arm] - Build for another operating system: + Show output from various stages: - q build [file] --os [linux|mac|windows] - - Show assembly code: - - q build [file] -asm (--assembly) - - Show intermediate representation: - - q build [file] -ir (--intermediate) - - Show output from all stages: - - q build [file] -v (--verbose) + q build [file] --asm # assembly code + q build [file] --ssa # static single assigment form + q build [file] --verbose # all of the above Show this help: diff --git a/src/config/Build.go b/src/config/Build.go index c7ee3a0..97ec89f 100644 --- a/src/config/Build.go +++ b/src/config/Build.go @@ -8,5 +8,5 @@ type Build struct { Dry bool ShowASM bool ShowHeaders bool - ShowIR bool + ShowSSA bool } \ No newline at end of file diff --git a/src/config/SetVerbose.go b/src/config/SetVerbose.go index 3cd5acb..8aa6509 100644 --- a/src/config/SetVerbose.go +++ b/src/config/SetVerbose.go @@ -4,5 +4,5 @@ package config func (build *Build) SetVerbose(verbose bool) { build.ShowASM = verbose build.ShowHeaders = verbose - build.ShowIR = verbose + build.ShowSSA = verbose } \ No newline at end of file diff --git a/src/verbose/IR.txt b/src/verbose/IR.txt deleted file mode 100644 index 6420e4a..0000000 --- a/src/verbose/IR.txt +++ /dev/null @@ -1,5 +0,0 @@ - ___ ____ -|_ _| _ \ - | || |_) | - | || _ < -|___|_| \_\ \ No newline at end of file diff --git a/src/verbose/IR.go b/src/verbose/SSA.go similarity index 89% rename from src/verbose/IR.go rename to src/verbose/SSA.go index 0e7d0a9..eb9c201 100644 --- a/src/verbose/IR.go +++ b/src/verbose/SSA.go @@ -9,11 +9,11 @@ import ( "git.urbach.dev/go/color/ansi" ) -//go:embed IR.txt -var HeaderIR string +//go:embed SSA.txt +var HeaderSSA string -// IR shows the SSA IR. -func IR(root *core.Function) { +// SSA shows the SSA IR. +func SSA(root *core.Function) { root.EachDependency(make(map[*core.Function]bool), func(f *core.Function) { ansi.Yellow.Println(f.FullName + ":") diff --git a/src/verbose/SSA.txt b/src/verbose/SSA.txt new file mode 100644 index 0000000..b79f093 --- /dev/null +++ b/src/verbose/SSA.txt @@ -0,0 +1,5 @@ + ____ ____ _ +/ ___/ ___| / \ +\___ \___ \ / _ \ + ___) |__) / ___ \ +|____/____/_/ \_\ \ No newline at end of file diff --git a/src/verbose/Show.go b/src/verbose/Show.go index 2df90aa..2125342 100644 --- a/src/verbose/Show.go +++ b/src/verbose/Show.go @@ -4,12 +4,12 @@ import "git.urbach.dev/cli/q/src/core" // Show shows additional information about the build. func Show(env *core.Environment) { - if env.Build.ShowIR { + if env.Build.ShowSSA { if env.Build.ShowHeaders { - Header(HeaderIR) + Header(HeaderSSA) } - IR(env.Init) + SSA(env.Init) } if env.Build.ShowASM {