----- Original Message ---- > From: Ian Lance Taylor <i...@google.com> > To: Jamie Prescott <jpre...@yahoo.com> > Cc: gcc@gcc.gnu.org > Sent: Wednesday, May 20, 2009 9:50:50 PM > Subject: Re: nops > > Jamie Prescott writes: > > > Under which conditions GCC generates nops? > > It depends entirely on the target. For many targets, gcc will never > generate a nop instruction, except as a byproduct of alignment.
My target does not have anything special WRT alignment. I even set the function alignment to 8, and it still issues gen_nop(). This seem to happen only with -O0, or at least I noticed it only under such condition so far. > > I noticed that with 4.4.0, gen_nop() is required, thing that wasn't with > 4.3.3. > > Can I just define an empty insn for nop, of GCC requires a one-byte insn > > for > its > > own alignment purposes? > > Normally gcc does alignment by issuing an assembler directive, and the > assembler is responsible for generating nop instructions when necessary. Did a quick grep and the one you mention (ASM_OUTPUT_ALIGN_WITH_NOP) is not defined in my backend. And such directive does not even have a default. So, in theory, I should not see any nops. The problem is different. The error is at link-time, if gen_nop() is not defined, so it means that the insn is generated programmatically. Grepping the source, I noticed a few files that issue gen_nop() directly, thing that was not happening with 4.3.3. So my questions are. Is there a way to disable it? If not, can I define an empty-issue instruction for 'nop'? - Jamie