[coreboot] [patch][v2] remove inline functions in fam10 source

Marc Jones Marc.Jones at amd.com
Fri Apr 25 22:05:13 CEST 2008


Segher Boessenkool wrote:
>> Remove inline from FAM10 CPU initialization functions. This should 
>> save some ROM space.
> 

....

>> -static inline u32 read_cr4(void)
>> +static u32 read_cr4(void)
>>  {
>>      u32 cr4;
>>      __asm__ volatile ("movl %%cr4, %0" : "=r" (cr4));
> 
> Things like these (not exhaustive) are usually *smaller* when inlined;
> they compile to a single machine instruction (or two or so), and don't
> have the space overhead for setting up a call (saving stuff to stack,
> etc.)
> 
> But don't take my word for it, just measure it after every change :-)

Segher,

Thanks for the comments. I think you are right about  _asm_ inline 
instructions should be smaller than a function call. It turns out that 
none of these changes resulted in a ROM size decrease with my tools. My 
guess is the GCC inlined them anyway.

gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
GNU ld (GNU Binutils for Ubuntu) 2.18


Here is a revised version of patch.


-- 
Marc Jones
Senior Firmware Engineer
(970) 226-9684 Office
mailto:Marc.Jones at amd.com
http://www.amd.com/embeddedprocessors
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: inline.patch
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20080425/29502e7a/attachment.ksh>


More information about the coreboot mailing list