mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Implement side-effect-free (SEF) analysis. Also optimize x++ to ++x.
As an additional bonus, the condition folding function is now the one that converts a condition to -1, relieving that burden from the rest of the code and simplifying tests.
This commit is contained in:
parent
0a7d409a4e
commit
9c4d81db08
2 changed files with 172 additions and 43 deletions
|
@ -2050,3 +2050,16 @@ class parser(object):
|
|||
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
# Load the side-effect-free table as well.
|
||||
f = open('seftable.txt', 'rb')
|
||||
try:
|
||||
while True:
|
||||
line = f.readline()
|
||||
if line == '':
|
||||
break
|
||||
line = line.strip()
|
||||
if line and line[0] != '#' and line in self.functions:
|
||||
self.functions[line]['SEF'] = True
|
||||
finally:
|
||||
f.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue