mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Add some FIXMEs and TODOs, remove comment that no longer makes sense.
This commit is contained in:
parent
0ca5a8f5b0
commit
762bf1f27b
1 changed files with 8 additions and 1 deletions
|
@ -411,6 +411,7 @@ class foldconst(object):
|
|||
or rval['ch'][1]['nt'] == 'CONST'):
|
||||
# const + (expr + const) or const + (const + expr)
|
||||
# same as above, join them
|
||||
# FIXME: Isn't this covered by the associative sum above?
|
||||
|
||||
pass # TODO: implement
|
||||
|
||||
|
@ -419,7 +420,6 @@ class foldconst(object):
|
|||
lval, lnt, rval, rnt = rval, rnt, lval, lnt
|
||||
RSEF = 'SEF' in rval
|
||||
|
||||
# Fix n*5+1 outputing -~n*5 instead of -~(n*5).
|
||||
if lval['value'] == -1 or lval['value'] == -2:
|
||||
if rnt == 'NEG': # Cancel the NEG
|
||||
node = {'nt':'~', 't':optype, 'ch':rval['ch']}
|
||||
|
@ -577,6 +577,13 @@ class foldconst(object):
|
|||
# a>2147483647 to FALSE if SEF, otherwise convert to a&0
|
||||
# a<-2147483648 to FALSE if SEF, otherwise convert to a&0
|
||||
|
||||
# TODO: Try to optimize -(expr*-const).
|
||||
# That would yield optimal ~(~expr*blah) from (expr+1)*blah-1.
|
||||
# Also it would be cute if a*b+b would be optimized to (a+1)*b,
|
||||
# which is the other form common in strided lists.
|
||||
|
||||
# TODO: See what can be done with bool(a|!!b)
|
||||
|
||||
if nt in ('&', '|'):
|
||||
# Deal with operands in any order
|
||||
a, b = 0, 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue