Commit Graph

363 Commits

Author SHA1 Message Date
Ayke van Laethem 13cb7d6503 avr: add interrupt support
Interrupts are supported using a special //go:interrupt pragma.
For example:

//go:interrupt INT0_vect
func handleINT0() {
    // do something here
}
2018-09-25 13:47:20 +02:00
Ayke van Laethem ed227b8fd3 all: fix errors reported by go vet 2018-09-24 17:22:59 +02:00
Ayke van Laethem c9ae72a105 all: allow -O0 optimization level 2018-09-24 16:17:42 +02:00
Ayke van Laethem 6191d4e1ac compiler: rename .Parse() to .Compiler()
The fact it was called Parse() is more of a historical accident, as the
compiler started out using the Go AST directly instead of Go SSA.
2018-09-24 15:55:38 +02:00
Ayke van Laethem 1b229a8f8b compiler: support compiling individual .go files
For example:

    tinygo run ./src/examples/test/test.go
2018-09-24 15:46:30 +02:00
Ayke van Laethem a561e9a9ac ir: move adding packages from the compiler 2018-09-24 15:46:30 +02:00
Ayke van Laethem 9df04a2170 compiler: fix panic on import errors
I think this is a problem in the loader package - it doesn't seem to
return errors for missing packages.
2018-09-24 15:46:30 +02:00
Ayke van Laethem 8a468786df compiler: use config struct for options 2018-09-24 15:46:05 +02:00
Ayke van Laethem fd6dda5e4f main: run the compiler from any path 2018-09-24 12:25:33 +02:00
Ayke van Laethem 2938437efc compiler: make string data unnamed addresses
This ensures LLVM can merge identical strings, and thus reduces code
size in some cases.
2018-09-23 03:03:40 +02:00
Ayke van Laethem 7cea40bcb5 compiler: small cleanup in call handling code 2018-09-23 03:01:10 +02:00
Ayke van Laethem fdfa810060 compiler: expand small structs
Use fields of small structs (3 or less fields when flattened
recursively) directly as parameter values.

Advantages:
  * Code size is slightly reduced, both on unix and nrf.
  * AVR can finally deal with struct parameters - at least the small
    ones. examples/test now compiles. A real fix for struct parameters
    should go into upstream LLVM, but this is a nice win.

fixes #20
2018-09-23 02:39:05 +02:00
Ayke van Laethem b2cbfa78ca compiler: refactor compiler into separate package 2018-09-22 20:32:28 +02:00