Improved SSA and added unused value checks
All checks were successful
/ test (push) Successful in 17s

This commit is contained in:
Eduard Urbach 2025-06-23 23:11:05 +02:00
parent cc2e98ca49
commit 2b703e9af2
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
25 changed files with 519 additions and 213 deletions

View file

@ -10,14 +10,14 @@ import (
// Function is the smallest unit of code.
type Function struct {
ssa.Function
ssa.IR
Name string
UniqueName string
File *fs.File
Input []*Parameter
Output []*Parameter
Body token.List
Identifiers map[string]*ssa.Value
Identifiers map[string]ssa.Value
Err error
}
@ -27,9 +27,11 @@ func NewFunction(name string, file *fs.File) *Function {
Name: name,
File: file,
UniqueName: fmt.Sprintf("%s.%s", file.Package, name),
Identifiers: make(map[string]*ssa.Value),
Function: ssa.Function{
Blocks: []*ssa.Block{{}},
Identifiers: make(map[string]ssa.Value),
IR: ssa.IR{
Blocks: []*ssa.Block{
{Instructions: make([]ssa.Value, 0, 8)},
},
},
}
}