Commit Graph

3213 Commits

Author SHA1 Message Date
Ayke van Laethem 2e5b313d54 compiler: Give the interface type a name 2018-06-07 17:54:41 +02:00
Ayke van Laethem bb60912fa1 tgo: Print IR on panic (sometimes) 2018-06-07 17:45:49 +02:00
Ayke van Laethem cafdcecb60 tgo: Use a named string type for strings 2018-06-07 17:44:53 +02:00
Ayke van Laethem b0af01056d tgo: Remove \0 from end of string 2018-06-07 16:48:48 +02:00
Ayke van Laethem c2005a5f79 tgo: Add rudimentary interface support.
No support yet for checking whether an interface implements a type.
2018-06-07 15:48:32 +02:00
Ayke van Laethem 0168bf7797 Add goroutines and function pointers 2018-06-07 14:48:24 +02:00
Ayke van Laethem 8df220a53b Move to my own fork of LLVM 2018-06-07 13:20:09 +02:00
Ayke van Laethem 1eccae287b tgo: Fix runtime.TargetBits 2018-06-04 01:09:33 +02:00
Ayke van Laethem d1dbca53ff tgo: Eliminate most debug prints 2018-06-03 23:50:14 +02:00
Ayke van Laethem 315e39b164 tgo: Remove getGlobalName from Compiler object 2018-06-03 23:37:15 +02:00
Ayke van Laethem b4e60deacd runtime/nrf: Fix allocator by adding align() function 2018-06-03 17:56:56 +02:00
Ayke van Laethem 2390b24c5a tgo: Add extra chip types for nRF 2018-06-03 17:54:18 +02:00
Ayke van Laethem 5fa39adb81 tgo: Allow anonymous function declarations
Not sure why they're needed right now, though...
2018-06-03 17:45:33 +02:00
Ayke van Laethem 588910792d Translate bootstrapping main from C to LLVM IR
This avoids needing a C compiler for every platform.
2018-06-03 17:38:16 +02:00
Ayke van Laethem a9bbed2f6c tgo: Implement special case for LLVM intrinsics 2018-06-03 17:13:00 +02:00
Ayke van Laethem 89f77fa861 machine/dummy: Add LED1, LED2, etc to dummy machine 2018-06-03 16:42:09 +02:00
Ayke van Laethem 320c583221 Implement printing of int8/uint8/pointers 2018-06-03 16:39:24 +02:00
Ayke van Laethem e171f32493 Implement minimal bump pointer allocator
Useful for MCUs, until a real garbage collector has been implemented.
2018-06-03 16:30:48 +02:00
Ayke van Laethem b45ea2deb9 arm: Fix linker script stack section 2018-05-28 10:55:14 +02:00
Ayke van Laethem 2fca772431 Makefile: Autodetect LLVM bin dir 2018-05-28 09:01:35 +02:00
Ayke van Laethem a39951c3d7 runtime: Convert device initialization to Go 2018-05-05 20:10:39 +02:00
Ayke van Laethem c4f0dc90dd machine: Rewrite most of the GPIO functionality
Split across device types (nrf, dummy) and use registers directly
instead of the HAL.
2018-05-05 20:05:53 +02:00
Ayke van Laethem 16489c0df6 compiler: Workaround for runtime.boundsCheck in runtime dependencies 2018-05-05 19:18:53 +02:00
Ayke van Laethem 01602309fd compiler: Implement register loads and stores
The way it works is somewhat of a hack, though. But it works for now.
2018-05-05 19:17:23 +02:00
Ayke van Laethem 8c426b406d Automatically convert .svd files to Go source files 2018-05-05 19:02:43 +02:00
Ayke van Laethem 3b4621c215 compiler: Implement XOR (^x) 2018-05-05 18:33:32 +02:00
Ayke van Laethem 877d0817ea compiler: Comments 2018-05-05 18:32:58 +02:00
Ayke van Laethem 84b45a33f1 compiler: Implement initializers for arrays in global structs 2018-05-05 18:30:58 +02:00
Ayke van Laethem db8b6c6900 compiler: Fix package dependency order calculation
The algorithm is now simpler and seems to work better.
2018-05-05 18:29:23 +02:00
Ayke van Laethem 88f143f3e6 compiler: Implement initializers for global structs 2018-05-03 22:51:43 +02:00
Ayke van Laethem b0cb51bdd8 compiler: Do not pre-define runtime functions by the compiler 2018-05-03 21:15:29 +02:00
Ayke van Laethem b11a618d99 compiler: Set actual initializer for global variables
In the Go SSA, global variables are initialized in the init() function
instead of declaring them in the global itself. Work around this oddity
by simply setting the correct initializer when we find this global.

This should produce more efficient code, both in RAM and code size.
Apparently LLVM didn't optimize it away on it's own.
2018-04-29 00:59:28 +02:00
Ayke van Laethem c5a82bb916 compiler: Fix globals so they actually work 2018-04-29 00:49:33 +02:00
Ayke van Laethem 14cbc1555d compiler: Use zeroinitializer instead of memset 2018-04-29 00:49:07 +02:00
Ayke van Laethem 6ed1ca11c7 compiler: Use correct package path for global 2018-04-29 00:47:26 +02:00
Ayke van Laethem 2534111141 compiler: comments 2018-04-27 16:19:57 +02:00
Ayke van Laethem e895372918 compiler: Don't externally link runtime.init
There is no reason to make this exception.
2018-04-27 16:19:29 +02:00
Ayke van Laethem 3a4663150e runtime: Implement GPIO output
Now we can actually blink a LED!
2018-04-27 01:29:13 +02:00
Ayke van Laethem 5bbd41e9fb compiler: Implement -ffunction-sections work 2018-04-27 01:28:14 +02:00
Ayke van Laethem f7c2d0124d compiler: Support bitcasting non-integers 2018-04-27 00:59:27 +02:00
Ayke van Laethem bddb0c49b2 compiler: Add boolean constants 2018-04-27 00:59:01 +02:00
Ayke van Laethem 6ad451a582 compiler: Fix named global path 2018-04-27 00:58:28 +02:00
Ayke van Laethem 4522d2f49e Makefile: Remove SECONDARY: rule
For some reason it isn't necessary anymore.
2018-04-26 23:50:01 +02:00
Ayke van Laethem d4170faa0a runtime/nrf: Add Sleep() 2018-04-26 23:47:59 +02:00
Ayke van Laethem 4491a63fe8 Add print() for 64-bit integers 2018-04-26 23:46:34 +02:00
Ayke van Laethem d17c21681b compiler: Accept more variable types in print() 2018-04-26 23:41:20 +02:00
Ayke van Laethem d13566b302 compiler: Don't ignore errors in parsePackage 2018-04-26 23:40:19 +02:00
Ayke van Laethem f4ee774866 Set up a stack
I forgot to actually set up a stack for the program but strangely it
(mostly) worked - probably due to inlining.
2018-04-26 23:38:46 +02:00
Ayke van Laethem c940617849 compiler: Implement init() 2018-04-26 18:54:46 +02:00
Ayke van Laethem 9a988dd1d1 compiler: Refactor Compiler.Parse: extract parsePackage 2018-04-26 18:52:57 +02:00