Commit graph

36 commits

Author SHA1 Message Date
Dale Weiler
12a864abf5 Some more platform / compiler specific code refactoring. 2013-10-11 03:02:38 -04:00
Dale Weiler
151606e255 Initial platform / compiler specific code refactoring. 2013-10-11 02:39:30 -04:00
Dale Weiler
300fb9905b Fix fold_superfluous 2013-10-04 07:10:58 -04:00
Dale Weiler
cc69370575 Another peephole optimization which removes superfluous expressions such as (A + 0), (A - 0), (A * 1) and (A / 1). 2013-10-04 06:46:54 -04:00
Dale Weiler
15b0555546 Implement constant folding on ternary operations via fold_cond. 2013-09-26 06:51:49 -04:00
Dale Weiler
f25fff1e3d Remove debug printfs 2013-09-18 19:18:10 -04:00
Dale Weiler
e18849fa42 Generate (non_const_float * (1.0 / constant_float)) for (non_const_float / constant_float) expressions. 2013-09-18 19:15:24 -04:00
Dale Weiler
64661f54ea Implemented >< (vector cross product operator). Currently support for constants only. 2013-08-31 13:41:25 -04:00
Dale Weiler
69252071ba Prevent divide by zero for / and % operations in constant folding (previously caused compiler SIGFPE), instead "inf" is generated for both cases. This closes #124 2013-08-31 12:57:24 -04:00
Dale Weiler
a50635bcd7 intrinsic folding cleanups (and improvements.) 2013-08-30 07:12:16 -04:00
Dale Weiler
51ef277e21 Fix folding logic for conditions. 2013-08-29 00:18:48 -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
ee428b9081 Fix fold-dce for if(0) 2013-08-28 10:39:48 -04:00
Rudolf Polzer
e50b7a2719 Support vector bitor/bitand/bitxor.
Signed-off-by: Rudolf Polzer <divverent@xonotic.org>
2013-08-26 18:32:28 +02:00
Dale Weiler
c64005966f Remove some trailing whitespace 2013-08-17 23:43:41 +00:00
Dale Weiler
a622d5163b Rework some build stuff for better output and to enable strict prototypes 2013-08-16 03:28:02 +00:00
Dale Weiler
91c7209146 Track constant folds in opts_optimization list .. this could be handled better I assume. 2013-08-15 03:45:50 +00:00
Dale Weiler
f82097b6b8 Update deps 2013-08-14 06:12:43 +00:00
Dale Weiler
90e2e5a4ad Some typos 2013-08-14 02:07:12 +00:00
Dale Weiler
7669a99c7f increment the optimization counter for DCE'd folds, also enable -O3 for compilation. 2013-08-01 14:24:10 +00:00
Dale Weiler
db69d14995 Disable the macros to keep clang happy (just uncomment them for when more constant folding optimizations need them) 2013-08-01 07:12:21 +00:00
Dale Weiler
6f749d61b1 Added -Oconst-fold-dce (dead code elimination optimization for when constant expressions form the basis of the dead code, i.e if else with constant expression). Fixed deps and added documentation. Cleaned up folds for ir_value (can now use the same macros as the ast_value ones). 2013-08-01 07:07:59 +00:00
Dale Weiler
10b75fd8b9 Move const-branch-elision into fold.c 2013-07-31 19:34:38 +00:00
Dale Weiler
960cb7034a The problem was so subtle 2013-07-31 18:53:00 +00:00
Dale Weiler
3fa74da2b5 Fixes 2013-07-31 17:24:32 +00:00
Dale Weiler
5f2b7e3d57 fixed vector ops constant folding. 2013-07-31 17:05:43 +00:00
Dale Weiler
d0ee56f25f more fixes 2013-07-31 16:31:45 +00:00
Dale Weiler
1538e69f93 Fixes 2013-07-31 15:56:56 +00:00
Dale Weiler
fa5ad1212e Operator constant folding rewrite almost complete, just need to track down why two tests are failing. 2013-07-31 15:49:45 +00:00
Dale Weiler
86adb94d7d folding for lteqgt (less than equal to or greater than) operator a.k.a <=> which maps values to -1,0,1 depending on the result (think of the result as a troolan) .. it's a perl thing :P 2013-07-31 12:59:34 +00:00
Dale Weiler
9ed62eee58 Feed clang demon 2013-07-31 12:17:52 +00:00
Dale Weiler
c3da9b237b && and || op folding 2013-07-31 12:11:03 +00:00
Dale Weiler
b0460de935 Fold for div op 2013-07-31 11:48:43 +00:00
Dale Weiler
8dd125c8f3 Added constant folding support for '*' .. Clever ascii trick prevail :D 2013-07-31 10:40:17 +00:00
Dale Weiler
5e38c800f6 Some cleanups and more support for constant folding. 2013-07-31 09:56:45 +00:00
Dale Weiler
920dbaf1e0 Work in progress constant-folding rewrite. 2013-07-31 09:04:19 +00:00