This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: target specific builtin expansion (middle end and back end definition inconsistence problem?).
Feng LI <nemokingdom@gmail.com> writes:
>>>>> Yes, you are right. But how could I reference to a backend defined builtin
>>>>> function in the middle end (I need to generate the builtin function in the
>>>>> middle end and expand it in x86 backend)?
>>>>
>>>> If the function doesn't have a machine-independent definition, then use
>>>> a target hook.
>>>
>>> Then I remove the duplicate builtin definition in x86 backend.
>>> I define the builtin function with built_in_class as BUILT_IN_MD in
>>> builtins.def.
>>
>> Sorry, I meant use a target hook to actually generate the call
>> expression. ÂThe target hook can refer to the target-specific builtin
>> function.
> Just for confirmation, do you mean by calling this hook:
> targetm.builtin_decl (unsigned code, bool initialized_p)
> in the middle end for getting the builtin definition in the backend?
>
> Probably I'm asking a silly question, when is the time of the initialization
> of the backend builtin functions. I'm refering it in gcc middle end, near
> OPENMP expansion (omp-low.c) pass.
No, I mean adding a new target hook build_my_magic_call and calling
that. That target hook would be build a call to the function.
You haven't really described the background, so I suppose I don't know
if this is appropriate. It's not the right approach if you want to
contribute this back to GCC mainline, but then of course GCC mainline
also doesn't want a target-specific function in builtins.def.
Ian