Bill,
That is correct.
There are no changes to the header file function declaration, just in the 
platform implementation.

I couple of other points:
- I found that –O2 was not sufficient to get the functions I wanted to be 
inlined.
- According to the link that Mike posted:    
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
   “Combining -flto with -g is currently experimental and expected to produce 
unexpected results.”
   However, I have been able to use –g and debugging information.

Thanks, Leonard.

From: Bill Fischofer [mailto:[email protected]]
Sent: Tuesday, January 20, 2015 3:23 PM
To: Leonard Bush
Cc: [email protected]
Subject: Re: [lng-odp] benefits of inline functions

Thanks Leonard.  Just so I understand.

ODP API file declares function as today,without any attributes

odp_return_t odp_foo(...);

Your implementation of odp_foo() is written as:

odp_return_t odp_foo(...) __attribute__((always_inline))
{
        ...implementation of odp_foo()
}

Your makefile then specifies

-Wno-attributes -flto -O3

and this results in application calls to odp_foo() being inlined?

That sounds perfect and has the additional advantage of not requiring header 
file gymnastics.


On Tue, Jan 20, 2015 at 10:17 AM, Leonard Bush 
<[email protected]<mailto:[email protected]>> wrote:
I have platform implementation of functions that I want in-lined.

I write the function with this:  __attribute__((always_inline))
I run gcc with these CFLAGS:
 -Wno-attributes  (needed since I define attributes!)
 -flto and -O3 (so these functions will be in-lined, if possible, at link time)

The linking is noticeably slower, but there is a material performance benefit
in the run-time of my ODP application.

I do not know how this might fit into the ODP architecture, but I find it
much easier to implement and support than restricting inline to static
functions in single files or "inline" header files.
Thanks, Leonard.


_______________________________________________
lng-odp mailing list
[email protected]<mailto:[email protected]>
http://lists.linaro.org/mailman/listinfo/lng-odp

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to