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?).
- From: Ian Lance Taylor <iant at google dot com>
- To: Feng LI <nemokingdom at gmail dot com>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Sun, 22 Apr 2012 10:29:02 -0700
- Subject: Re: target specific builtin expansion (middle end and back end definition inconsistence problem?).
- References: <CAPekQOqg=9qzYvjUtvs3Y906mC4-N=0okuxT+NCgujUcfTu63Q@mail.gmail.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.
Ian