On 22/04/2025 8:58 pm, Stefano Stabellini wrote:
> On Tue, 22 Apr 2025, Andrew Cooper wrote:
>> On 22/04/2025 8:46 pm, Stefano Stabellini wrote:
>>> On Tue, 22 Apr 2025, Andrew Cooper wrote:
>>>> Compilers estimate the size of an asm() block for inlining purposes.
>>>>
>>>> Constructs such as ALTERNATIVE appear large due to the metadata, depsite 
>>>> often
>>>> only being a handful of instructions.  asm inline() overrides the 
>>>> estimation
>>>> to identify the block as being small.
>>>>
>>>> This has a substantial impact on inlining decisions, expected to be for the
>>>> better given that the compiler has a more accurate picture to work with.
>>>>
>>>> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
>>> Hi Andrew,
>>>
>>> If we are going to use asm_inline, please add a note to
>>> docs/misra/C-language-toolchain.rst where we keep record of all the
>>> language extensions we use.
>> It's just asm(), and that's already discussed.
>>
>> I'm not sure what else you think is warranted.
>
> If it is just asm() then there is nothing to do. We only need to
> document extensions to the language, nothing else. Many of them are
> already documented under docs/misra/C-language-toolchain.rst (see for
> instance asm and __asm__).
>
> I see the critical part of the patch for this question is:
>
>> +#if CONFIG_CC_HAS_ASM_INLINE
>> +# define asm_inline asm __inline
>> +#else
>> +# define asm_inline asm
>> +#endif
> it looks like __inline is an extension ?

That's just inline.  (It's an alternative spelling, and we discuss those
too.)

The reason it's not plain "asm inline" is because of the (deviated)
"#define inline inline __init", where an eventual "asm inline __init
(..." is a syntax error.

~Andrew

Reply via email to