How can I write a builtin func?

WANG.Jiong wong.kwongyuan@gmail.com
Fri Dec 10 06:56:00 GMT 2010


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



More information about the Gcc mailing list