Re: GCC ARM assembly questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 22, 2007 at 04:31:32AM -0400, Priya Narasimhan wrote:
> Hi,
> 
> I am compiling relatively simple C programs using "gcc -S
> -fomit-frame-pointer -mcpu=xscale" on a gumstix (ARM Xscale) processor. I
> noticed that the generated assembly code has additional stuff in, beyond
> what I would typically see in a standard ARM assembly program (e.g., one
> that was generated instead through the ARM Development Suite toolchain). 
> 
> For instance, I see the following comments in the GNU-generated assembly
> code. What do these signify? 
> 
> @ zero_extendqisi2

   I think this is just a debugging aid so that you can tell the difference
between e.g.

	ldrb	r2, [r5, r3]	@ zero_extendqisi2

and

	ldrb	r2, [r5, r3]

since without the comment, they'll look just the same. I'm guessing the
comment is a remnant from before the -dp option was added to GCC. It's not
unusual for more than one GCC instruction pattern to map to the same machine
instruction. The -dp option will add a comment to clear the ambiguity.

   In the example above, in addition to loading 8 bits from memory to a
register, GCC expects the first instruction to clear the most significant 24
bits to zero (comment "*arm_zero_extendqisi2" with -dp) while making no such
expectation of the second instruction (comment "*arm_movqi_insn" with -dp).

> @ args =0, pretend =0 (what does pretend mean?)
> @ frame_needed = 0, uses_anonymous_args = 0 (what does uses_anonymous_args
> mean?)

   Also debugging aids, this time with some of the information GCC uses when
generation function prologues and epilogues.

> Secondly, I notice that without the "-O" option, saving registers to the
> stack happens almost on every alternate line of the generated assembly code.

   Please refer to the manual
<URL:http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html>.

> Finally, is there any documentation on what "-O" actually accomplishes for
> an ARM/Xscale processor? For instance, does it use the barrel shifter or
> conditional execution wherever possible?

   AFAIK, there's not much documentation about the machine specific
optimizations. If you have a particular piece of source code where you want
to know how it was optimized, you can look at the dump files. Please see
<URL:http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html>. The most
interesting options when it comes to the machine specific optimizations are:

-fdump-rtl-combine (or even better recently, -fdump-rtl-combine-details)
-fdump-rtl-ce1
-fdump-rtl-ce2
-fdump-rtl-ce3
-fdump-rtl-peephole2

   Frequently, you'll need to compare two dump files using your favourite
diff utility to see what a particular optimization pass changed. Then you
might as well just specify -fdump-rtl-all(-details) and get all the dump
files.

-- 
Rask Ingemann Lambertsen
Danish law requires addresses in e-mail to be logged and stored for a year

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux