aboutsummaryrefslogtreecommitdiffhomepage
path: root/compileopts
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-09-19 22:37:44 +0200
committerRon Evans <[email protected]>2023-10-04 13:05:58 +0200
commit3b1913ac57420af2c665c6f1c3847a6e63774ecd (patch)
tree77460ae8c35853f7f16d4f8575576e677d78e737 /compileopts
parent1da1abe3147796aa56a5486ed6f07afdd88d8234 (diff)
downloadtinygo-3b1913ac57420af2c665c6f1c3847a6e63774ecd.tar.gz
tinygo-3b1913ac57420af2c665c6f1c3847a6e63774ecd.zip
all: use the new LLVM pass manager
The old LLVM pass manager is deprecated and should not be used anymore. Moreover, the pass manager builder (which we used to set up a pass pipeline) is actually removed from LLVM entirely in LLVM 17: https://reviews.llvm.org/D145387 https://reviews.llvm.org/D145835 The new pass manager does change the binary size in many cases: both growing and shrinking it. However, on average the binary size remains more or less the same. This is needed as a preparation for LLVM 17.
Diffstat (limited to 'compileopts')
-rw-r--r--compileopts/config.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/compileopts/config.go b/compileopts/config.go
index 39fc4f2ac..5ad45c607 100644
--- a/compileopts/config.go
+++ b/compileopts/config.go
@@ -145,18 +145,18 @@ func (c *Config) Serial() string {
// OptLevels returns the optimization level (0-2), size level (0-2), and inliner
// threshold as used in the LLVM optimization pipeline.
-func (c *Config) OptLevels() (optLevel, sizeLevel int, inlinerThreshold uint) {
+func (c *Config) OptLevel() (level string, speedLevel, sizeLevel int) {
switch c.Options.Opt {
case "none", "0":
- return 0, 0, 0 // -O0
+ return "O0", 0, 0
case "1":
- return 1, 0, 0 // -O1
+ return "O1", 1, 0
case "2":
- return 2, 0, 225 // -O2
+ return "O2", 2, 0
case "s":
- return 2, 1, 225 // -Os
+ return "Os", 2, 1
case "z":
- return 2, 2, 5 // -Oz, default
+ return "Oz", 2, 2 // default
default:
// This is not shown to the user: valid choices are already checked as
// part of Options.Verify(). It is here as a sanity check.