ssa: temp disable Finalize; cl: decls sort by name

This commit is contained in:
xushiwei
2024-04-26 03:25:11 +08:00
parent a3d6a94600
commit 91d1d71f6d
16 changed files with 92 additions and 80 deletions

View File

@@ -22,6 +22,10 @@ import (
"github.com/goplus/llgo/cl/cltest"
)
func TestFromTestcgo(t *testing.T) {
cltest.FromDir(t, "", "../cl/_testcgo", true)
}
func TestFromTestdata(t *testing.T) {
cltest.FromDir(t, "", "../cl/_testdata", false)
}

View File

@@ -145,7 +145,8 @@ func (p Function) Param(i int) Expr {
func (p Function) NewBuilder() Builder {
prog := p.prog
b := prog.ctx.NewBuilder()
b.Finalize()
// TODO(xsw): Finalize may cause panic, so comment it.
// b.Finalize()
return &aBuilder{b, p, prog}
}

View File

@@ -122,7 +122,8 @@ func NewProgram(target *Target) Program {
target = &Target{}
}
ctx := llvm.NewContext()
ctx.Finalize()
// TODO(xsw): Finalize may cause panic, so comment it.
// ctx.Finalize()
td := llvm.NewTargetData("") // TODO(xsw): target config
return &aProgram{ctx: ctx, target: target, td: td}
}
@@ -130,7 +131,8 @@ func NewProgram(target *Target) Program {
// NewPackage creates a new package.
func (p Program) NewPackage(name, pkgPath string) Package {
mod := p.ctx.NewModule(pkgPath)
mod.Finalize()
// TODO(xsw): Finalize may cause panic, so comment it.
// mod.Finalize()
fns := make(map[string]Function)
gbls := make(map[string]Global)
return &aPackage{mod, fns, gbls, p}