This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: target specific builtin expansion (middle end and back end definition inconsistence problem?).


Hi Ian,

2012/4/22 Ian Lance Taylor <iant@google.com>:
> Feng LI <nemokingdom@gmail.com> writes:
>
>> I generate builtin function directly in the middle end and and expand
>> the builtin function in the x86 backend to certain set of
>> instructions.
>>
>> I've defined x86 builtin functions in the gcc backend like this:
>>
>> { OPTION_MASK_ISA_TSTAR | OPTION_MASK_ISA_64BIT,
>> CODE_FOR_tstar_create, "__builtin_ia32_tcreate", IX86_BUILTIN_TCREATE,
>> UNKNOWN, (int) PVOID_FTYPE_UINT_UINT },
>> and corresponding define_insn in .md file.
>>
>> This works with .c file as a input, and it'll generate the assemble
>> code I expect.
>>
>> But if I try to generate the builtin functions directly in GCC middle
>> end, by using DEF_BUILTIN
>>
>> ? DEF_BUILTIN (BUILTIN_TCREATE, "__builtin_ia32_tcreate", BUILT_IN_MD,
>> ? ? ? ? ? ? ? ? ? ? ? ? ?BT_FN_PTR_SIZE_SIZE, BT_FN_PTR_SIZE_SIZE, ? ?\
>> ? ? ? ? ? ? ? ? ? ? ? ? ?false, true, true, ATTRS, false, flags)
>
> It doesn't make sense to add a x86-specific builtin function to
> builtins.def. ?So I'm not sure what you are trying to accomplish with
> this change.
>
>> #0 ?fancy_abort (file=0xb45b0f "../../gcc/c-decl.c", line=3569,
>> function=0xb45a10 "c_builtin_function") at ../../gcc/diagnostic.c:892
>> #1 ?0x000000000049634f in c_builtin_function (decl=0x7ffff7fb4500) at
>> ../../gcc/c-decl.c:3569
>
> This abort is
>
> ?/* Should never be called on a symbol with a preexisting meaning. ?*/
> ?gcc_assert (!I_SYMBOL_BINDING (id));
>
> That makes it sound like you are defining the function in both the x86
> backend and also in builtins.def. ?Don't do that.

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)?

Thanks,
Feng

>
> Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]