PATCH: Add ifunc attribute

Richard Guenther richard.guenther@gmail.com
Fri Jun 26 16:31:00 GMT 2009


On Fri, Jun 26, 2009 at 6:16 PM, H.J. Lu<hjl.tools@gmail.com> wrote:
> On Fri, Jun 26, 2009 at 9:12 AM, Richard
> Guenther<richard.guenther@gmail.com> wrote:
>> On Fri, Jun 26, 2009 at 6:03 PM, H.J. Lu<hjl.tools@gmail.com> wrote:
>>> On Fri, Jun 26, 2009 at 8:47 AM, Paolo Bonzini<bonzini@gnu.org> wrote:
>>>>> How do you propose to support C++?
>>>>
>>>> Why wouldn't Roland's proposal work with C++?
>>>>
>>>
>>> I am not sure it will work for C++, especially for
>>> member functions.
>>
>> asm() with a properly mangled name should work.
>>
>> Richard.
>
> Here is a C++ example.  Option 3 works nicely.

Does it work with virtual functions?

> ---
> class ifunc
> {
> private:
>  int foo1 (int);
>  int foo2 (float);
>
> public:
>  int foo (int);
>  int foo (float);
>  int bar (int);
>  int bar (float);
> };
>
> int
> __attribute__ ((ifunc))
> ifunc::foo (int)
> {
>  return &ifunc::foo1;
> }
>
> int
> __attribute__ ((ifunc))
> ifunc::foo (float)
> {
>  return &ifunc::foo2;
> }
>
> int
> ifunc::bar (int x)
> {
>  return foo (x);
> }
>
> int
> ifunc::bar (float x)
> {
>  return foo (x);
> }
> ---
>
> How do you make it to work with other options?
>
> --
> H.J.
>



More information about the Gcc-patches mailing list