Commit graph

361 commits

Author SHA1 Message Date
Wolfgang Bumiller
3e3b8993aa Lifetime analysis: Don't go through the blocks as a graph, instead, go through only the list.
The difference in code is rather small, but it's much faster.
2013-02-11 11:39:44 +01:00
Dale Weiler
b9f46f4ef7 Not an assembler instruction, but virtual instruction used by the IR. 2013-01-30 06:31:24 +00:00
Dale Weiler
36c5722273 Rename 2013-01-30 05:35:07 +00:00
Dale Weiler
d201cfe6b4 Work in progress options cleanup. 2013-01-30 05:24:30 +00:00
Wolfgang Bumiller
9b51e7085b In this situation the values don't need to be in parameter order; fix: call-stores putting values into wrong extparams 2013-01-25 16:25:23 +01:00
Wolfgang Bumiller
69e29c3ef8 debug extparam naming shouldn't start at 8, it's confusing, param 9 is now named extparam0 2013-01-25 15:37:09 +01:00
Wolfgang Bumiller
81f3a6d186 fix an off-by-one bug when copying varargs 2013-01-16 21:04:08 +01:00
Wolfgang Bumiller
f8f4ad8ee5 a tiny speedup, seems like -O2 doesn't do that by itself 2013-01-15 20:57:30 +01:00
Wolfgang Bumiller
b311cd6163 that tempbool should have gone long ago... 2013-01-15 20:27:23 +01:00
Wolfgang Bumiller
d12e6e15c9 -flegacy-vector-maths, enabled by default 2013-01-14 11:15:06 +01:00
Wolfgang Bumiller
bec05f1bbb apparently it's possible to segfault DP with a bad INSTR_LOAD_V - so the IR should not allow this 2013-01-13 21:00:13 +01:00
Wolfgang Bumiller
7fc88cfe5b fix a build issue 2013-01-12 16:38:49 +01:00
Wolfgang Bumiller
47db74c699 this is useless and just confused me a lot, removing 2013-01-12 16:20:31 +01:00
Wolfgang Bumiller
cd543aad5e added gen_function_varargs_copy 2013-01-12 14:48:56 +01:00
Wolfgang Bumiller
e8b5ad6625 mask -Olocal-temps by IR_FLAG_MASK_NO_LOCAL_TEMPS which now equals IR_FLAG_MASK_NO_OVERLAP - though HAS_ARRAYS usually suffices, but not for code which _depends_ on uninitialized variables 2013-01-12 14:03:54 +01:00
Wolfgang Bumiller
2a4ea74a97 ir_function stores max_varargs now 2013-01-12 14:01:16 +01:00
Wolfgang Bumiller
973122ed9b ast_call now has a va_count which causes a store to reserved:va_count before the call 2013-01-12 13:29:47 +01:00
Wolfgang Bumiller
6df3c625b0 Added a flag to both ast and ir which enforces the generation of a globaldef for a value 2013-01-11 19:15:59 +01:00
Wolfgang Bumiller
f06a59e3c7 Fix a warning 2013-01-10 16:04:58 +01:00
Wolfgang Bumiller
9eefe90d78 removing a goto loop 2013-01-09 16:00:16 +01:00
Wolfgang Bumiller
a76ae11241 more IR dump verbosity; fix: MUL_VF/FV additional liferange must be propagated to the full vector when using a vector-member as float-parameter 2013-01-08 21:21:52 +01:00
Wolfgang Bumiller
d6809ed331 better solution to blockstart pointlife issues 2013-01-08 15:22:24 +01:00
Wolfgang Bumiller
ae97ff7a80 This should fix the -Olocal-temps issue; set v->unique_life for any v with a point-life - this is a bad solution: proper dead code elimination should be done instead 2013-01-07 14:55:05 +01:00
Wolfgang Bumiller
63e5bc91de more info in the IR dump 2013-01-07 14:55:05 +01:00
Wolfgang Bumiller
99249c8fa3 Guard 2 peephole optimizations which should only work on the currently-last instruction by a check if it's actually really at the end... 2013-01-07 00:22:54 +01:00
Wolfgang Bumiller
ae09831227 Introducing TYPE_NOEXPR so that these undefined labels cannot be used on the expression side of goto ternary expressions; ast_label now is TYPE_NOEXPR; we may consider setting ast_ifthen to that too unless we want ifthen to return a value... 2013-01-03 12:49:21 +01:00
Dale Weiler
29db4a44ed Happy new years! 2013-01-01 05:08:55 +00:00
Wolfgang Bumiller
2b1eaa6df3 Actually allocate a nil-vector for nil 2012-12-31 13:25:18 +01:00
Wolfgang Bumiller
0c673dfebb fix store op for nil as parameter 2012-12-31 13:19:34 +01:00
Wolfgang Bumiller
26d43e650f Adding some more internal-error messages where they were missing; fixed ast_ternary_codegen to use the ast_node's type instead of the ir generated ones to avoid erroring on TYPE_NIL 2012-12-31 12:08:47 +01:00
Wolfgang Bumiller
73bc4cc3e4 -Ovector-components 2012-12-29 15:05:04 +01:00
Wolfgang Bumiller
40b2a26e89 TYPE_NIL, builder->nil, ast_value_codegen for TYPE_NIL 2012-12-28 18:05:28 +01:00
Dale Weiler
cb12460b95 Fix another Blub bug .. learn to use comments properly :P 2012-12-28 12:54:20 +00:00
Wolfgang Bumiller
24f3098418 fix: when there are no additional temps the first one allocated slot's size was counted twice resulting in some additional unused globals 2012-12-27 11:46:08 +01:00
Wolfgang Bumiller
d4483bfda6 -Oglobal-temps 2012-12-26 23:18:45 +01:00
Wolfgang Bumiller
1cca992a8e factoring out temp-slot-assignment and using it for the declared locals too, makes -Olocal-temps more effective 2012-12-26 22:09:54 +01:00
Wolfgang Bumiller
de3d8747f7 fix uninitialized warnings in ir.c 2012-12-26 20:07:57 +01:00
Wolfgang Bumiller
700628b2cb counters for -Ocall-stores because we all love numbers 2012-12-26 19:11:26 +01:00
Wolfgang Bumiller
14889897da Don't copy return values away from OFS_RETURN if they don't get locked. 2012-12-26 18:33:16 +01:00
Wolfgang Bumiller
af5b552a7f -Ovoid-return - the last INSTR_RETURN of a void functions is replaced by INSTR_DONE to reduce the instruction count 2012-12-26 10:24:33 +01:00
Wolfgang Bumiller
aee7bf0de0 Actually generate the vector member ir_values in ir_function_finalize, since ir_builder_gen_global is too late / happens after life ranges; this should fix -Ooverlap-locals 2012-12-25 23:51:29 +01:00
Wolfgang Bumiller
a7c3ef3e22 -Ocall-stores as part of -O1: instead of having CALL instructions issue STOREs for every parameter, use the newly introduced 'lock' flag to make the operations generating the call's parameters generate them right into the OFS_PARM if there's no interfering CALL in between 2012-12-25 23:25:59 +01:00
Wolfgang Bumiller
d7de5cb5ff do the locking before processing the call-reads otherwise all the call's parameters get locked as well 2012-12-25 23:24:31 +01:00
Wolfgang Bumiller
710f580e15 liferange calc now sets the 'locked' flag on values when reaching a CALL 2012-12-25 21:03:26 +01:00
Wolfgang Bumiller
307746dc35 Ensure that the members[] array is filled for vector types so the liferange function can use all of them 2012-12-24 12:52:15 +01:00
Wolfgang Bumiller
dc691c8a6e Now this should deal with vector life ranges more correctly. 2012-12-24 12:43:05 +01:00
Wolfgang Bumiller
2d66431af4 -q, --quiet option 2012-12-24 10:53:51 +01:00
Wolfgang Bumiller
6a93b72ea5 -Ostrip-constant-names 2012-12-23 22:58:46 +01:00
Wolfgang Bumiller
6a60368a1b -Olocaltemps -> -Olocal-temps for consistency; added manpage entry; removed leftover manpage entry for -foverlap-locals; -Olocal-temps moved from -O1 to -O3 due to stability concerns 2012-12-23 21:39:23 +01:00
Wolfgang Bumiller
1ac913877e revert 3ef30e850d 2012-12-23 21:34:04 +01:00
Wolfgang Bumiller
63928e231c Remove ir_block_create_{add,sub,mul,div}, they're not used; STOREP instructions don't themselves to their target pointer's 'writes' list, but 'reads' list instead 2012-12-23 21:29:15 +01:00
Wolfgang Bumiller
435dee935b Start instruction numbering at 1 and make parameters live at 0 2012-12-23 21:20:16 +01:00
Wolfgang Bumiller
3ef30e850d Don't store off CALL results if they're never read 2012-12-23 21:11:56 +01:00
Wolfgang Bumiller
fb5a65c51a Life Ranges: First deal with all writes, then with all reads, since writes will remove values from the Living set 2012-12-23 20:50:21 +01:00
Wolfgang Bumiller
3c9283cc41 don't optimize out NOT_S instructions for COND 2012-12-23 17:51:01 +01:00
Wolfgang Bumiller
c91b457054 Mask overlap-locals by -Ooverlap-locals, and count (the amount of overlapped functions) 2012-12-23 17:40:56 +01:00
Wolfgang Bumiller
b8c61f2f88 Try generating the function-locals in a later pass; with the option to overlap them. 2012-12-23 17:32:39 +01:00
Wolfgang Bumiller
88a6437840 remember the maximum amount of required function-locals 2012-12-23 16:31:01 +01:00
Wolfgang Bumiller
7998a98818 ir_function now has a flags field - flags are: IR_FLAG_HAS_{ARRAYS,UNINITIALIZED,GOTO} 2012-12-23 16:21:38 +01:00
Wolfgang Bumiller
1731a29c51 Don't generate defs for locals or parameters unless using -g 2012-12-23 12:22:27 +01:00
Wolfgang Bumiller
55117912ab Don't generate vector defs if the vector's name starts with a # because that's an 'IMMEDIATE' 2012-12-23 10:14:25 +01:00
Dale Weiler
c3964cf29d Make compiler and virtual-machine compile as C++ code, also removed gmqcc_voidptr hack. 2012-12-23 07:51:19 +00:00
Wolfgang Bumiller
43cf6e7cba -Opeephole now also reduces CALL stores 2012-12-21 11:42:23 +01:00
Wolfgang Bumiller
48ba6a6189 Rename ir_function_pass_tailcall->tailrecursion; Take -fadjust-vector-fields into account when storing field type return-values from functions 2012-12-21 11:33:44 +01:00
Wolfgang Bumiller
0bbc8a3350 Remove old tempalloc code; disable -Olocaltemps for now 2012-12-20 23:52:54 +01:00
Wolfgang Bumiller
e38bdecd21 Be more correct with sizes; use a better local-alloc strategy 2012-12-20 23:48:41 +01:00
Wolfgang Bumiller
1d3fdea432 Fix util_endianswap; and endianswap the LNO data as well 2012-12-20 22:03:51 +01:00
Wolfgang Bumiller
b595ec03f8 fix a leak in the local-allocator 2012-12-20 20:26:54 +01:00
Wolfgang Bumiller
915c002be4 Temporarily fix noreturn bug by creating an actual dummy return instruction after the call for now 2012-12-20 16:20:08 +01:00
Wolfgang Bumiller
3119a95a89 -fallow-unreachable-code 2012-12-20 14:41:16 +01:00
Wolfgang Bumiller
a274f8ec07 making the uninitialized-var on vector warning now check all members; ir_value_vector_member now also appends _x,_y,_z since they're used in the used-unintialized message 2012-12-20 14:06:25 +01:00
Dale Weiler
0648835061 handle cygwin/mingw for makefile 2012-12-20 00:22:22 +00:00
Wolfgang (Blub) Bumiller
afaa162aa1 Applying the actual 'Fix FTFBS stuff' part 2012-12-19 22:17:22 +01:00
Wolfgang (Blub) Bumiller
57aaf57dfc Revert "Fix FTFBS stuff"
This reverts commit 2cc51b8eb0.
2012-12-19 22:15:38 +01:00
Dale Weiler
2cc51b8eb0 Fix FTFBS stuff 2012-12-19 21:05:40 +00:00
Wolfgang (Blub) Bumiller
7c5fc26081 NRCALL now sets block->final and block->is_return 2012-12-19 20:40:45 +01:00
Wolfgang (Blub) Bumiller
bf267d0238 ir_block_create_{phi,call} now check self->final 2012-12-19 20:39:44 +01:00
Wolfgang (Blub) Bumiller
384446316a VINSTR_NRCALL, translated like any other call for now; to be used to mark a call which never returns, ie the error builtin 2012-12-19 20:38:32 +01:00
Rudolf Polzer
acf4da9385 Fixes for some minor bugs clang-analyzer and cppcheck found
Signed-off-by: Dale Weiler <killfieldengine@gmail.com>
2012-12-18 16:54:51 +00:00
Wolfgang (Blub) Bumiller
dccafd65ac More jump removal 2012-12-18 14:03:20 +01:00
Wolfgang (Blub) Bumiller
19deac0707 *sigh* 2012-12-18 13:13:54 +01:00
Wolfgang (Blub) Bumiller
66e6e6329f vector components are floats, not vectors 2012-12-18 12:58:15 +01:00
Wolfgang (Blub) Bumiller
d9cca87aff Don't generate IF/IFNOT with +1 offsets 2012-12-18 12:57:09 +01:00
Wolfgang (Blub) Bumiller
d09ab90f24 -fsingle-vector-defs to disable _x,_y,_z generation 2012-12-18 12:47:48 +01:00
Wolfgang (Blub) Bumiller
116d744823 Generate _x,_y,_z defs/fields 2012-12-18 12:41:38 +01:00
Wolfgang (Blub) Bumiller
db5484bdef DEF_SAVEGLOBAL flag is now applied on initialized non-constant globals, and is not applied on 'consts' 2012-12-18 12:02:33 +01:00
Wolfgang (Blub) Bumiller
6b4c89700b Don't generate 'jump +1' instructions 2012-12-18 11:57:30 +01:00
Wolfgang (Blub) Bumiller
83a41d13c0 Don't generate AINSTR_END anymore, use INSTR_DONE 2012-12-18 11:46:26 +01:00
Dale Weiler
4b3e2571af Cleanups of compiler option configuration. Added ini/cfg parser system as well. 2012-12-18 04:57:17 +00:00
Wolfgang (Blub) Bumiller
2534076963 irwarning to use vcompile_warning 2012-12-17 18:25:06 +01:00
Wolfgang (Blub) Bumiller
c198c23df1 Another peephole optimization 2012-12-06 22:10:31 +01:00
Wolfgang (Blub) Bumiller
8858f265dd s/ir_function_pass_minor/ir_function_pass_peephole/ 2012-12-06 21:39:34 +01:00
Wolfgang (Blub) Bumiller
9c5b95bbe3 Temporarily disable the new tempalloc strat 2012-12-06 17:41:00 +01:00
Wolfgang (Blub) Bumiller
f9b1d057b5 Moving all the global opts_ variables into a struct, now there's one global 'opts' struct 2012-12-06 13:23:53 +01:00
Wolfgang (Blub) Bumiller
94560d1873 -Ominor -> -Opeephole; added -Olocaltemps flag; using a less space-wasting temp-allocation in general 2012-12-06 13:08:46 +01:00
Wolfgang (Blub) Bumiller
37fbe7176f Tiny codegen optimization: silently ignore the creation of STORE with input and output being the same address 2012-12-05 15:17:11 +01:00
Wolfgang (Blub) Bumiller
8acfd87039 remember this for later 2012-12-05 15:14:21 +01:00
Wolfgang (Blub) Bumiller
fe150aee72 ir_function_pass_minor: some minor optimizations 2012-12-05 14:14:35 +01:00
Wolfgang (Blub) Bumiller
8e077f378e -Werror now changes the word 'warning' into 'error' 2012-12-04 12:54:53 +01:00
Wolfgang (Blub) Bumiller
c371efb882 Fix a type size bug: non-var locals overlapped with var locals, that was bad 2012-12-01 23:23:00 +01:00