On 09/20/2013 04:08 AM, Richard Biener wrote:
On Thu, Sep 19, 2013 at 6:56 PM, Andrew MacLeod <amacl...@redhat.com> wrote:
On 09/19/2013 09:24 AM, Andrew MacLeod wrote:

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....

Thoughts?
Andrew
Anyway, here is a patch which does that and a bit more.  I didn't rename
build_assign() to ssa_build_assign()..   even though those are the only kind
actually created right now.   we can leave that for the day someone actually
decides to flush this interface out, and maybe we'll want to pass in
gimple_tmps and call them from front ends or other places... then it would
have to be renamed again. So I just left it as is for the moment, but that
could be changed.

I also moved gimple_replace_lhs() to tree-ssa.c and renamed it
ssa_replace_lhs(). It calls insert_debug_temp_for_var_def() from tree-ssa.c
and that only works with the immediate use operands.. so that is an SSA
specific routine, which makes this one SSA specific as well.

Those 2 changes allow tree-ssa.h to no longer be included, it is replaced
with tree-flow.h.   Some preliminary work to enable removing immediate use
routines out of tree-flow.h include:

struct count_ptr_d, count_ptr_derefs(), count_uses_and_derefs() also get
moved to tree-ssa.c since those are also require the immediate use
mechanism, and thus is also SSA dependent.

This bootstraps on x86_64-unknown-linux-gnu and has no new regressions.
OK?
Can you move the builders to asan.c please?  From a quick glance it seems
to have various issues so it shouldn't be used (I wonder who approved them
in the end ... maybe it was even me).

ssa_replace_lhs sounds odd (a 'SSA' has a lhs?), but maybe it's just me.
I'd have chosen gimple_replace_ssa_lhs?
That sounds better.  done.

And I also think a seperate file for those builders is probably best... here's a patch with those changes.. New files called gimple-builder.[ch]... Then diego can eventually do whatever his grand vision for them is. I minimized the includes.

bootstraps and rerunning tests.  OK?

Andrew

Reply via email to