mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 14:03:39 +00:00
compiler: refactor when the optsize attribute is set
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.
This commit is contained in:
committed by
Ron Evans
parent
1869efe954
commit
d7b7583e83
@@ -68,12 +68,12 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
OptimizeStringToBytes(mod)
|
||||
OptimizeReflectImplements(mod)
|
||||
OptimizeAllocs(mod, nil, nil)
|
||||
err := LowerInterfaces(mod, sizeLevel)
|
||||
err := LowerInterfaces(mod, config)
|
||||
if err != nil {
|
||||
return []error{err}
|
||||
}
|
||||
|
||||
errs := LowerInterrupts(mod, sizeLevel)
|
||||
errs := LowerInterrupts(mod, config)
|
||||
if len(errs) > 0 {
|
||||
return errs
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
|
||||
} else {
|
||||
// Must be run at any optimization level.
|
||||
err := LowerInterfaces(mod, sizeLevel)
|
||||
err := LowerInterfaces(mod, config)
|
||||
if err != nil {
|
||||
return []error{err}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
if config.FuncImplementation() == "switch" {
|
||||
LowerFuncValues(mod)
|
||||
}
|
||||
errs := LowerInterrupts(mod, sizeLevel)
|
||||
errs := LowerInterrupts(mod, config)
|
||||
if len(errs) > 0 {
|
||||
return errs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user