This is the mail archive of the gcc-help@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: Why does gcc produce an unnecessary `nop' instruction?


"PRC" <panruochen@gmail.com> writes:

> >It's probably caused by requested alignment of the next function.
> >Note that nop is just the value 0.
> >
> >To see whether gcc is actually generating the nop, use the
> >--save-temps option when you compile, and look at the .s file.  If you
> >don't see the nop there, it's coming from something other than gcc.
> 
> I look at the `objdump'ed assembly file again and I find that all functions
> start at the address which is 8-byte aligned. 
> Is there a particular good reason for 8-byte alignment, even if the target ARCH
> is 32-bit rather than 64-bit and aligment is quite a little waste of storage and 
> runtime memory?

Assuming you haven't used the -falign-functions option, then they are
probably being aligned so that they start on cache line boundaries.  I
don't see any code in the ARC backend to do this, so I'm not sure
where it is coming from.

Ian


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