This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Inserting function calls


In create_omp_child_function, an identifier for the new function is
created.  We then create a call to it using build_function_call_expr in
expand_parallel_call.

Ok so that's what I saw, is this call necessary for what I'd need :


decl = lang_hooks.decls.pushdecl (decl);


Then simplifying the problem, I just want to call a void _foo(void) function so, taking from create_omp_child_function and expand_parallel_call I did this :


type = build_function_type_list (void_type_node, NULL_TREE);

decl = build_decl (FUNCTION_DECL, "_foo" , type);

TREE_STATIC (decl) = 1;
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 0;
TREE_PUBLIC (decl) = 0;
DECL_UNINLINABLE (decl) = 1;
DECL_EXTERNAL (decl) = 0;
DECL_CONTEXT (decl) = NULL_TREE;
DECL_INITIAL (decl) = make_node (BLOCK);

t = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
DECL_ARTIFICIAL (t) = 1;
DECL_IGNORED_P (t) = 1;
DECL_RESULT (decl) = t;

t = build_decl (PARM_DECL, NULL_TREE, void_type_node);
DECL_ARTIFICIAL (t) = 1;
DECL_ARG_TYPE (t) = void_type_node;
DECL_CONTEXT (t) = current_function_decl;
TREE_USED (t) = 1;
DECL_ARGUMENTS (decl) = t;

tree list = NULL_TREE;
tree call = build_function_call_expr (decl, NULL);
gimplify_and_add(call,&list);

bsi_insert_before(&bsi, list, BSI_CONTINUE_LINKING);


But this gives me this error when I try compiling it


hello.c:18: internal compiler error: tree check: expected identifier_node, have obj_type_ref in special_function_p, at calls.c:475

Any ideas ?
Jc

-----------------------------------------------------
ÂDegskalle There is no point in arguing with an idiot, they will just
drag you down to their level and beat you with experience

RÃfÃrence: http://www.bash.org/?latest
-----------------------------------------------------



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]