mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 13:33:39 +00:00
all: add compiler support for interrupts
This commit lets the compiler know about interrupts and allows optimizations to be performed based on that: interrupts are eliminated when they appear to be unused in a program. This is done with a new pseudo-call (runtime/interrupt.New) that is treated specially by the compiler.
This commit is contained in:
committed by
Ron Evans
parent
3729fcfa9e
commit
a5ed993f8d
@@ -0,0 +1,24 @@
|
||||
package transform
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"tinygo.org/x/go-llvm"
|
||||
)
|
||||
|
||||
func TestInterruptLowering(t *testing.T) {
|
||||
t.Parallel()
|
||||
for _, subtest := range []string{"avr", "cortexm"} {
|
||||
t.Run(subtest, func(t *testing.T) {
|
||||
testTransform(t, "testdata/interrupt-"+subtest, func(mod llvm.Module) {
|
||||
errs := LowerInterrupts(mod)
|
||||
if len(errs) != 0 {
|
||||
t.Fail()
|
||||
for _, err := range errs {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user