roy rosen <roy.1ro...@gmail.com> writes:

>> You build a RECORD_TYPE holding the fields you want to return.  You
>> define the appropriate builtin functions to return that record type.
>
> How is that done? using define_insn? How do I tell it to return a struct?
> Is there an example I can look at?

A RECORD_TYPE is what gcc generates when you define a struct in your
source code.  For an example of a backend building a struct, see, e.g.,
ix86_build_builtin_va_list_abi.

When you define your builtin functions in TARGET_INIT_BUILTINS you
specify the argument types and the return type, typically by building a
FUNCTION_TYPE and passing it to add_builtin_function.  To define a
builtin which returns a struct, just arrange for the return type of the
FUNCTION_TYPE that you pass to add_builtin_function be the RECORD_TYPE
that you built.

Ian

Reply via email to