tinygo/transform/testdata
Ayke van Laethem edcece33ca transform: refactor interrupt lowering
Instead of doing everything in the interrupt lowering pass, generate
some more code in gen-device to declare interrupt handler functions and
do some work in the compiler so that interrupt lowering becomes a lot
simpler.

This has several benefits:

  - Overall code is smaller, in particular the interrupt lowering pass.
  - The code should be a bit less "magical" and instead a bit easier to
    read. In particular, instead of having a magic
    runtime.callInterruptHandler (that is fully written by the interrupt
    lowering pass), the runtime calls a generated function like
    device/sifive.InterruptHandler where this switch already exists in
    code.
  - Debug information is improved. This can be helpful during actual
    debugging but is also useful for other uses of DWARF debug
    information.

For an example on debug information improvement, this is what a
backtrace might look like before this commit:

    Breakpoint 1, 0x00000b46 in UART0_IRQHandler ()
    (gdb) bt
    #0  0x00000b46 in UART0_IRQHandler ()
    #1  <signal handler called>
    [..etc]

Notice that the debugger doesn't see the source code location where it
has stopped.

After this commit, breaking at the same line might look like this:

    Breakpoint 1, (*machine.UART).handleInterrupt (arg1=..., uart=<optimized out>) at /home/ayke/src/github.com/tinygo-org/tinygo/src/machine/machine_nrf.go:200
    200			uart.Receive(byte(nrf.UART0.RXD.Get()))
    (gdb) bt
    #0  (*machine.UART).handleInterrupt (arg1=..., uart=<optimized out>) at /home/ayke/src/github.com/tinygo-org/tinygo/src/machine/machine_nrf.go:200
    #1  UART0_IRQHandler () at /home/ayke/src/github.com/tinygo-org/tinygo/src/device/nrf/nrf51.go:176
    #2  <signal handler called>
    [..etc]

By now, the debugger sees an actual source location for UART0_IRQHandler
(in the generated file) and an inlined function.
2021-11-06 09:40:15 +01:00
..
allocs.ll compiler, runtime: add layout parameter to runtime.alloc 2021-11-02 22:16:15 +01:00
allocs.out.ll compiler, runtime: add layout parameter to runtime.alloc 2021-11-02 22:16:15 +01:00
allocs2.go compiler: do not emit nil checks for loading closure variables 2021-05-26 20:21:08 +02:00
coroutines.ll compiler, runtime: add layout parameter to runtime.alloc 2021-11-02 22:16:15 +01:00
coroutines.out.ll compiler, runtime: add layout parameter to runtime.alloc 2021-11-02 22:16:15 +01:00
func-lowering.ll compiler: decouple func lowering from interface type codes 2021-04-12 12:07:42 +02:00
func-lowering.out.ll compiler: decouple func lowering from interface type codes 2021-04-12 12:07:42 +02:00
gc-globals.ll transform: do not track const globals 2020-02-24 21:04:50 +01:00
gc-globals.out.ll all: drop support for LLVM 10 2021-10-31 10:44:17 +01:00
gc-stackslots.ll compiler, runtime: add layout parameter to runtime.alloc 2021-11-02 22:16:15 +01:00
gc-stackslots.out.ll compiler, runtime: add layout parameter to runtime.alloc 2021-11-02 22:16:15 +01:00
globals-function-sections.ll compiler: move ApplyFunctionSections to transform package 2020-03-19 19:56:08 +01:00
globals-function-sections.out.ll compiler: move ApplyFunctionSections to transform package 2020-03-19 19:56:08 +01:00
interface.ll compiler: simplify interface lowering 2021-10-31 14:17:25 +01:00
interface.out.ll compiler: simplify interface lowering 2021-10-31 14:17:25 +01:00
interrupt.ll transform: refactor interrupt lowering 2021-11-06 09:40:15 +01:00
interrupt.out.ll transform: refactor interrupt lowering 2021-11-06 09:40:15 +01:00
maps.ll all: move OptimizeMaps to transforms and add tests 2019-09-15 21:26:27 +02:00
maps.out.ll all: drop support for LLVM 10 2021-10-31 10:44:17 +01:00
panic.ll compiler: move ReplacePanicsWithTrap pass to transforms 2019-11-16 18:41:28 +01:00
panic.out.ll compiler: move ReplacePanicsWithTrap pass to transforms 2019-11-16 18:41:28 +01:00
reflect-implements.ll compiler: simplify interface lowering 2021-10-31 14:17:25 +01:00
reflect-implements.out.ll compiler: simplify interface lowering 2021-10-31 14:17:25 +01:00
reflect.go transform: split interface and reflect lowering 2021-05-03 20:10:49 +02:00
stacksize.ll arm: automatically determine stack sizes 2020-08-27 19:23:22 +02:00
stacksize.out.ll all: drop support for LLVM 10 2021-10-31 10:44:17 +01:00
stringequal.ll transform: optimize string comparisons against "" 2021-03-18 17:22:00 +01:00
stringequal.out.ll transform: optimize string comparisons against "" 2021-03-18 17:22:00 +01:00
stringtobytes.ll compiler: move OptimizeStringToBytes to transform package 2019-09-22 08:25:50 +02:00
stringtobytes.out.ll compiler: move OptimizeStringToBytes to transform package 2019-09-22 08:25:50 +02:00
wasm-abi.ll compiler: move wasm ABI workaround to transform package 2020-01-28 19:29:09 +01:00
wasm-abi.out.ll all: drop support for LLVM 10 2021-10-31 10:44:17 +01:00