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.
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
|