mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 06:53:40 +00:00
compiler: move settings to a separate Config struct
Moving settings to a separate config struct has two benefits:
- It decouples the compiler a bit from other packages, most
importantly the compileopts package. Decoupling is generally a good
thing.
- Perhaps more importantly, it precisely specifies which settings are
used while compiling and affect the resulting LLVM module. This will
be necessary for caching the LLVM module.
While it would have been possible to cache without this refactor, it
would have been very easy to miss a setting and thus let the
compiler work with invalid/stale data.
This commit is contained in:
committed by
Ron Evans
parent
868933e67c
commit
9612af466b
@@ -85,7 +85,7 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
return errs
|
||||
}
|
||||
|
||||
if config.FuncImplementation() == compileopts.FuncValueSwitch {
|
||||
if config.FuncImplementation() == "switch" {
|
||||
LowerFuncValues(mod)
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
if err != nil {
|
||||
return []error{err}
|
||||
}
|
||||
if config.FuncImplementation() == compileopts.FuncValueSwitch {
|
||||
if config.FuncImplementation() == "switch" {
|
||||
LowerFuncValues(mod)
|
||||
}
|
||||
errs := LowerInterrupts(mod)
|
||||
|
||||
Reference in New Issue
Block a user