diff options
author | Ayke van Laethem <[email protected]> | 2018-11-25 17:37:31 +0100 |
---|---|---|
committer | Ayke van Laethem <[email protected]> | 2018-12-10 15:36:23 +0100 |
commit | e10d05c74fca049207a89939581cea1087457423 (patch) | |
tree | 1cbd43453456fa8dbfd6fd21ddedc07805149220 /ir | |
parent | 564b1b3312b02a0b664b3cf55320236e1227bd82 (diff) | |
download | tinygo-e10d05c74fca049207a89939581cea1087457423.tar.gz tinygo-e10d05c74fca049207a89939581cea1087457423.zip |
loader: switch to custom program loader
Diffstat (limited to 'ir')
-rw-r--r-- | ir/ir.go | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -8,9 +8,8 @@ import ( "strings" "github.com/aykevl/go-llvm" - "golang.org/x/tools/go/loader" + "github.com/aykevl/tinygo/loader" "golang.org/x/tools/go/ssa" - "golang.org/x/tools/go/ssa/ssautil" ) // This file provides a wrapper around go/ssa values and adds extra @@ -78,7 +77,7 @@ type Interface struct { // Create and intialize a new *Program from a *ssa.Program. func NewProgram(lprogram *loader.Program, mainPath string) *Program { comments := map[string]*ast.CommentGroup{} - for _, pkgInfo := range lprogram.AllPackages { + for _, pkgInfo := range lprogram.Sorted() { for _, file := range pkgInfo.Files { for _, decl := range file.Decls { switch decl := decl.(type) { @@ -106,7 +105,7 @@ func NewProgram(lprogram *loader.Program, mainPath string) *Program { } } - program := ssautil.CreateProgram(lprogram, ssa.SanityCheckFunctions|ssa.BareInits|ssa.GlobalDebug) + program := lprogram.LoadSSA() program.Build() // Find the main package, which is a bit difficult when running a .go file |