How can I write a builtin func?

Liu proljc@gmail.com
Fri Dec 10 07:39:00 GMT 2010


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.



More information about the Gcc mailing list