This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: gimple build interface
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Diego Novillo <dnovillo at google dot com>
- Date: Fri, 20 Sep 2013 10:02:45 +0200
- Subject: Re: gimple build interface
- Authentication-results: sourceware.org; auth=none
- References: <523AFA0F dot 4070305 at redhat dot com>
On Thu, Sep 19, 2013 at 3:20 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
> I'm looking at pulling ssa specific bits out of gimple.c so that it doesn't
> require the ssa headers, and can concentrate on basic gimple support. I
> stumbled across the "new" build interface in gimple.c consisting of these
> routines:
>
> * Helper functions to build GIMPLE statements. */
> tree create_gimple_tmp (tree, enum ssa_mode = M_SSA);
> gimple build_assign (enum tree_code, tree, int, enum ssa_mode = M_SSA);
> gimple build_assign (enum tree_code, gimple, int, enum ssa_mode = M_SSA);
> gimple build_assign (enum tree_code, tree, tree, enum ssa_mode = M_SSA);
> gimple build_assign (enum tree_code, gimple, tree, enum ssa_mode = M_SSA);
> gimple build_assign (enum tree_code, tree, gimple, enum ssa_mode = M_SSA);
> gimple build_assign (enum tree_code, gimple, gimple, enum ssa_mode = M_SSA);
> gimple build_type_cast (tree, tree, enum ssa_mode = M_SSA);
> gimple build_type_cast (tree, gimple, enum ssa_mode = M_SSA);
>
>
>
> currently only used in asan.c
>
> the routine giving me trouble is:
>
> tree
> create_gimple_tmp (tree type, enum ssa_mode mode)
> {
> return (mode == M_SSA)
> ? make_ssa_name (type, NULL)
> : create_tmp_var (type, NULL);
> }
>
>
> Other than one other routine that doesn't belong in gimple.c anyway, this
> call to make_ssa_name() is the only thing preventing gimple.c from not
> requiring tree-ssa.h.
>
> This new interface is really trying to bridge the gap between gimple and ssa
> and simplify the life of anyone needing to generate a series of
> instructions. Before actually making any code changes, I wanted to get a
> consensus on the future direction of this interface.
>
> I see the benefit in the streamlined asan.c code, but I detest that
> ssa_mode flag. And as long as it supports SSA, I don't think it should be
> in gimple.c.
>
> I think this is of most use to ssa passes that need to construct code
> snippets, so I propose we make this ssa specific and put it in tree-ssa.c
> (renaming it ssa_build_assign), *OR* we could leave it general purpose and
> put it in its own set of files, gimple-ssa-build.[ch] or something that
> crosses the border between the two representations.
>
> I'd also suggest that the final optional parameter be changed to tree *lhs
> = NULL_TREE, which would allow the caller to specify the LHS if they want,
> otherwise make_ssa_name would be called. If we want to leave it supporting
> both gimple and ssa, then anyone from gimple land could pass in a gimple LHS
> variable thus avoiding the call to make_ssa_name....
Well, I didn't like this new interface at all ... it should have
consolidated the
existing one.
Richarrd.
> Thoughts?
> Andrew