Fixing jumps reachability after block reordering

Jim Wilson wilson@specifix.com
Mon Jul 9 22:36:00 GMT 2007


Gregory B. Prokopski wrote:
> I reorder the basic blocks in passes.c, right after compute_alignmnets ().
> I added a call to shorten_branches(NULL_RTX) right after my BB reordering,
> but it didn't change a thing, and I am still getting as errors:

shorten_branches does this:
   /* Compute initial lengths, addresses, and varying flags for each 
insn.  */
   for (insn_current_address = 0, insn = first;
        insn != 0;
        insn_current_address += insn_lengths[uid], insn = NEXT_INSN (insn))
     { ... }

where FIRST is the argument, which means that shorten_branches(NULL_RTX) 
will do nothing, which is exactly what you discovered.  Try calling it 
correctly with a start instruction.  If you grep for it, you will see 
that the main call to it is
   shorten_branches (get_insns ());
which runs it on the entire function.  This is probably what you want.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com



More information about the Gcc mailing list