This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: reorg branch displacement fix


In message <Pine.LNX.4.21.0211011443240.4972-100000@mail.kloo.net>, tm writes:
 >On Fri, 1 Nov 2002, Joern Rennecke wrote:
 >
 >> > > * reorg.c (relax_delay_slots): Don't thread conditional jump
 >> > > through unconditional jump if the conditional jump can't reach
 >> > > the branch target on this processor target.
 >> > This is wrong.  reorg does not and should not be checking branch displace
 >ments.
 >> > That is a problem for shorten-branches and the backend.
 >> 
 >> The SH does some early branch shortening in machine_dependent_reorg because
 >> a long conditional branch has to be split into a short conditional branch
 >> around an unconditional branch, or a short conditional branch to an uncondi
 >tional
 >> branch (that might have been inserted elsewhere after an inverted condbranc
 >h).
 >> Unconditional branches have mandatory delay slots, so we get additional
 >> delay slots exposed by doing this splitting before reorg, and the condition
 >al
 >> branches have optional delay slots, which obviously can't be used in the sa
 >me
 >> way when the branch is reversed or redirected.
 >> Thus, machine_dependent_reorg already makes sure all the conditional branch
 >es
 >> that need splitting are split.  If reorg redirects conditional branches
 >> willy-nilly, it destroys the very data it is supposed to operate on.
 >
 >It sounds like there should be a machine-independent branch-lengthening
 >pass for machines which have limited branch displacements. There must be
 >other processors which have this same problem?
Or the SH port should use the model that all the other ports with
variable length insns + limited branch displacements + delay slots use.

That model is we don't worry about such things in reorg and deal with
branch shortening entirely in the branch shortening pass.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]