
This commit has a few related changes: * It sets the optsize attribute immediately in the compiler instead of adding it to each function afterwards in a loop. This seems to me like the more appropriate way to do it. * It centralizes setting the optsize attribute in the transform package, to make later changes easier. * It sets the optsize in a few more places: to runtime.initAll and to WebAssembly i64 wrappers. This commit does not affect the binary size of any of the smoke tests, so should be risk-free.
26 строки
605 Б
Go
26 строки
605 Б
Go
package transform_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/tinygo-org/tinygo/compileopts"
|
|
"github.com/tinygo-org/tinygo/transform"
|
|
"tinygo.org/x/go-llvm"
|
|
)
|
|
|
|
func TestInterruptLowering(t *testing.T) {
|
|
t.Parallel()
|
|
for _, subtest := range []string{"avr", "cortexm"} {
|
|
t.Run(subtest, func(t *testing.T) {
|
|
testTransform(t, "testdata/interrupt-"+subtest, func(mod llvm.Module) {
|
|
errs := transform.LowerInterrupts(mod, &compileopts.Config{Options: &compileopts.Options{Opt: "2"}})
|
|
if len(errs) != 0 {
|
|
t.Fail()
|
|
for _, err := range errs {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|