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

Marc Jones Marc.Jones at amd.com
Fri Apr 25 23:35:13 CEST 2008


Carl-Daniel Hailfinger wrote:
> 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
> 

r3266

Thanks,
Marc

-- 
Marc Jones
Senior Firmware Engineer
(970) 226-9684 Office
mailto:Marc.Jones at amd.com
http://www.amd.com/embeddedprocessors





More information about the coreboot mailing list