tinygo/transform
Ayke van Laethem 603fff78d4 all: add support for ThinLTO
ThinLTO optimizes across LLVM modules at link time. This means that
optimizations (such as inlining and const-propagation) are possible
between C and Go. This makes this change especially useful for CGo, but
not just for CGo. By doing some optimizations at link time, the linker
can discard some unused functions and this leads to a size reduction on
average. It does increase code size in some cases, but that's true for
most optimizations.

I've excluded a number of targets for now (wasm, avr, xtensa, windows,
macos). They can probably be supported with some more work, but that
should be done in separate PRs.

Overall, this change results in an average 3.24% size reduction over all
the tinygo.org/x/drivers smoke tests.

TODO: this commit runs part of the pass pipeline twice. We should set
the PrepareForThinLTO flag in the PassManagerBuilder for even further
reduced code size (0.7%) and improved compilation speed.
2022-03-12 12:55:38 +01:00
..
testdata all: add support for ThinLTO 2022-03-12 12:55:38 +01:00
allocs.go compiler: move allocations > 256 bytes to the heap 2022-02-11 19:46:37 +01:00
allocs_test.go transform: split interface and reflect lowering 2021-05-03 20:10:49 +02:00
errors.go refactor coroutine lowering and tasks 2020-03-17 12:16:10 +01:00
gc.go transform: improve GC stack slot pass to work around a bug 2021-08-04 20:06:59 +02:00
gc_test.go transform: move tests to transform_test package 2021-04-22 19:53:42 +02:00
globals.go compiler: add function and global section pragmas 2021-06-24 15:00:30 +02:00
globals_test.go transform: move tests to transform_test package 2021-04-22 19:53:42 +02:00
interface-lowering.go compiler: remove parentHandle from calling convention 2022-01-19 14:42:02 -05:00
interface-lowering_test.go compiler: add "target-cpu" and "target-features" attributes 2021-11-10 11:16:13 +01:00
interrupt.go compiler: remove parentHandle from calling convention 2022-01-19 14:42:02 -05:00
interrupt_test.go transform: refactor interrupt lowering 2021-11-06 09:40:15 +01:00
llvm.go runtime/fe310: add support for PLIC interrupts 2020-01-27 19:58:39 +01:00
maps.go all: move OptimizeMaps to transforms and add tests 2019-09-15 21:26:27 +02:00
maps_test.go all: add LLVM 12 support 2021-11-30 21:53:16 +01:00
optimizer.go all: add support for ThinLTO 2022-03-12 12:55:38 +01:00
panic.go compiler: move ReplacePanicsWithTrap pass to transforms 2019-11-16 18:41:28 +01:00
panic_test.go transform: move tests to transform_test package 2021-04-22 19:53:42 +02:00
reflect.go transform: split interface and reflect lowering 2021-05-03 20:10:49 +02:00
reflect_test.go transform: split interface and reflect lowering 2021-05-03 20:10:49 +02:00
rtcalls.go compiler: simplify interface lowering 2021-10-31 14:17:25 +01:00
rtcalls_test.go transform: move tests to transform_test package 2021-04-22 19:53:42 +02:00
stacksize.go all: add support for ThinLTO 2022-03-12 12:55:38 +01:00
stacksize_test.go transform: move tests to transform_test package 2021-04-22 19:53:42 +02:00
transform.go compiler: add "target-cpu" and "target-features" attributes 2021-11-10 11:16:13 +01:00
transform_test.go transform: remove switched func lowering 2022-01-19 14:42:02 -05:00
util.go compiler: move OptimizeStringToBytes to transform package 2019-09-22 08:25:50 +02:00
wasm-abi.go internal/task: remove coroutines 2022-01-19 14:42:02 -05:00
wasm-abi_test.go compiler: add "target-cpu" and "target-features" attributes 2021-11-10 11:16:13 +01:00