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: Removing cc0 the right way


Paul Woegerer wrote:
When not using cc0 the following code gets sometimes generated:
   compare instr
   add instr
   branch instr

When exactly is this generated? This could be any number of problems depending on who is generating it.


If compare has an explicit set of the condition code register, and the branch has an explicit use, and add has an explicit clobber, then this really shouldn't be happening unless something is broken.

Are you using a pseudo-reg or hard-reg for the condition code register? If you are using a pseudo, try using a hard reg instead. Or vice versa.

1. Add clobber side-effect to all insns that effect the condition
status - this of-course failed since the compiler sometimes generates
pattern without this clobber.

The x86 port does this. You might try looking at it for ideas. x86 however has lea instructions which can do adds without clobbering the condition code register that might be helping here.


2. Try to define compare and branch in the same define_expand and
define a define_split for them using the condition "reload_completed".
This solved the bug but I think it is still ugly because some
instruction scheduling is done after reload is completed and it might
still be dangerous.

The instruction scheduler won't move an instruction that clobbers a reg across an instruction that sets or uses the same reg. So there should be no danger here.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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