Where to attach backend builtin decl?
Sa Liu
SALIU@de.ibm.com
Wed Feb 27 22:36:00 GMT 2008
I'm woking on the project to call backend builtin functions in Fortran.
The backend builtins are C routines and I'll use ISO C binding to bind
them with Fortran routines.
The builtins are initialized by function gfc_builtin_function in
f95-lang.c. Then the function pushdecl keeps the backend builtin decl in
the current_binding_level. When resolving the function, where can I find
these decls again?
The following is an example:
module spu_intrinsics
use, intrinsic :: iso_c_binding
implicit none
contains
function builtin_spu_add_int(a, b) result(c) bind(c,
name="__builtin_spu_add_1")
integer (c_int), intent(in):: a(4), b(4)
integer(c_int) :: c(4)
end function builtin_vec_add_int
end module spu_intrinsics
The fortran function builtin_spu_add_int is bound with the backend builtin
__builtin_spu_add_1. When resolving the symbol builtin_spu_add_int, the
frontend can not find its decl. In trans-decl.c function
gfc_get_extern_function_decl builds a new decl for the this function. I
tried to set the fndecl to the builtins backend decl, but it seems not
working. The question is where to attach the decl of the C bultin
function, in order to generate inline code for the fortran program?
Thanks!
Sa
More information about the Fortran
mailing list