Commit graph

17 commits

Author SHA1 Message Date
Sei Lisa
fe2dd9a721 First baby steps towards dual Python2+3 compatibility 2019-01-16 00:15:06 +01:00
Sei Lisa
8c1dc90cc8 Add a routine used to generate some of the test cases
When run in SL, this program generates a list in pretty much the format expected by the test suite, therefore it's quite convenient to have.
2019-01-15 23:19:02 +01:00
Sei Lisa
d394adf45a Add a test case to the infinity vector conversion 2019-01-15 23:18:10 +01:00
Sei Lisa
e261ac2121 Add unit test for the _Pragma operator 2019-01-15 20:38:19 +01:00
Sei Lisa
8043cb7c9f Add two forgotten files from the inline tests 2019-01-15 20:35:17 +01:00
Sei Lisa
352f410d12 Add forgotten unit tests for the identifier substitution fiasco 2019-01-11 21:20:21 +01:00
Sei Lisa
0877f8c7e6 Forgot unit_tests/__init__.py necessary to run the JSON test 2019-01-11 17:34:10 +01:00
Sei Lisa
42f47d38f0 Fix swaps and other misoptimizations
This undoes 454d44e85f
2019-01-11 02:09:15 +01:00
Sei Lisa
1b3c8a4d89 Check min and max to determine truth value of condition
Also added some min/max values for a few functions.

This allows optimizing things like:

  ! llGetNumberOfPrims()  ->  0
2019-01-07 00:15:38 +01:00
Sei Lisa
5bfb218505 Perform redundant jump elimination in lastpass
This is a first try at redundant jump removal (jumps that target the very next instruction). It's too basic in several ways.

- The statement is replaced by a ';' instead of removed.
- If the jump was the only statement in an if, when the if becomes empty, it's not folded.
- Jumps that are last in the 'then' branch of if+else are not visible. This would need either to track multiple last statements, or to have some means to anticipate what the next statement is at every statement. A Control Flow Graph would help a lot.
- When a label is immediately followed by a jump, all jumps to that label should target the destination of that jump if it's in scope. Added to TODO.
- It misses some optimizations when not expanding WHILE and FOR into IF/JUMP.

Moving everything to an earlier stage would help with some of these, especially with ';' and 'if' folding. Unconditionally expanding WHILE and FOR would also help.
2019-01-06 22:32:19 +01:00
Sei Lisa
574f92d08e Allow #pragma OPT inline 2019-01-06 02:20:34 +01:00
Sei Lisa
c5fd4932f1 Finish inlining for all loop conditions 2019-01-06 01:59:36 +01:00
Sei Lisa
852fec2f26 Inliner: Add and use newSymtab() and newId() 2019-01-06 01:10:21 +01:00
Sei Lisa
47a324f4a6 Coverage test lsloutput-1 is prone to exceptions. Activate -y. 2019-01-06 00:50:42 +01:00
Sei Lisa
ddec4c464e Inline functions in 'do' loop conditions have been fixed 2019-01-05 23:10:01 +01:00
Sei Lisa
054539adf9 Make .fail files replace the docstring in order to be visible 2019-01-04 22:29:15 +01:00
Sei Lisa
1867dc78e7 Add the new test suite.
This test suite has been in use for a long time now, in place of the obsolete and unmanageable testparser.py and testfuncs.py. It verifies the complete optimizer output to stdout and stderr, to ensure that the output matches the expectations.

See unit_tests/README.txt for more info.
2019-01-04 20:27:36 +01:00