Hi Juzhe,
glad that we can use the dominator info directly. Could we move the
calculation of the info to the beginning (if it's not available)? That
makes it clearer that it's a prerequisite. Function comments look
good now.
Some general remarks kind of similar to v1:
- I would prefer a hash_map or similar to hold the end point for a range
instead of looking through potentially all ranges in contrived cases.
- As long as we're just looking for the maximum number of live registers,
we can use a sliding-window approach: create a structure with all
start and end points, sort it, and increase the current pressure
if we start a new range or decrease. That's O(n log n).
> + const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (t));
> + const ssa_use_operand_t *ptr;
> +
> + for (ptr = head->next; ptr != head; ptr = ptr->next)
> + {
Why does FOR_EACH_IMM_USE not work here?
> + unsigned int max_point
> + = (*program_points_per_bb.get (e->src)).length () - 1;
> + for (k = 0; k < (*live_ranges).length (); k++)
> + {
> + if ((*live_ranges)[i].var == def)
Would also be nice not having to search through all ranges but just index/hash
it via var (or similar).
What about one test with global live ranges? Not a necessity IMHO we can still
add it later.
Regards
Robin