Ayke van Laethem
62c4c5e90b
go fmt
6 years ago
Ayke van Laethem
574c7ec047
Refactor: Use our own types as much as possible from the analysis
Previously, mostly the types from the ssa package were used directly
with the types from analysis.go as an overlay. This commit uses these
types everywhere and renames a few things here and there to make things
clearer.
6 years ago
Ayke van Laethem
a97ca91c1f
compiler: Implement interface calls
This is a big combined change. Other changes in this commit:
* Analyze makeinterface and make sure type switches don't include
unnecessary cases.
* Do not include CGo wrapper functions in the analyzer callgraph.
This also avoids some unnecessary type IDs.
* Give all Go named structs a name in LLVM.
* Use such a named struct for compiler-generated task data.
* Use the type and function names defined by the ssa and types
package instead of generating our own.
* Some improvements to function pointers.
* A few other minor improvements.
The one thing lacking here is interface-to-interface assertions.
7 years ago
Ayke van Laethem
62325eab40
compiler: Improve IR/SSA printing
7 years ago
Ayke van Laethem
5acde63f88
compiler: Move isPointer out of Compiler object
7 years ago
Ayke van Laethem
56056934e3
README: expand a bit
7 years ago
Ayke van Laethem
6b3e394dce
compiler: Fix ChangeInterface
Keep the concrete type as interface type. Don't use the previous
interface type as type number.
7 years ago
Ayke van Laethem
9ad59bf001
Add README
7 years ago
Ayke van Laethem
90fb0ee4eb
Add AVR support
This requires support in LLVM, as AVR support is still experimental. For
example, in bindings/go/build.sh, add
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR to cmake_flags.
7 years ago
Ayke van Laethem
802302a1aa
Add support for inline assembly
This depends on support in LLVM, which hasn't been merged yet.
See: https://reviews.llvm.org/D46437
7 years ago
Ayke van Laethem
808cb991af
compiler: Fix interface analysis (oops!)
7 years ago
Ayke van Laethem
0d1b7239c1
Assorted allocator fixes
7 years ago
Ayke van Laethem
b8260ba554
Makefile: use -Os instead of -O1
This was left over from debugging.
7 years ago
Ayke van Laethem
2e5b313d54
compiler: Give the interface type a name
7 years ago
Ayke van Laethem
bb60912fa1
tgo: Print IR on panic (sometimes)
7 years ago
Ayke van Laethem
cafdcecb60
tgo: Use a named string type for strings
7 years ago
Ayke van Laethem
b0af01056d
tgo: Remove \0 from end of string
7 years ago
Ayke van Laethem
c2005a5f79
tgo: Add rudimentary interface support.
No support yet for checking whether an interface implements a type.
7 years ago
Ayke van Laethem
0168bf7797
Add goroutines and function pointers
7 years ago
Ayke van Laethem
8df220a53b
Move to my own fork of LLVM
7 years ago
Ayke van Laethem
1eccae287b
tgo: Fix runtime.TargetBits
7 years ago
Ayke van Laethem
d1dbca53ff
tgo: Eliminate most debug prints
7 years ago
Ayke van Laethem
315e39b164
tgo: Remove getGlobalName from Compiler object
7 years ago
Ayke van Laethem
b4e60deacd
runtime/nrf: Fix allocator by adding align() function
7 years ago
Ayke van Laethem
2390b24c5a
tgo: Add extra chip types for nRF
7 years ago
Ayke van Laethem
5fa39adb81
tgo: Allow anonymous function declarations
Not sure why they're needed right now, though...
7 years ago
Ayke van Laethem
588910792d
Translate bootstrapping main from C to LLVM IR
This avoids needing a C compiler for every platform.
7 years ago
Ayke van Laethem
a9bbed2f6c
tgo: Implement special case for LLVM intrinsics
7 years ago
Ayke van Laethem
89f77fa861
machine/dummy: Add LED1, LED2, etc to dummy machine
7 years ago
Ayke van Laethem
320c583221
Implement printing of int8/uint8/pointers
7 years ago
Ayke van Laethem
e171f32493
Implement minimal bump pointer allocator
Useful for MCUs, until a real garbage collector has been implemented.
7 years ago
Ayke van Laethem
b45ea2deb9
arm: Fix linker script stack section
7 years ago
Ayke van Laethem
2fca772431
Makefile: Autodetect LLVM bin dir
7 years ago
Ayke van Laethem
a39951c3d7
runtime: Convert device initialization to Go
7 years ago
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.
7 years ago
Ayke van Laethem
16489c0df6
compiler: Workaround for runtime.boundsCheck in runtime dependencies
7 years ago
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.
7 years ago
Ayke van Laethem
8c426b406d
Automatically convert .svd files to Go source files
7 years ago
Ayke van Laethem
3b4621c215
compiler: Implement XOR (^x)
7 years ago
Ayke van Laethem
877d0817ea
compiler: Comments
7 years ago
Ayke van Laethem
84b45a33f1
compiler: Implement initializers for arrays in global structs
7 years ago
Ayke van Laethem
db8b6c6900
compiler: Fix package dependency order calculation
The algorithm is now simpler and seems to work better.
7 years ago
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