Commit Graph

255 Commits

Author SHA1 Message Date
Christoffer Lerno
64f20da080 Better handling of void/void*, unified local/global var analysis. Native base64 / hex data array (needs more checks) 2021-08-20 10:29:17 +02:00
Christoffer Lerno
f180a0d44a Change anyerror { i64, i64 } -> i64. Cleaned up platform data and max tls / vector align. Initial work on bitstruct (just parsing). Updated try / catch semantics. 2021-08-18 17:31:09 +02:00
Christoffer Lerno
bc4ed2b213 Use assert functions on various platforms. 2021-08-16 16:43:53 +02:00
Christoffer Lerno
da76777ee4 Fixes to aarch64 float struct return. Missing byval and align on calls. This *breaks* try-catch. 2021-08-11 19:17:45 +02:00
Christoffer Lerno
c12cba67a8 Fix of try(...) { ... } and failable state on function call. 2021-08-03 19:57:44 +02:00
Christoffer Lerno
490dd65664 Add attributes to call site. @inline, @noinline to calls #250 2021-08-03 12:02:36 +02:00
Christoffer Lerno
78425ff5f2 Initial work on foreach overloading. Fixes a bug in indirect return values. Unifies call analysis. 2021-08-02 22:55:11 +02:00
Christoffer Lerno
ec612eea67 Added some explicit casts. Added sret at call site. 2021-07-29 16:42:20 +02:00
Christoffer Lerno
efe4f8c745 Coerce lowering for the C ABI updated. Updated aarch64 fixes. 2021-07-29 03:16:07 +02:00
Christoffer Lerno
ce6e59483f Unified function and macro call analysis. 2021-07-28 17:20:19 +02:00
Christoffer Lerno
46e39f883c Assigning to $Type now works. 2021-07-20 23:36:53 +02:00
Christoffer Lerno
28a0dec343 Fixes: Extname works on global variables. Bug with boolean in ternary in some cases. Global declarations would not parse attributes. 2021-07-19 17:10:13 +02:00
Christoffer Lerno
89d831fc18 Remove debug printout unless explicitly required. Add compile-only option. 2021-07-19 14:10:31 +02:00
Christoffer Lerno
f64c35214e Change error -> anyerr / errtype 2021-07-18 14:11:39 +02:00
Christoffer Lerno
67d09cf7c6 Pick double / long double depending on availability. 2021-07-16 20:20:19 +02:00
Christoffer Lerno
39ec9d9436 Pass NAN/INF as string to LLVM. 2021-07-16 16:41:47 +02:00
Christoffer Lerno
caecbebd0f Update float conversion into LLVM. 2021-07-16 15:21:56 +02:00
Christoffer Lerno
45a3c8ae50 Fix alignment on all indirect. Fixed incorrect preferred alignment. Added mingw regression tests. 2021-07-16 13:05:56 +02:00
Christoffer Lerno
22fb7b4bcc Fix bug in (x && y && z) codegen. 2021-07-16 11:18:33 +02:00
Christoffer Lerno
a5ce7c47ba Adding "require" precondition. Corrects inferred arrays and fixes so that it uses [*] everywhere. Distict type will now allow methods to be added to it. Added $alignof and $sizeof. 2021-07-09 23:57:35 +02:00
Christoffer Lerno
4ed2596164 Removes "yield" 2021-06-28 00:19:46 +02:00
Christoffer Lerno
038ed7f9d5 Macro methods added. 2021-06-26 17:42:45 +02:00
Christoffer Lerno
5a6cdd25ef Introduced ${...} syntax for constants. Fixed issue where constants were not correctly handled for macros. /* */ comments are nesting. Added LINE, FUNC, FILE defines. Corrected shallow resolution of subarrays. Added int defines. Removed Vararray. 2021-06-24 00:59:25 +02:00
Christoffer Lerno
9fd6c06861 Remove debug printout. 2021-05-31 23:20:01 +02:00
Christoffer Lerno
cf58da4a3c Remove the complex type. 2021-05-30 21:44:44 +02:00
Christoffer Lerno
892c7e8874 Changed generic modules to internal templates. 2021-05-27 08:30:02 +02:00
Christoffer Lerno
dbb067a005 Cleanup. 2021-05-23 21:32:32 +02:00
Christoffer Lerno
fb6d80b0f6 Removed implicitly created modules. Fix classification of arrays in x64. Fix cast with direct-pair. With test cases. 2021-05-19 17:27:59 +02:00
Christoffer Lerno
3c4233f4d4 Fixes to failable return from expression and macro blocks. Allow division by float zero. Correct type promotion from compile time float. 2021-05-17 21:17:46 +02:00
Christoffer Lerno
460c0d04d7 Generic modules. 2021-05-12 17:25:59 +02:00
Christoffer Lerno
15a65d0c97 Allow use of pthreads to parallelize codegen. 2021-05-09 19:26:05 +02:00
Christoffer Lerno
3bd638bf77 Fixes to debug info in function pointer declarations. Incorrect x64 ABI code for structs by val. Change "Compiler" to "GlobalContext" storage of all types inside. Call debug symbol correct. 2021-05-02 16:42:28 +02:00
Christoffer Lerno
c6f671a6ca A bit more global... 2021-04-29 22:44:00 +02:00
Christoffer Lerno
0e076234ca Set stdlib library for testing and profit. Fix bugs when using void* to step. Make constants private linkage. Compare pointers using unsigned comparison without conversion. Use manual ptrdiff code. Fix issue returning "void!". Unify pointers when doing Foo* - void*. Allow comparing for example void* < Foo* 2021-04-29 03:12:25 +02:00
Christoffer Lerno
01f7343945 Parsing of interface. Fix to unpacking arraypointers. Fix accidental unsplat. 2021-04-29 03:12:25 +02:00
Christoffer Lerno
21d4ecf9b4 Splat/unsplat/typed varargs 2021-04-28 14:33:26 +02:00
Christoffer Lerno
954a90dae3 Fix of arch target. Experimental linker support. 2021-04-09 18:47:41 +02:00
Christoffer Lerno
4536d3a270 Fix of missing O3 setting. Added safe/unsafe mode. Updated trapping on negation. Added trap on negative shift & shift exceeding bit width. Added trap on div by zero, rem by zero. Prevent UB on negative shift/shift exceeding bit width. Use ordered FP comparison. 2021-04-07 11:14:55 +02:00
Christoffer Lerno
4210f1ccb2 Some work on vararray. Fix span on post unary. Updated error recovery. Updated return analysis to handle void functions. "while" now disallows error prone next line statement. Working on auto linking. Failable load optimized. Optimization and corrections for call returns + documentation. 2021-04-05 23:34:40 +02:00
Christoffer Lerno
07595df412 Change cast and int rules: constant folding always starts. Promotion using left side on all operands to bit width. Implicit narrowing to max size on right hand side. 2021-03-17 18:25:00 +01:00
Christoffer Lerno
1d50beb330 Work on constant string and inferred array sizes. 2021-02-03 23:01:37 +01:00
Christoffer Lerno
4f064e7da2 Initial checkin of docs parsing. char is now unsigned, and signed char is "ichar". 2021-01-29 18:46:17 +01:00
Christoffer Lerno
45c4f205bb More correct alignment. Foreach added. Removed dynamic designated array initialization. Use 16 byte alignment on arrays >= 16 for x64 2021-01-27 00:14:16 +01:00
Christoffer Lerno
7fc12192f4 Added "distinct" types. 2021-01-24 21:10:57 +01:00
Christoffer Lerno
3a24fbfa6d Moved examples around. Updated (and corrected) const initialization. Removed "in" keyword. Added "member" attribute domain. Many fixes in struct padding and alignment and tests. Fixed extern global. 2021-01-24 00:55:09 +01:00
Christoffer Lerno
564c93700e Fixed bug that would intermittently arise from multiple contexts having the same pointer (should preferably be fixed in a different way later). Free all the arenas before codegen. Change "next" to "nextcase". Allow missing function parameters. Add "inline" structs. 2021-01-03 00:15:51 +01:00
Christoffer Lerno
781638d207 Bugfix to split arrays. Correctly generate const initializers on non globals for structs. 2020-12-27 22:13:45 +01:00
Christoffer Lerno
4da36dfed9 Optimized and improved aggregate initialization. Compound literal updated to Foo({ 1, 2 })-style. ".name = x" style initialization for named arguments and designated initializers. Added runtime messages on panics. subarrays convert implictly to pointers. len/len() functions. Fix taking slice of pointer. Vararg fixes
Consistent length typedef.

First stab at initializers.

Change compound literal to Foo({ 1, 2 }) style.

Fixed up some tests.

Optimize the zero struct codegen.

Optimize union empty initializer.

Fix issues with unions. Added alignment to globals. Added some union tests.

Use puts to emit error messages during runtime. Fixup of int[] -> int* style conversions.

Fix implicit conversion of int[3]* -> int*

Fix int[] size. Use () to invoke the length of a subarray. Fix taking a slice of a pointer. Limit the number of members in a struct.

Fixes to vararg using debug and cleanups to slices.
2020-12-22 21:55:52 +01:00
Christoffer Lerno
6a5a0f2b94 Moved ABI lowering from codegen to semantic analysis. Fixes for failables in the ABI and the codegen. 2020-12-04 19:19:57 +01:00
Christoffer Lerno
0b00fe6988 Added round/ceil/trunc/sqrt intrinsics. 2020-12-03 15:53:42 +01:00