[patch] TSP based bb reordering
James Morrison
ja2morri@csclub.uwaterloo.ca
Fri Apr 9 20:06:00 GMT 2004
Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> writes:
> Hello,
>
> > > + /* The parameters of the cost function for the tsp based reordering. These
> > > + can be redefined by targets as needed. The values here correspond simply
> > > + to minimising the total number of jumps executed, and a slight preference
> > > + for the taken branch to be the less frequent one, which is usually a good
> > > + thing to do. Making the value of HIT_TAKEN_COST and MISS_TAKEN_COST
> > > + different makes sense only on targets with static branch prediction. */
> > > +
> > > + /* Cost of an unconditional jump. */
> > > + #define JUMP_COST 100
> > > +
> >
> >
> > Should JUMP_COST be wrapped in an ifndef?
>
> no -- JUMP_COST is just a constant relative to that the other costs are
> defined; I will add a comment.
Ok.
> > > + /* Solves a tsp instance of size N. WEIGHTS is a matrix of weights of
> > > + edges. Result is retunrned in TOUR; the initial tour is also obtained
> > > + from there. */
> > ^^^^^
> >
> > Does this indicate that TOUR holds both the optimal tour and the initial tour?
>
> Yes -- that the initial tour is passed to the function in TOUR and
> replaced by the 'optimal' tour.
Ok, I had misunderstood the use of obtained. Perhaps, "optimize_tsp uses
TOUR as the initial tour."
> > > + static void
> > > + optimize_tsp (int n, int *tour, struct vertex *weights, int iterate)
> > > + {
...
> > > + #ifndef ENABLE_CHECKING
> > > + if (dump_file)
> > > + {
> > > + #endif
> > > + value = tsp_value (n, tour);
> > > + #ifndef ENABLE_CHECKING
> > > + }
> > > + #endif
> >
> > This looks strange, if checking is enabled but dump_file is 0 then
> > value, or new_value later on, will never be set.
>
> No -- if checking is enabled, the checks for dump_file are disabled,
> so value and new_value are computed. We normally do not need the values
> for anything; we just compute it when either checking is enabled (for
> verification purposes), or when we need to show them in dumps.
>
> Zdenek
Ahh, right, #ifndef, not #ifdef -- my bad.
Jim
More information about the Gcc-patches
mailing list