This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

RE: size of code gcc creates (was "m68k-coff-gcc and NOPs")


Scott,
	I too have been comparing code size with Microtec's compiler. I
found the following options useful in reducing it: -Os -fomit-frame-pointer
-fno-force-mem. The results are then comparable to Microtec's.

	I also noticed that the run time library was much bigger. On
investigation I found all the string functions had an option to do the
operations one long word at a time. This makes the code much longer on a 68K
cpu, and also slower. In some cases it also fails to work! Recompiling with
the PREFER_SIZE_OVER_SPEED macro defined, produces more traditional
implementations which are much smaller.

Chris

> -----Original Message-----
> From:	Scott A Sumner [SMTP:sasumner@juno.com]
> Sent:	Saturday, January 15, 2000 10:45 PM
> To:	olli@enea.se
> Cc:	crossgcc@sourceware.cygnus.com
> Subject:	Re: size of code gcc creates (was "m68k-coff-gcc and NOPs")
> 
> All good points, Ola!
> 
> All compilers ARE different, so there should be some difference in size. 
> However, I consider the 17% a significant difference for the following
> reasons:
> 
> * the gcc code is as optimized as I've been able to make it for size
> * the commercial code is unoptimized
> 
> The code size for my application is not that big of a deal.  I've got a 1
> Mbyte flash.  Problem comes in when we talk about the flash boot loader. 
> It has to fit in a certain size block of memory.  With the commercial
> compiler it fits with plenty to spare.  With the gcc compiler, well....it
> doesn't fit so well.
> 
> So, does anyone else have any comments regarding squeezing some more size
> out of my gcc generated code?
> 
> 
> 
> 
> > I don't think a 17% difference is much when you compare different
> > compilers. You can have much larger differences for the same 
> > compiler
> > using different compiler options (which interacts subtly with how 
> > you
> > write your code) or different versions of the same compiler (which I
> > have experienced with gcc for 68K). Different compilers are designed
> > and implemented differently and are you sure exactly the same 
> > optimizations
> > are performed?
> > --
> > 	Ola Liljedahl
> 
> 
> 
> On Sat, 15 Jan 2000 17:48:18 +0100 Ola Liljedahl <olli@enea.se> writes:
> > Scott A Sumner wrote:
> > > 
> > > Speaking of being out of prom space, from what I've been able to
> > > determine, gcc is a pig when it comes to code space.
> > > 
> > > My application is buildable under two toolsets, Fiddes' gcc 
> > version 4 and
> > > Mentor Graphics Microtec Research version 4.4.  Here's a 
> > comparison of
> > > code (ROM) sizes with the two toolsets:
> > > 
> > > gcc:  655KB
> > > Microtec:  560KB
> > > 
> > > As you can see, the code produced by gcc is almost 17% 
> > bigger--quite a
> > > disparity!
> > > 
> > > Anyone have an opinion as to why this is so?
> 
> ------
> Want more information?  See the CrossGCC FAQ,
> http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to
> crossgcc-unsubscribe@sourceware.cygnus.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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