public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* nops
@ 2009-05-21  4:52 Jamie Prescott
  2009-05-21  9:16 ` nops Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Jamie Prescott @ 2009-05-21  4:52 UTC (permalink / raw)
  To: gcc


Under which conditions GCC generates nops?
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?


 - Jamie



      

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nops
  2009-05-21  4:52 nops Jamie Prescott
@ 2009-05-21  9:16 ` Ian Lance Taylor
  2009-05-21 15:47   ` nops Jamie Prescott
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2009-05-21  9:16 UTC (permalink / raw)
  To: Jamie Prescott; +Cc: gcc

Jamie Prescott <jpresss@yahoo.com> 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.


> 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.

Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nops
  2009-05-21  9:16 ` nops Ian Lance Taylor
@ 2009-05-21 15:47   ` Jamie Prescott
  2009-05-21 16:12     ` nops Andrew Pinski
  0 siblings, 1 reply; 5+ messages in thread
From: Jamie Prescott @ 2009-05-21 15:47 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc


----- Original Message ----

> From: Ian Lance Taylor <iant@google.com>
> To: Jamie Prescott <jpresss@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


      

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nops
  2009-05-21 15:47   ` nops Jamie Prescott
@ 2009-05-21 16:12     ` Andrew Pinski
  2009-05-21 17:29       ` nops Jamie Prescott
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Pinski @ 2009-05-21 16:12 UTC (permalink / raw)
  To: Jamie Prescott; +Cc: Ian Lance Taylor, gcc

On Thu, May 21, 2009 at 8:13 AM, Jamie Prescott <jpresss@yahoo.com> wrote:
> 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.

so it happens at -O0 so that the debugger is able to place a
breakpoint at some gotos.

Thanks,
Andrew Pinski

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nops
  2009-05-21 16:12     ` nops Andrew Pinski
@ 2009-05-21 17:29       ` Jamie Prescott
  0 siblings, 0 replies; 5+ messages in thread
From: Jamie Prescott @ 2009-05-21 17:29 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Ian Lance Taylor, gcc


> From: Andrew Pinski <pinskia@gmail.com>

> To: Jamie Prescott <jpresss@yahoo.com>
> Cc: Ian Lance Taylor <iant@google.com>; gcc@gcc.gnu.org
> Sent: Thursday, May 21, 2009 8:22:00 AM
> Subject: Re: nops
> 
> On Thu, May 21, 2009 at 8:13 AM, Jamie Prescott wrote:
> > 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.
> 
> so it happens at -O0 so that the debugger is able to place a
> breakpoint at some gotos.

Thanks! Makes sense, and it means that I can define to an empty insn for the
version of the VM that does not have 'nop'.


- Jamie


      

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-05-21 15:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-21  4:52 nops Jamie Prescott
2009-05-21  9:16 ` nops Ian Lance Taylor
2009-05-21 15:47   ` nops Jamie Prescott
2009-05-21 16:12     ` nops Andrew Pinski
2009-05-21 17:29       ` nops Jamie Prescott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).