tinygo/compiler/testdata
Ayke van Laethem 0b7957d612 compiler: optimize string literals and globals
This commit optimizes string literals and globals by setting the
appropriate alignment and using a nil pointer in zero-length strings.

  - Setting the alignment for string values has a surprisingly large
    effect, up to around 2% in binary size. I suspect that LLVM will
    pick some default alignment for larger byte arrays if no alignment
    has been specified and forcing an alignment of 1 will pack all
    strings closer together.
  - Using nil for zero-length strings also has a positive effect, but
    I'm not sure why. Perhaps it makes some optimizations more trivial.
  - Always setting the alignment on globals improves code size slightly,
    probably for the same reasons setting the alignment of string
    literals improves code size. The effect is much smaller, however.

This commit might have an effect on performance, but if it does this
should be tested separately and such a large win in binary size should
definitely not be ignored for small embedded systems.
2021-04-08 11:40:59 +02:00
..
basic.go compiler: refactor and add tests 2021-01-15 14:43:43 +01:00
basic.ll builder, compiler: compile and cache packages in parallel 2021-03-21 11:51:35 +01:00
float.go compiler: test float to int conversions and fix upper-bound calculation 2021-01-19 14:02:32 +01:00
float.ll builder, compiler: compile and cache packages in parallel 2021-03-21 11:51:35 +01:00
interface.go compiler: add interface IR test 2021-03-28 14:00:37 +02:00
interface.ll transform: don't rely on struct name of runtime.typecodeID 2021-04-08 11:40:59 +02:00
pointer.go compiler: refactor and add tests 2021-01-15 14:43:43 +01:00
pointer.ll builder, compiler: compile and cache packages in parallel 2021-03-21 11:51:35 +01:00
slice.go compiler: add some more slice tests 2021-03-22 11:35:06 +01:00
slice.ll compiler: do not emit nil checks for *ssa.Alloc instructions 2021-03-22 11:35:06 +01:00
string.go compiler: optimize string literals and globals 2021-04-08 11:40:59 +02:00
string.ll compiler: optimize string literals and globals 2021-04-08 11:40:59 +02:00