q/src/compiler/showSSA.go
Eduard Urbach d1ce1ef839
Some checks failed
/ test (push) Failing after 31s
Implemented compilation to SSA form
2025-06-23 00:09:52 +02:00

26 lines
No EOL
448 B
Go

package compiler
import (
"fmt"
"iter"
"git.urbach.dev/cli/q/src/core"
"git.urbach.dev/go/color/ansi"
)
// showSSA shows the SSA IR.
func showSSA(functions iter.Seq[*core.Function]) {
for f := range functions {
ansi.Bold.Printf("%s:\n", f.UniqueName)
for i, block := range f.Blocks {
if i != 0 {
fmt.Println("---")
}
for i, instr := range block.Instructions {
fmt.Printf("t%d = %s\n", i, instr.String())
}
}
}
}