Ayke van Laethem
88f143f3e6
compiler: Implement initializers for global structs
7 years ago
Ayke van Laethem
b0cb51bdd8
compiler: Do not pre-define runtime functions by the compiler
7 years ago
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.
7 years ago
Ayke van Laethem
c5a82bb916
compiler: Fix globals so they actually work
7 years ago
Ayke van Laethem
14cbc1555d
compiler: Use zeroinitializer instead of memset
7 years ago
Ayke van Laethem
6ed1ca11c7
compiler: Use correct package path for global
7 years ago
Ayke van Laethem
2534111141
compiler: comments
7 years ago
Ayke van Laethem
e895372918
compiler: Don't externally link runtime.init
There is no reason to make this exception.
7 years ago
Ayke van Laethem
5bbd41e9fb
compiler: Implement -ffunction-sections work
7 years ago
Ayke van Laethem
f7c2d0124d
compiler: Support bitcasting non-integers
7 years ago
Ayke van Laethem
bddb0c49b2
compiler: Add boolean constants
7 years ago
Ayke van Laethem
6ad451a582
compiler: Fix named global path
7 years ago
Ayke van Laethem
4491a63fe8
Add print() for 64-bit integers
7 years ago
Ayke van Laethem
d17c21681b
compiler: Accept more variable types in print()
7 years ago
Ayke van Laethem
d13566b302
compiler: Don't ignore errors in parsePackage
7 years ago
Ayke van Laethem
c940617849
compiler: Implement init()
7 years ago
Ayke van Laethem
9a988dd1d1
compiler: Refactor Compiler.Parse: extract parsePackage
7 years ago
Ayke van Laethem
2d19bb11ba
compiler: Merge the runtime into the Go code, for better code size
7 years ago
Ayke van Laethem
775445cceb
compiler: Reduce code size
Mark most Go functions as private (removing dead code) and configure to
optimize for size.
7 years ago
Ayke van Laethem
a446b4de97
Be able to actually run the blinky example on an nRF
runtime.Sleep() doesn't work yet so it prints a lot of data. Also, this
depends on a small patch to nrfx.
7 years ago
Ayke van Laethem
e80f06bc5e
Implement more type casting
7 years ago
Ayke van Laethem
69140c240b
Implement named binop types
7 years ago
Ayke van Laethem
b4ba90d7f5
Implement uintptr type
7 years ago
Ayke van Laethem
51b947956f
Use Clang as CGo compiler
7 years ago
Ayke van Laethem
93399c009e
Emit textual LLVM IR
7 years ago
Ayke van Laethem
cefce41df0
Correct function name for calls to other packages
7 years ago
Ayke van Laethem
9d3dfd8868
Make package process order deterministic: based on import order
7 years ago
Ayke van Laethem
03c6b7256e
Simplify parseConstInt
7 years ago
Ayke van Laethem
5067891236
Implement unsigned integers
7 years ago
Ayke van Laethem
cf9cea7a0d
Implement array bounds check
7 years ago
Ayke van Laethem
1f0651c84c
Implement string out of bounds checks
7 years ago
Ayke van Laethem
db66039dfe
Implement panic()
7 years ago
Ayke van Laethem
d812873e60
Add support for (zero-initialized) arrays
7 years ago
Ayke van Laethem
02332080e6
Use LLVM API for type size calculations
7 years ago
Ayke van Laethem
217c48f933
Implement interfaces on the string type
7 years ago
Ayke van Laethem
fc2eee4ee8
Better error checking on interface conversion
7 years ago
Ayke van Laethem
12eb9eec3c
Store LLVM reference instead of function name in Frame
7 years ago
Ayke van Laethem
45e7376f39
Implement print() and println() in Go
7 years ago
Ayke van Laethem
ff9e7a8b77
Implement CGo support
This mostly works around the default CGo support: this compiler doesn't
need special wrappers for C functions as it uses the C calling
convention by default.
7 years ago
Ayke van Laethem
deadcb8dae
Implement lookup on strings (extract byte values)
TODO: bounds checking
7 years ago
Ayke van Laethem
4d33d9d38b
Implement -expr
7 years ago
Ayke van Laethem
01d2cc566e
Fix type width for pointer types
7 years ago
Ayke van Laethem
e436ca7c8d
Implement named constants
7 years ago
Ayke van Laethem
f5f64782ce
Add casting between types
7 years ago
Ayke van Laethem
3e3c3d259f
Add rudimentary interface support
7 years ago
Ayke van Laethem
850fef9852
Add builtin len(string)
7 years ago
Ayke van Laethem
013b375904
Add type methods
7 years ago
Ayke van Laethem
9060e699e4
Add heap allocation (without escape analysis!)
7 years ago
Ayke van Laethem
d555ad93d7
Add support for structs
7 years ago
Ayke van Laethem
de0ff3b3af
Various changes
* Don't skip init function
* Add global variables and constants
* Add unary operations
* Use import path instead of package name (except for main)
* ...more
7 years ago