Commit Graph

1499 Commits

Author SHA1 Message Date
Ayke van Laethem c3cb22030f Implement == and != for strings 2018-08-22 00:56:11 +02:00
Ayke van Laethem 2777f8464e Implement printing of booleans 2018-08-22 00:54:39 +02:00
Ayke van Laethem a30ffa5c1e Revert "Move coroutine passes from Makefile to compiler itself"
This reverts commit d9ca5f97fb.

There is a problem with coroutines that I haven't solved yet. Reverting
makes it work, for now.

Also, use a better coroutines flag for the LLVM opt tool.
2018-08-20 20:24:54 +02:00
Ayke van Laethem df4ee6e733 passes: Fix bug in SimpleDCE
Main was included twice, leading to problems with coroutines.
2018-08-20 20:08:11 +02:00
Ayke van Laethem 6739ad07b2 Update nrfx submodule 2018-08-20 05:21:48 +02:00
Ayke van Laethem d9ca5f97fb Move coroutine passes from Makefile to compiler itself
This is much more convenient.
2018-08-20 04:31:01 +02:00
Ayke van Laethem 03c8a8bd3a README: Add build guide 2018-08-20 04:19:54 +02:00
Ayke van Laethem 7460e10894 Add dead code elimination (DCE) pass
This should make it much easier (in the future) to use the standard
library when unused functions contain unimplemented features. But more
importantly, it makes later passes better and makes compiling faster by
not having to scan dead code.
2018-08-19 20:47:58 +02:00
Ayke van Laethem fae4c7f555 Better error messages 2018-08-19 20:43:39 +02:00
Ayke van Laethem bce33bbf41 Rename {Function,Global}.Name -> LinkName 2018-08-19 20:42:24 +02:00
Ayke van Laethem 3146cc86d4 Move Compiler.program to Program.program 2018-08-19 20:41:05 +02:00
Ayke van Laethem e18fd6da16 Rename analysis.go -> passes.go 2018-08-19 17:07:48 +02:00
Ayke van Laethem 29d601883b Implement dummy GOMAXPROCS
This compiler targets single-core machines, GOMAXPROCS is thus fixed to
1.
2018-08-18 20:06:59 +02:00
Ayke van Laethem 8b6cb204cd Basic support for slices 2018-08-18 20:06:35 +02:00
Ayke van Laethem 86a3aea868 Add a LICENSE file 2018-08-18 19:04:14 +02:00
Ayke van Laethem 9aaac8e17b README: Describe supported targets 2018-08-18 15:59:12 +02:00
Ayke van Laethem bfe9b52661 README: Mark a few features as supported 2018-08-18 15:58:22 +02:00
Ayke van Laethem ad9a62f260 Make sure we handle all package members 2018-08-18 01:13:35 +02:00
Ayke van Laethem a475233f36 Support recursive types 2018-08-18 01:12:52 +02:00
Ayke van Laethem cad3e03f94 Allow imports from GOROOT 2018-08-18 01:11:50 +02:00
Ayke van Laethem 4af2bcb6a9 Split up tgo.go 2018-08-18 01:11:25 +02:00
Ayke van Laethem 0b98ec83ba Remove unnecessary check for nil in parseExpr 2018-08-18 00:19:56 +02:00
Ayke van Laethem 70871c98f8 Improve print functions 2018-08-17 23:23:38 +02:00
Ayke van Laethem 62c4c5e90b go fmt 2018-08-17 23:23:20 +02:00
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.
2018-08-17 23:13:32 +02:00
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.
2018-06-17 15:50:19 +02:00
Ayke van Laethem 62325eab40 compiler: Improve IR/SSA printing 2018-06-09 22:34:46 +02:00
Ayke van Laethem 5acde63f88 compiler: Move isPointer out of Compiler object 2018-06-09 18:02:43 +02:00
Ayke van Laethem 56056934e3 README: expand a bit 2018-06-08 13:43:12 +02:00
Ayke van Laethem 6b3e394dce compiler: Fix ChangeInterface
Keep the concrete type as interface type. Don't use the previous
interface type as type number.
2018-06-08 13:41:13 +02:00
Ayke van Laethem 9ad59bf001 Add README 2018-06-07 18:40:49 +02:00
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.
2018-06-07 18:35:54 +02:00
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
2018-06-07 18:29:49 +02:00
Ayke van Laethem 808cb991af compiler: Fix interface analysis (oops!) 2018-06-07 18:24:47 +02:00
Ayke van Laethem 0d1b7239c1 Assorted allocator fixes 2018-06-07 18:24:31 +02:00
Ayke van Laethem b8260ba554 Makefile: use -Os instead of -O1
This was left over from debugging.
2018-06-07 18:22:28 +02:00
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