This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Middle-End function/ function pointer generation
- From: Philip Herron <redbrain at gcc dot gnu dot org>
- To: Johannes Ziegenbalg <johannes dot ziegenbalg at googlemail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 24 Jul 2012 00:53:44 +0100
- Subject: Re: Middle-End function/ function pointer generation
- References: <500B02E3.6050502@googlemail.com>
On 21 July 2012 20:28, Johannes Ziegenbalg
<johannes.ziegenbalg@googlemail.com> wrote:
> Hi guys,
>
> I hope I'm right here. Currently I'm developing a GCC plugin and therefore I
> need to generate some code which should looks like:
>
> typedef void (bar_fn_t)(uint32_t *);
>
> static bar_fn_t *
> resolve_bar(void)
> {
> return bar;
> }
>
> The function "bar" is defined in the same file. The typedef is not a big
> deal I think, it's something like: build_pointer_type(TREE_TYPE
> (current_function_decl))
> But, I stuck at this function generation, especially the return part.
>
> Thanks for your help!!
>
> Regards
> Johannes Z.
>
Would you not be doing something like build_function_type then and
just use that as the type i think that can work.
I have code in my front-end where i use build_fold_add_expr (fndecl)
to pass function pointers about and i think i am just using the
function type as the type if it needs assigned to something but not
100% sure.
--Phil