This commit is contained in:
parent
f7be86a3d9
commit
d1ce1ef839
24 changed files with 534 additions and 59 deletions
26
src/compiler/showSSA.go
Normal file
26
src/compiler/showSSA.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
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())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue