This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How can I write a builtin func?
- From: Liu <proljc at gmail dot com>
- To: "WANG.Jiong" <wong dot kwongyuan at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 10 Dec 2010 15:39:16 +0800
- Subject: Re: How can I write a builtin func?
- References: <AANLkTinX8JpwepsoTQDFUAScSmmJ8yORd2WZ1ALZBaeR@mail.gmail.com> <4D01CDE1.30308@gmail.com>
2010/12/10 WANG.Jiong <wong.kwongyuan@gmail.com>:
> On 12/10/2010 02:17 PM, Liu wrote:
>
> Hi all,
> I'm porting gcc to a MIPS-based DSP, I need write some builtin
> func for some insns, but I can't find a doc., any one should help me?
> Show me a example please? Thanks very much.
>
> Liu.
>
>
> Maybe you should at least implement the following two hooks:
>
> TARGET_INIT_BUILTINS
> ????? ---> to do some initialization
>
> TARGET_EXPAND_BUILTIN
> ????? ---> to expand builtin related tree to rtl
> ????????????? I suggest you define some UNSPEC rtl,? like:
> ???????????????? (define_insn "xxx"
> ???????????????????? [set (match_operand: .....)
> ???????????????????????????? (unspec:.... [...] UNSPEC_XXX)]
> ????????????????? ......
> ??????????????? )
>
> ????????????? and then expand builtin tree to these rtl by calling the
> related gen_xxx
>
> Suggest you to see s390's related hook implementation.
>
> --
> Best,
> Wong.KwongYuan
Dear Wong.KwongYuan,
Thank you very much! Your answer is very clear!
I'll look into it, maybe you will help me more when I get more problems.
Thanks again!
Liu.