This is the mail archive of the gcc@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: Where is scheduling going wrong? - GCC-4.1.2


On Sun, 2008-04-13 at 17:05 +0530, Mohamed Shafi wrote:
> Well i tracked down the cause to the md file. In the md file i had a
> define_expand for the jump pattern. Inside the pattern i was checking
> whether the value of the offset for the jump is out of range and if
> its out of range then force the offset into a register and emit
> indirect_jump. Though this didnt work, every time an unconditional
> jump was being emitted a barrier was also being emitted. It looks like
> in define_expand for jump we should consider all the case and emit
> DONE for all the cases, if you are considering any case, otherwise a
> barrier will be generated for cases not covered in DONE. Am i right?

Sorry, I don't understand what the problem is.  We always emit a barrier
after an unconditional branch.  Whether or not you call DONE inside the
"jump" pattern is irrelevant.  Also, whether you emit a PC-relative
branch or an indirect branch is irrelevant.

> The following link is the reply from Ian for a query of mine regarding
> scheduling.
> http://gcc.gnu.org/ml/gcc/2008-04/msg00245.html
> After reading this, i feel that gcc should have looked for barrier
> insn while scheduling and should have given an ICE if it found one.
> True, barrier got into the instruction stream because of my mistake,
> but then thats what ICEs are for. Then again i might be wrong about
> this.

We do have consistency checks for many problems with the RTL, but it
isn't possible to catch all of them all of the time.

> P.S. I am still searching for a solution to choose between jump and
> indirect_jump pattern when the offset is out of range.
> http://gcc.gnu.org/ml/gcc/2008-04/msg00290.html
> May be you can help with that

This is what the shorten_branches optimization pass is for.  Define a
length attribute that says how long a branch is for each offset to the
target label.  Then when emitting assembly language code, you can choose
the correct instruction to emit based on the instruction length computed
by the shorten branches pass.  If you need to allocate a register, that
gets a bit tricky, but there are various solutions.  See the sh, mips16
(mips) and thumb (arm) ports for ideas.

Jim


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