This is the mail archive of the
mailing list for the GCC project.
Re: How can I generate a new function at compile time?
- From: Benedikt Huber <benedikt dot huber at theobroma-systems dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Wed, 30 Apr 2014 14:16:20 +0200
- Subject: Re: How can I generate a new function at compile time?
- Authentication-results: sourceware.org; auth=none
- References: <2C1DB30D-9984-48C5-A7DF-19FF419C6E0F at theobroma-systems dot com> <CAFiYyc21CDRRAn44fzKsfH=C+G5NB-_94X4CBjHZPf7Hsno1mg at mail dot gmail dot com>
Thank you for the hint. I managed to extract the basic blocks to a helper function and put
a call to this helper function at the place of the removed basic blocks in the original function.
All this is done with help of move_sese_region_to_fn.
The helper function is created similar to create_omp_child_function.
I had a successful compilation run when I moved the pass just after pass_build_cgraph_edges.
The problems I am still facing is with passing of parameters.
I imagine that variables used in the helper function which are defined in the original function
should become in-out parameters to the helper function.
For that I wanted to use DECL_ARGUMENTS and the arguments to gimple_build_call or gimple_build_call_vec.
However, how do I find the undefined variables in the helper function and how do I find out to
which variables in the original function they belong. In particular, how do I get the names and order
in the argument list right?
Do you know of some equally useful examples?
To me it seems that what is done in omp-low.c (expand_omp_taskreg or expand_omp_target) is not
exactly what I need.
Thank you again and best regards,