Implemented an assembler
All checks were successful
/ test (push) Successful in 28s

This commit is contained in:
Eduard Urbach 2025-06-24 12:55:26 +02:00
parent 2b703e9af2
commit 70c2da4a4d
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
40 changed files with 821 additions and 117 deletions

View file

@ -1,9 +1,5 @@
package ssa
import (
"git.urbach.dev/cli/q/src/cpu"
)
// IR is a list of basic blocks.
type IR struct {
Blocks []*Block
@ -44,8 +40,8 @@ func (f *IR) AppendInt(x int) *Int {
}
// AppendRegister adds a new register value to the last block.
func (f *IR) AppendRegister(reg cpu.Register) *Register {
v := &Register{Register: reg}
func (f *IR) AppendRegister(index int) *Parameter {
v := &Parameter{Index: uint8(index)}
f.Append(v)
return v
}