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

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Fri Apr 25 23:10:47 CEST 2008


On 25.04.2008 22:05, Marc Jones wrote:
> 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.

Thanks for doing this work!

> Remove inline from FAM10 CPU initialization functions.
> This doesn't save any space for me but it is the right thing to allow GCC to optimize.
>
> Signed-off-by: Marc Jones <marc.jones at amd.com>
>   

Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>


Regards,
Carl-Daniel




More information about the coreboot mailing list