As Yang says, these numbers indicate the order in which C-Reduce runs its passes.

The overall design is intended to give the best results as rapidly as possible.

I've spent quite a bit of time tuning the phase ordering and no doubt there is more work left to be done.

John



On 10/03/2012 11:53 AM, Yang Chen wrote:
On 10/3/12 2:53 AM, Konstantin Tokarev wrote:
Hi all,

What values of "pri", "first_pass_pri", "last_pass_pri" mean?

These numbers means the priorities of passes. Here is how creduce invokes
these passes:
   - first runs passes which have "first_pass_pri" values;

   - then enters the main delta loop, where passes with "pri" values are
invoked in the ascending order of those values. At the beginning of each
iteration of the main loop, creduce records the size the code under
reduction, e.g., size_a. After all "pri" passes are exercised, creduce
compares the size of the reduced code (e.g., size_b) with size_a. If size_b
is less than size_a, creduce will do another iteration, i.e., runs all
"pri" passes; otherwise, we exists the main delta loop and get to the last
phase. In other words, the main delta loop keeps doing reduction until
reaching a fixpoint. Here the fixpoint is the code size.

   - passes with "last_pass_pri" values run only in the last phase. These
passes do some cleaning work, e.g., renaming function, renaming variables,
etc.

For example, let's say we have the following passes:
    A1{first_pass_pri = 1} , A2 {first_pass_pri = 2}, A3 {first_pass_pri = 3}
    B1 {pri = 1}, B2 {pri = 2}, B3 {pri = 3}
    C1 {last_pass_pri = 1}, C2 {last_pri = 2}

Then the passes will be executed like the following order:

first phase:  A1 -> A2 -> A3
main loop:
   iteration 1: B1 -> B2 ->B3 (size comparison, succeeded)
   iteration 2: B1 -> B2 -> B3 (size comparison, succeeded)
   iteration 3: B1 -> B2 -> B3 (size comparison, reaching fixpoint, and
leaving from the main loop)
last phase: C1 -> C2

All done.

If I have passes A and B, how do I make creduce run them in order A, B, A?

If A and B *only* belong to "pri" passes, then you cannot have an order
such as "A, B, A", rather you will have "A, B, A, B". But alternatively, we
could have "A, B, A" order by doing something like:
   A {first_pass_pri = 1, pri = 1}
   B {pri = 2}

Then you will end up with "A, A, B, A, B...". But I guess this might not be
what you want...

- Yang

Reply via email to