Andrew Kelley
af536ac343
introduce new test syntax
...
* remove setFnTest builtin
* add test "name" { ... } syntax
* remove --check-unused argument. functions are always lazy now.
2017-03-16 16:02:35 -04:00
Andrew Kelley
fc100d7b3b
lots of miscellaneous things all in one big commit
...
* add `@compileLog(...)` builtin function
- Helps debug code running at compile time
- See #240
* fix crash when there is an error on the start value of a slice
* add implicit cast from int and float types to int and float
literals if the value is known at compile time
* make array concatenation work with slices in addition to
arrays and c string literals
* fix compile error message for something not having field access
* fix crash when `@setDebugSafety()` was called from a
function being evaluated at compile-time
* fix compile-time evaluation of overflow math builtins.
* avoid debug safety panic handler in builtin.o and compiler_rt.o
since we use no debug safety in these modules anyway
* add compiler_rt functions for division on ARM
- Closes #254
* move default panic handler to std.debug so users can
call it manually
* std.io.printf supports a width in the format specifier
2017-02-09 03:09:25 -05:00
Andrew Kelley
6f316d8ebd
setGlobalSection and setGlobalAlign work for functions
2017-02-05 12:50:19 -05:00
Andrew Kelley
419e75eb23
remove volatileStore builtin; add volatile pointers
...
closes #238
2017-02-04 21:49:27 -05:00
Andrew Kelley
0919ea0afd
ability to set global variable alignment and ...
...
..section in the initialization expression
2017-02-04 10:22:07 -05:00
Andrew Kelley
5a86c04996
add volatileStore() builtin function
...
See #238
We can revisit how volatile will work later - for now
here's a builtin function to do it.
2017-02-03 15:14:18 -05:00
Andrew Kelley
8c9016b6d1
add setGlobalAlign and setGlobalSection builtin functions
...
closes #241
2017-02-03 13:56:56 -05:00
Andrew Kelley
4b3f18de3c
printf var args proof of concept
...
See #167
Need to troubleshoot when we send 2 slices to printf. It goes
into an infinite loop.
This commit introduces 4 builtin functions:
* `@isInteger`
* `@isFloat`
* `@canImplictCast`
* `@typeName`
2017-01-24 02:02:48 -05:00
Andrew Kelley
e5b1758010
remove staticEval builtin in favor of comptime expression
2017-01-22 23:21:00 -05:00
Andrew Kelley
d784705353
IR: implement macro for function aliasing function pointer
2017-01-12 03:15:06 -05:00
Andrew Kelley
fde276a3bf
IR: implement error for missing or extra switch prongs
2017-01-10 16:28:49 -05:00
Andrew Kelley
6caf32195a
pass unnecessary if statement test
2017-01-08 22:25:38 -05:00
Andrew Kelley
349cd79fe4
containers created during eval get names for parameters
2017-01-05 03:22:00 -05:00
Andrew Kelley
66a83d8738
IR: pass intToEnum test
2016-12-26 16:34:18 -05:00
Andrew Kelley
c8a7ab7eff
IR: pass cStringConcatenation test
2016-12-26 16:04:14 -05:00
Andrew Kelley
735cdbfdac
IR: pass intToPtrCast test
2016-12-26 15:45:50 -05:00
Andrew Kelley
4664f793dc
IR: pass enumToInt test
2016-12-26 02:36:04 -05:00
Andrew Kelley
f47dea2a2e
IR: support compile time global pointer reinterpret
...
this required moving the place we store types to ConstExprValue
2016-12-25 04:15:23 -05:00
Andrew Kelley
6f91fb4c37
IR: support const ref
2016-12-22 10:39:10 -05:00
Andrew Kelley
9b61682037
IR: implement runtime enum init and switch on enum with variable
2016-12-21 21:49:05 -05:00
Andrew Kelley
1f6dacbb2f
IR: enum init support
2016-12-20 01:50:32 -05:00
Andrew Kelley
2419f0c914
IR: support maybe defers
2016-12-19 17:25:09 -05:00
Andrew Kelley
09c34352f8
IR: if and switch guaranteed compile time if target expr is
2016-12-19 00:04:51 -05:00
Andrew Kelley
a71fbe49cb
IR: add FnProto instruction
2016-12-18 19:40:26 -05:00
Andrew Kelley
b59841a80f
IR: fix err variable in ErrOkOr instruction
2016-12-18 13:20:19 -05:00
Andrew Kelley
d245fabb80
IR: consolidate Ref and PrefixOpAddressOf instructions
2016-12-17 22:00:55 -05:00
Andrew Kelley
12fcbecbf8
IR: add more instructions
...
* MaybeWrap
* TestErr
* UnwrapErrCode
* UnwrapErrPayload
* ErrUnionTypeChild
* ErrWrapCode
* ErrWrapPayload
2016-12-17 16:16:17 -05:00
Andrew Kelley
647d13168a
IR: implement maybe return expression
2016-12-13 19:36:56 -05:00
Andrew Kelley
3f3630d7e3
IR: implement the rest of the builtin functions
...
* returnAddress
* frameAddress
* addWithOverflow
* subWithOverflow
* mulWithOverflow
* shlWithOverflow
* alignOf
2016-12-13 04:30:41 -05:00
Andrew Kelley
a6d2bdf605
IR: implement breakpoint builtin
2016-12-13 01:48:40 -05:00
Andrew Kelley
76a849b1f2
IR: implement memberCount builtin
2016-12-12 01:59:55 -05:00
Andrew Kelley
ef63bc9cca
IR: implement memcpy, memset, and slice expression
2016-12-12 00:31:35 -05:00
Andrew Kelley
fb21570630
IR: implement alloca builtin
2016-12-11 19:43:06 -05:00
Andrew Kelley
9b17c0ff7f
IR: implement intType builtin
...
and int type field access
and fix compile time bool not
2016-12-11 16:30:01 -05:00
Andrew Kelley
3429639e84
IR: implement truncate builtin
2016-12-11 15:31:07 -05:00
Andrew Kelley
433c17aeb1
IR: implement divExact builtin
2016-12-11 14:27:37 -05:00
Andrew Kelley
8fcb1a141b
IR: implement fence and cmpxchg builtins
2016-12-11 04:06:07 -05:00
Andrew Kelley
10cea15cc3
IR: implement embedFile builtin
2016-12-11 00:43:23 -05:00
Andrew Kelley
2dd85d52cc
IR: fix implementation of parseh
...
libc hello world works now
2016-12-11 00:13:43 -05:00
Andrew Kelley
d4a93dbac5
IR: omit debug safety checks in for loop codegen
2016-12-08 02:09:26 -05:00
Andrew Kelley
7d0fb281fe
IR: a bunch of fixes and some additions
...
* add errorName builtin function
* add assertion for generated memcopy being on correct types
* respect handle_is_ptr for constant values
* fix return codegen to respect sret semantics
* remove ArrayLen IR instruction; we already have StructFieldPtr
with "len" field
* fix gen_const_val for pointers inside aggregates
2016-12-08 01:52:57 -05:00
Andrew Kelley
a148096e6a
IR: add compileError builtin fn
2016-12-07 11:29:44 -05:00
Andrew Kelley
0ad580f001
IR: add minValue, maxValue, and negation
2016-12-07 01:23:38 -05:00
Andrew Kelley
0c531d447d
remove the boolean argument from setFnTest
2016-12-05 21:39:15 -05:00
Andrew Kelley
24048b2af6
IR: implement break and continue
2016-12-05 18:43:16 -05:00
Andrew Kelley
9f23475b17
add missing copyright notices
2016-12-04 21:06:13 -05:00
Andrew Kelley
2f259b8176
IR: re-organize where state goes to prepare for generics
...
* Rip out legacy code for generics
* put scope in instruction instead of AST nodes
* separate top level decl stuff from AST nodes
- remove the assumption that there is a 1:1 correspondence
between an output instruction and an AST node
- This way we won't have to clone AST nodes for generics.
2016-12-04 03:40:40 -05:00
Andrew Kelley
eb5693d91f
IR: function call porting progress
...
also implemented container init
generics is still todo
2016-11-28 02:40:01 -05:00
Andrew Kelley
d9329ed389
IR: add ref instruction
2016-11-27 01:22:30 -05:00
Andrew Kelley
84f7805029
IR: support import builtin function
2016-11-26 20:52:22 -05:00