Граф коммитов

404 Коммитов

Автор SHA1 Сообщение Дата
Alon Zakai c04260c0a1 do not emit spills in outlined code for variables that only appear in the outlines code 2013-07-18 17:28:12 -07:00
Alon Zakai c99739bd21 do not outline into outlined code for now, and refactor code analysis a little 2013-07-18 17:01:13 -07:00
Alon Zakai 2ffa3a82fa add coercions on return proxying in outliner 2013-07-18 16:26:26 -07:00
Alon Zakai 698b0c53eb emit only necessary return proxying code when outlining 2013-07-18 16:20:40 -07:00
Alon Zakai a1a7cb6031 send variables to outlines code even if just written; they may not be written to, and we would write a zero incorrectly 2013-07-18 16:08:26 -07:00
Alon Zakai 646e5af888 consolidate simplifyExpressions to one pass that happens before closure, where simplifyNotComps is guaranteed to be valid 2013-07-17 20:58:16 -07:00
Alon Zakai d45e687975 add asm coercions to switches for outlining 2013-07-17 18:18:53 -07:00
Alon Zakai 30a363191c add asm coercions to ifs for outlining 2013-07-17 18:16:06 -07:00
Alon Zakai 7e8bd8bc10 add asm coercion when outlining 2013-07-17 17:27:35 -07:00
Alon Zakai 5955301625 do not emit illegal breaks in seqs when outlining 2013-07-17 16:45:32 -07:00
Alon Zakai 82f09254a7 do not overlap the normal C stack with outliner-spilled variables 2013-07-17 13:43:14 -07:00
Alon Zakai f02de71371 refactor stack bump node search 2013-07-17 13:38:12 -07:00
Alon Zakai 3eba3acd59 rename variable 2013-07-17 13:31:30 -07:00
Alon Zakai 07d5aca5ba enable larger outline test 2013-07-17 13:23:13 -07:00
Alon Zakai 50914ed6a3 update existing stack if there is one when outlining 2013-07-17 12:42:48 -07:00
Alon Zakai 9eaf060862 stack support in outlining 2013-07-17 12:11:00 -07:00
Alon Zakai d4a89352c2 do not attempt to outline normalized asm stuff like empty vars 2013-07-17 10:59:01 -07:00
Alon Zakai 33ea873c9f fix labeled break/continue forwarding from outlined code 2013-07-16 18:14:49 -07:00
Alon Zakai cf11809790 be more and more conservative about outlining as we look into outlined functions 2013-07-16 17:56:15 -07:00
Alon Zakai f5f36712af fix break forwarding in outlined code 2013-07-16 17:42:40 -07:00
Alon Zakai 4260723fdf fix switch generation for break/continue routing in outliner 2013-07-16 17:38:13 -07:00
Alon Zakai e747992077 fix hasBreak/hasContinue processing in outline 2013-07-16 17:12:31 -07:00
Alon Zakai d98e6e30ca do not eliminate away tempDoublePtr uses that are alignment fixes; fixes #1375 2013-07-14 10:14:10 -07:00
Alon Zakai aff455b148 avoid creating ~~~ (from ~~ ^ -1) which is confusing for asm given the role of ~~ 2013-07-13 15:22:28 -07:00
Alon Zakai 4158ce9871 outliner todo 2013-07-09 21:21:30 -07:00
Alon Zakai 0af088fd16 work on outlining control flow 2013-07-09 18:54:30 -07:00
Alon Zakai 491442c434 replace &-1 with |0 at the end of the optimization pipeline 2013-07-09 11:42:25 -07:00
Alon Zakai ecfa61e39b analyze escaping breaks and continues in outlined code 2013-07-09 11:15:36 -07:00
Alon Zakai 5d3ff92c55 add one-time loop when we need to handle control flow in outlined functions 2013-07-08 18:18:50 -07:00
Alon Zakai 28898039d2 analyze code flow in outlined code 2013-07-08 18:04:28 -07:00
Alon Zakai 038807115d recurse into outlined functions 2013-07-08 17:38:16 -07:00
Alon Zakai 4e32c28ba8 do not outline too-big a chunk out of a function 2013-07-08 17:30:54 -07:00
Alon Zakai d24631b99e Merge branch 'incoming' of github.com:kripken/emscripten into incoming 2013-07-08 17:02:27 -07:00
Alon Zakai 208893daff Merge pull request #1355 from sunfishcode/incoming
Incoming
2013-07-08 17:02:03 -07:00
Alon Zakai 94dfbf75aa add read/writes in outlined functions 2013-07-08 16:49:17 -07:00
Alon Zakai 24471090e1 add variable info to outlined functions 2013-07-08 16:43:10 -07:00
Alon Zakai cbaf90d3d6 generate functions for split-out code 2013-07-08 16:35:52 -07:00
Alon Zakai c041a3f9c4 read results from outlined code 2013-07-08 16:27:18 -07:00
Alon Zakai cc89726efd emit statements in outlining 2013-07-08 16:00:38 -07:00
Alon Zakai ec9b04b118 start to emit spills 2013-07-08 15:57:03 -07:00
Alon Zakai c01e960003 infrastructure to analyze functions and variables in outliner 2013-07-08 14:29:15 -07:00
Alon Zakai 58743deec9 start to outline code 2013-07-08 14:09:49 -07:00
Alon Zakai f568dd0d01 outlining tweaks 2013-07-08 13:59:50 -07:00
Alon Zakai 818c81aa50 initial recursive logic for outlining 2013-07-08 13:44:12 -07:00
Alon Zakai 47090b2172 setup for outlining of code chunks 2013-07-08 12:11:51 -07:00
Alon Zakai 3f75ed559f begin work on outliner pass to break up large functions. part 1: aggressive variable elimination, to reduce spilling 2013-07-08 11:40:38 -07:00
Dan Gohman 30d6e3ce7d Add '!==' as a comparison operator. 2013-07-08 11:25:12 -07:00
Dan Gohman b090967580 Xor optimizations.
Optimize x^-1 to ~x; this comes up because LLVM does not have a bitwise
negate operator. Optimize x&1^1 to !x; this comes up because of how LLVM
lowers C++ bool variables.

Also, add an optimization to simplifyExpressionsPre to eliminate |0 from
'~' expressions in more cases.
2013-07-08 11:23:18 -07:00
Alon Zakai 798a2619a5 remove code after a return in a block of statements 2013-07-08 11:04:01 -07:00
Alon Zakai 0d84667ad3 comments 2013-07-04 16:36:03 -07:00
Alon Zakai 5beb8daae4 do not relocate function pointers when no need to (no such table in parent) 2013-07-03 15:31:05 -07:00
Alon Zakai 1f4e0951b9 handle multiple F_BASE_.. in relocation 2013-07-03 15:31:05 -07:00
Alon Zakai 650a1d7857 finalize floats during relocation in side modules 2013-07-03 15:31:04 -07:00
Alon Zakai 20e81c4073 begin work on memory relocation 2013-07-03 15:31:03 -07:00
Dan Gohman 0a2260ada3 Optimize (x<y)&1
Add an optimization to simplifyExpressionsPre to replace (x<y)&1 with x<y
if possible. This comes up frequently in C++ with bool variables.
2013-07-01 17:29:45 -07:00
Alon Zakai 547b13cf5b do not optimize while into do-while if there are continues; fixes #1337 2013-06-30 12:49:32 -07:00
Alon Zakai 6a65e3f46c optimizer js optimizer a little 2013-06-27 18:39:33 -07:00
Alon Zakai f4114f4ca9 Merge pull request #1331 from int3/incoming
Remove old code.
2013-06-27 17:44:42 -07:00
Alon Zakai 91920dc8cb do not collapse & inside a FUNCTION_TABLE call, we need the mask 2013-06-27 11:11:53 -07:00
Jez Ng e4afb5db4c Remove old code. 2013-06-26 16:34:36 -07:00
Alon Zakai b54c74693a fix crash in asmLoopOptimizer 2013-06-26 11:08:13 -07:00
Alon Zakai 501022cbaa Merge branch 'source-maps' of github.com:int3/emscripten into int3-source-maps
Conflicts:
	tools/js-optimizer.js
2013-06-26 10:53:17 -07:00
Jez Ng 5383aa8bf9 Reuse nodes where possible.
This allows us to preserve more line numbers when debugging.
2013-06-26 02:44:41 -07:00
Jez Ng e08502da58 We can just compare for strings here. 2013-06-26 02:44:41 -07:00
Jez Ng e3a37fccf8 Strict compare all the things! 2013-06-26 02:44:41 -07:00
Alon Zakai 6f3337677d fix crash in js optimizer loop variables pass on empty if blocks 2013-06-25 10:52:54 -07:00
Jez Ng 0c19e4051e Get rid of stale comment. 2013-06-24 19:03:50 -07:00
Jez Ng 452b8715fb Optimize! 2013-06-24 15:57:53 -07:00
Alon Zakai e94938b906 relocation pass for shared modules 2013-06-24 13:50:10 -07:00
Alon Zakai 6dd8e7a937 rename MINIFY_INFO to EXTRA_INFO in preparation for further uses 2013-06-24 13:28:50 -07:00
Jez Ng 7ff0dde780 Merge remote-tracking branch 'upstream/incoming' into source-maps
Conflicts:
	emcc
	tools/js-optimizer.js
	tools/js_optimizer.py
2013-06-22 23:46:31 -07:00
Alon Zakai c001e260ef clean up closure calling 2013-06-22 20:20:43 -07:00
Alon Zakai 202461abe3 fix -g2 and add testing 2013-06-22 15:02:10 -07:00
Jez Ng 88feddf045 Get test_source_map passing again. 2013-06-22 01:23:22 -07:00
Jez Ng 7212198353 Make optimizer handle both strings and string-like type objects.
NodeWithToken is a string-like type produced by the parser during 'embed
tokens' mode, which allows us to track line numbers.
2013-06-22 01:23:21 -07:00
Alon Zakai b5fbaa0114 do not run addition optimization pass in asm; it just adds overhead, and minorly increases code size by changing addition order against the grain of operator precedence 2013-06-21 17:27:01 -07:00
Alon Zakai c249e1fdaa decrease indentation level in js optimizer 2013-06-21 14:36:44 -07:00
Alon Zakai 36924330b0 do not eliminate loop vars when there is a shared helper 2013-06-21 12:02:52 -07:00
Alon Zakai f96eb4095c do not return node in main simplifyNotCompsPass all the time, it thinks it is being replaced and adds much overhead 2013-06-20 17:27:30 -07:00
Alon Zakai 8215a28597 fix bug with reducing f()|0|const 2013-06-19 16:42:35 -07:00
Alon Zakai ea9efe32c9 keep |0 on function calls, allow other bitwise ops on heap accesses etc. 2013-06-19 15:20:54 -07:00
Jez Ng 0f73e28bab Map source lines for assignment statements. 2013-06-19 14:15:18 -07:00
Jez Ng 7656f94838 Lay the groundwork for optimized source maps. 2013-06-19 14:09:13 -07:00
Alon Zakai e4f8c81840 keep coercions on heap accesses and function calls, but fully optimize them otherwise 2013-06-19 13:24:35 -07:00
Alon Zakai e2bfdef2b8 handle more cases in simplifyNotComps 2013-06-08 12:55:37 -07:00
Alon Zakai 8cc04538f5 only remove seq|0 when seq is an assign value 2013-06-08 10:07:21 -07:00
Alon Zakai 9ea131b762 remove unneeded outside |0 when a sequence ends in a safe bitop 2013-06-08 09:55:49 -07:00
Alon Zakai 430cfefc16 optimize away bitcasts to variables that will only be used in an assign to the parallel heap type 2013-06-08 09:55:41 -07:00
Alon Zakai 0f382355e3 improve tempDoublePtr elimination and only run analysis when necessary 2013-06-07 20:57:55 -07:00
Alon Zakai 8c3c8879d0 eliminate bitcasts of immediately loaded values 2013-06-07 20:41:55 -07:00
Alon Zakai 9e7ce499b5 optimize some HEAP32 expressions, including some unnecessary bitcasts through tempDoublePtr 2013-06-07 18:50:56 -07:00
Alon Zakai 6b93727b6e ignore tempDoublePtr operations, they do not really alias memory 2013-06-07 17:05:05 -07:00
Alon Zakai c6d56fb9da optimize out double not 2013-06-07 11:13:13 -07:00
Alon Zakai 6467d20032 remove unneeded check 2013-06-07 10:58:17 -07:00
Alon Zakai 574437453c properly simplify not comps in loop suffixes and elsewhere 2013-06-07 10:45:38 -07:00
Alon Zakai 523ed62b3c optimize multiple loop variables together 2013-06-07 10:09:12 -07:00
Alon Zakai 265dd5a4e2 handle empty loops in new loop optimizations; fixes #1270 2013-06-07 10:09:12 -07:00
Alon Zakai 5f2ccad0a3 track number of uses properly for loop variable removal 2013-06-07 10:09:12 -07:00
Alon Zakai 2c51c1eeb9 eliminate loop helper variables 2013-06-07 10:09:03 -07:00
Alon Zakai b970a019bf move asm loop optimization into last phase 2013-06-06 17:16:30 -07:00
Alon Zakai 24807a6d8f simplify infinite while loops with a break at the end into a do-while with a condition 2013-06-05 19:01:10 -07:00
Alon Zakai e7016ba189 only abort in eliminator when actually necessary 2013-05-28 17:07:40 -07:00
Alon Zakai d5299a3bbf fix registerize semantics to treat each arm of ifs and switches separately 2013-05-25 18:52:57 -07:00
Alon Zakai 7011aa3831 registerize in asm switches 2013-05-25 16:05:17 -07:00
Alon Zakai 2275f51a55 eliminate into switch cases 2013-05-25 15:04:42 -07:00
Dan Gohman c571228864 Optimize (x&A)<<B>>B.
Add an optimization to simplifyExpressionsPre to replace (x&A)<<B>>B with X&A
if possible. This comes up frequently in C++ with bool variables.
2013-05-22 14:18:23 -07:00
Alon Zakai 9da6e1f335 support closure compiler on the shell in asm mode 2013-05-16 18:22:28 -07:00
Alon Zakai a6f1fec8fb do not eliminate if there is a switch 2013-05-10 17:48:14 -07:00
Alon Zakai 32444e9c75 only recurse on decreasing uses on locals, and clear out names to avoid confusion later 2013-05-10 17:33:23 -07:00
Alon Zakai 945c2fcf44 recursively remove variables with no uses in eliminator 2013-05-10 17:33:23 -07:00
Alon Zakai 4ead9dad30 recognize the double-to-i64 bitcast pattern as having no side effects in eliminator 2013-05-07 18:54:03 -07:00
Alon Zakai 1ed2d7fdb3 fix mishandling of inference of global var types 2013-05-07 17:11:02 -07:00
Alon Zakai e5b7fab17e infer untyped variables in js-optimizer.js by origin variable's type if they are just a copy 2013-05-07 16:52:27 -07:00
Alon Zakai 8ed04a7344 TODO 2013-05-01 15:04:00 -07:00
Alon Zakai 6f8af49c56 optimize HEAPU?8[..] << 24 >> 24 and similar 2013-04-20 16:02:42 -07:00
Alon Zakai d66573c7e8 remove eliminated variable definitions only if variable was successfully removed (it might not be if it is in a switch) in asm 2013-04-17 11:06:49 -07:00
Alon Zakai bcbce47091 handle negative zero; fixes #921 2013-03-19 20:04:38 -07:00
Alon Zakai b5c3e1bda0 remove coercions on asm function calls that have no capturing variables 2013-03-09 20:22:33 -08:00
Alon Zakai 4794e95b9b move addFinalReturns to simplyExpressionsPre so it runs even in -g 2013-03-09 19:36:05 -08:00
Alon Zakai 4d1e778aa7 optimize traverseGeneratedFunctions 2013-03-09 19:20:36 -08:00
Alon Zakai 0ecad78d55 remove limitations on minified names 2013-03-09 15:47:41 -08:00
Alon Zakai 4c95c34ca8 use minified names in registerize for locals 2013-03-09 15:37:49 -08:00
Alon Zakai d3d2388517 refactor registerize global substitution 2013-03-09 14:07:05 -08:00
Alon Zakai de3c3ca816 for now, do not use rX as minified names, reserve that for registerize locals 2013-03-08 18:17:14 -08:00
Alon Zakai 6742048b4a assertions on number of minified names 2013-03-08 18:14:47 -08:00
Alon Zakai 99a6455bff properly scan all globals, including function names, before applying them 2013-03-08 18:02:57 -08:00
Alon Zakai f086eaa9be minify function names in function definitions 2013-03-08 17:45:39 -08:00
Alon Zakai 96f22dfe58 allow -O2 to also call registerize, but without minification of globals that we do in asm.js 2013-03-08 17:32:50 -08:00
Alon Zakai 8a7a96a56b start to minify inside functions, using global data from previous pass 2013-03-08 17:30:58 -08:00
Alon Zakai dac020142d minify globals in a pass before the functions 2013-03-08 17:12:22 -08:00
Alon Zakai 51bbcd6084 handle assigns into globals at the top of asm functions in normalizeAsm 2013-03-08 13:51:56 -08:00
Alon Zakai ca11fd78eb initial work on asm.js minifier infrastructure 2013-03-08 12:04:34 -08:00
Alon Zakai 82ddb0715d send only a marker of generated functions to js-optimizer.js; we either know the generated functions and send only them, or we don't know them and send all the code, in either case js-optimizer.js does not need a list of generated functions 2013-03-08 10:17:44 -08:00
Alon Zakai 1ae2a2654a fix registerize bug on functions with arguments but no locals 2013-02-17 12:35:16 +01:00
Alon Zakai 87c84e8898 optimize num >> num in js optimizer, necessary for asm now that we do not do shift optimization there 2013-02-04 10:39:36 -08:00
Alon Zakai db152b921d eliminate into labels 2013-02-02 15:29:48 -08:00
Alon Zakai 52003dff62 add final asm return of proper type, not always int 2013-01-23 14:47:04 -08:00
Alon Zakai e809edad67 support 0x[a-f] as well in +X to X.0 correction for asm 2013-01-19 16:13:46 -08:00
Alon Zakai 7654dfe434 support 0x... numbers in +X to X.0 correction for asm 2013-01-19 14:32:14 -08:00
Alon Zakai b961c328f2 emit 5.0 instead of +5 in asm 2013-01-19 11:53:52 -08:00
Alon Zakai 425fcf6836 fix simplyExpressions bug with removing too many |0s 2013-01-18 16:43:00 -08:00
Alon Zakai a2045a7516 collect local vars in asm normalization from later defs, not just initials 2013-01-15 11:01:27 -08:00
Alon Zakai 1e37a593bb do not remove asm heap coercion in js optimizer when optimizing h8 & 255 2013-01-14 17:10:01 -08:00
Alon Zakai b40b122720 emit 0.0 in asm double definitions 2013-01-12 14:34:39 -08:00
Alon Zakai 832358c295 refactor use of asm in js optimizer 2013-01-12 12:15:41 -08:00
Alon Zakai 654f554f12 improve hasSideEffects in js optimizer a tiny bit 2013-01-11 18:07:48 -08:00
Alon Zakai d7c3e10b67 optimize |,& on constants 2013-01-08 18:24:29 -08:00
Alon Zakai ed106fefa4 make sure there is a final return in functions that return value in asm 2013-01-08 17:15:36 -08:00
Alon Zakai c31a515ee3 improve |0 removal in asm mode a little 2013-01-08 16:50:37 -08:00
Alon Zakai 78dbafb289 keep a coercion right on top of heap accesses in asm mode 2013-01-08 16:43:52 -08:00