Commit graph

43 commits

Author SHA1 Message Date
Dale Weiler
65362d93aa .c -> .cpp 2015-01-14 21:48:47 -05:00
Dale Weiler
9d89a059aa More cleanup 2015-01-13 21:43:48 -05:00
Dale Weiler
b5ac2745d6 Remove license headers. The LICENSE file is sufficent 2015-01-13 21:38:40 -05:00
Dale Weiler
783b7b6594 Update license headers 2015-01-09 14:53:35 -05:00
Dale Weiler
6424ebaf98 Perliminary work on arithmetic exception handling in the constant evaluator. We can safely check for arithmetic underflow, overflow, divison by zero and inexactness now. Inexactness of expressions are propagated through the AST such that using an inexact value in a comparison will trigger a warning with -Winexact-compares. 2014-05-24 09:53:38 -04:00
Dale Weiler
a140b749ff Fix lshift/rshift for runtime and const-fold consistency. 2014-01-07 12:58:53 -05:00
Dale Weiler
a934e0fe4b Happy new year! 2014-01-01 06:24:16 -05:00
Dale Weiler
072bff44e6 Bitshifting operators <<, >>, and compound assignment versions now work in non-constant expressions 2013-12-03 17:40:15 -05:00
Dale Weiler
bf127088ca Make log use the slightly improved algorithm for small values. 2013-11-25 14:08:05 -05:00
Dale Weiler
9749ec350a Reorder intrinsics table 2013-11-25 13:44:00 -05:00
Dale Weiler
e5fc8fdded out isn't used 2013-11-25 13:42:17 -05:00
Dale Weiler
f19d32b29b Another one 2013-11-25 13:26:24 -05:00
Dale Weiler
dc48af195d Pregenerate 2.0 for const folder since it's used often 2013-11-25 13:25:29 -05:00
Dale Weiler
33c0c83d59 Implemented __builtin_ln, __builtin_log, __builtin_log10, __builtin_log2 and __builtin_logb. This algorithm is nuts. 2013-11-25 13:21:27 -05:00
Dale Weiler
02c6076bfd Fix 2013-11-25 11:29:36 -05:00
Dale Weiler
3209aaa996 Implement __builtin_nan, __builtin_inf and __builtin_epsilon to generate machine nan, inf and epsilon values (at runtime). 2013-11-25 11:26:16 -05:00
Dale Weiler
8a26ed7664 Fix CRC16 2013-11-25 02:11:45 -05:00
Dale Weiler
50d1bfe783 Fix 2013-11-23 21:17:35 -05:00
Dale Weiler
63c0917d24 More compiler intrinsics for math functions 2013-11-23 21:14:13 -05:00
Dale Weiler
23904bad52 Better exp algorithm from divVerent 2013-11-23 12:45:22 -05:00
Dale Weiler
52cda620b2 Fix comments 2013-11-23 11:15:28 -05:00
Dale Weiler
1c33bcfceb Fixed pow 2013-11-23 11:14:42 -05:00
Dale Weiler
db182819ae Guard against nullfunc 2013-11-23 10:58:03 -05:00
Dale Weiler
80adfebd23 Implement isinf intrinsic 2013-11-23 10:16:48 -05:00
Dale Weiler
e2bfaf8109 Implemented exp2 intrinsic 2013-11-23 07:37:26 -05:00
Dale Weiler
c68a5c29e1 Simplify 2013-11-23 07:27:09 -05:00
Dale Weiler
11f79bb1a6 Use '#' in nullfun identifier to prevent it from being used in code 2013-11-23 07:25:24 -05:00
Dale Weiler
54f331a64a Fix intrinsics for self-inclusion of other intrinsics. 2013-11-23 07:21:12 -05:00
Dale Weiler
d9572e3e30 Fixed pow/exp using fast approximation until the fractional part is hit. Once fractional is reached a binary search is used to get close to the value. 2013-11-23 06:40:27 -05:00
Dale Weiler
ae9d3d42cf A better mod implementation 2013-11-23 03:53:07 -05:00
Dale Weiler
8699053887 Fix handling on intrinsic folding, this closes #118. 2013-10-17 00:14:42 -04:00
Dale Weiler
50d165e173 Some intrinsic code cleanup. The args check is handled anyways in the parser. We use a generated array alongside to prevent generating the intrinsic multiple times instead of using static storage. Other various cleanups as well. 2013-10-16 00:04:39 -04:00
Dale Weiler
263fcfbc2f Refactor intrinsic stuff 2013-10-02 13:00:34 -04:00
Dale Weiler
98cb23ca63 Logic elsewhere handles this (no need to duplicate) 2013-08-30 07:23:15 -04:00
Dale Weiler
a50635bcd7 intrinsic folding cleanups (and improvements.) 2013-08-30 07:12:16 -04:00
Dale Weiler
a7c1f6f021 Implement [[eraseable]] attribute. When used with a function it instructs the AST (which than transfers logic to the IR) that the function (or variable) is potentially unused (verified by checking the read count). This than propogates through the IR and prevents the IR from generating both the definition and global/function. The intrinsics system uses this as well to prevent intrinsic functions from being generated unless they're used. 2013-08-29 00:05:37 -04:00
Dale Weiler
3b4a5667ea Constant fold intrinsics if their arguments are constant. TODO: reference count intrinsics such that they're not generated unless they're used, currently when an intrinsic can be folded-away it's marked for generation and makes it to the final output binary even though it isn't used. 2013-08-28 12:46:22 -04:00
Dale Weiler
bbe4927a20 Implemented a __builtin_fabs intrinsic. 2013-08-28 11:28:27 -04:00
Dale Weiler
c64005966f Remove some trailing whitespace 2013-08-17 23:43:41 +00:00
Dale Weiler
772dbfae26 Make it compile in visual studio again, without warnings. 2013-08-16 09:03:36 +00:00
Dale Weiler
73d9aa29c4 Made intrinsics seperate from the parser. 2013-08-14 06:02:15 +00:00
Dale Weiler
965f8b9041 Uh wrong file. 2013-03-09 08:57:37 +00:00
Dale Weiler
cbeac3e5f2 Implemented smart intrinsic / builtin system. When you use trivial math functions like "pow", if they don't exist as a builtin, the compiler will implement its own versions, likewise, if a compiler builtin depends on a function that exists, it will use it, likewise if it doesn't it will implement it. If you explicitally use __builtin_ (prefixed) versions, the compiler again will select the best option it can, be it a combination of both builtins and compiler builtins, all compiler builtins, OR, all builtins (most performant). 2013-03-09 08:53:39 +00:00