compiler: move funcImplementation to compileopts

This allows packages other than the compiler to know (from a single
source of truth) which implemenation is used for Go func values.

This refactor is necessary to be able to move the Optimize function to
the transform package.
This commit is contained in:
Ayke van Laethem
2020-03-18 18:47:09 +01:00
committed by Ron Evans
parent 2f88c7aab4
commit 78bd7e094f
3 changed files with 51 additions and 45 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ package compiler
import (
"errors"
"github.com/tinygo-org/tinygo/compileopts"
"github.com/tinygo-org/tinygo/compiler/ircheck"
"github.com/tinygo-org/tinygo/transform"
"tinygo.org/x/go-llvm"
@@ -67,7 +68,7 @@ func (c *Compiler) Optimize(optLevel, sizeLevel int, inlinerThreshold uint) []er
return errs
}
if c.funcImplementation() == funcValueSwitch {
if c.FuncImplementation() == compileopts.FuncValueSwitch {
transform.LowerFuncValues(c.mod)
}
@@ -99,7 +100,7 @@ func (c *Compiler) Optimize(optLevel, sizeLevel int, inlinerThreshold uint) []er
} else {
// Must be run at any optimization level.
transform.LowerInterfaces(c.mod)
if c.funcImplementation() == funcValueSwitch {
if c.FuncImplementation() == compileopts.FuncValueSwitch {
transform.LowerFuncValues(c.mod)
}
errs := transform.LowerInterrupts(c.mod)