| parrotcode: Untitled | |
| Contents | Language Implementations | Regex |

Regex::Optimize

Optimize a sequence of list ops.

1. Merge equivalent labels 2. Jump threading: Replace goto X; ...; X: goto Y; with goto Y. 3. Eliminate unreachable code. 4. Eliminate jumps to the following address. 5. Eliminate unused labels.TODO:
1. I would like to optimize
B1: sub x, 1
goto S0
B2: sub x, 1
goto B1
B3: sub x, 1
goto B2
to
B1: sub x, 1
goto S0
B2: sub x, 2
goto S0
B3: sub x, 3
goto S0
since this commonly occurs in regex code, due to sequence of single-character matches (eg /a[bB]c/).But perhaps this should be handled in the Tree -> List rewrite??# Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 100 # End: # vim: expandtab shiftwidth=4:
|
|
|