This is the mail archive of the gcc-patches@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: [patch] Separate immediate uses and phi routines from tree-flow*.h


On Fri, Sep 27, 2013 at 8:36 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
> On 09/27/2013 04:44 AM, Richard Biener wrote:
>>
>> On Thu, Sep 26, 2013 at 6:07 PM, Andrew MacLeod <amacleod@redhat.com>
>> wrote:
>>
>>>
>>> Ugg. I incorporated what we talked about, and it was much messier than
>>> expected :-P.  I ended up with a chicken and egg problem between the
>>> gimple_v{use,def}_op routines in gimple-ssa.h  and the operand routines
>>> in
>>> tree-ssa-operands.h.   They both require each other, and I couldn't get
>>> things into a consistent state while they are in separate files.  It was
>>> actually the immediate use iterators which were requiring
>>> gimple_vuse_op()...  So I have created a new ssa-iterators.h file  to
>>> resolve this problem.  They build on the operand code and clearly has
>>> other
>>> prerequisites, so that seems reasonable to me...
>>>
>>> This in fact solves a couple of other little warts. It allows me to put
>>> both
>>> gimple_phi_arg_imm_use_ptr() and phi_arg_index_from_use() into
>>> tree-phinodes.h.
>>>
>>> It also exposes that gimple.c::walk_stmt_load_store_addr_ops() and
>>> friends
>>> actually depend on the existence of PHI nodes, meaning it really belongs
>>> on
>>> the gimple-ssa border as well. So I moved those into gimple-ssa.c
>>
>> It doesn't depend on PHI nodes but it also works for PHI nodes.  So
>> I'd rather have it in gimple.c.
>
> OK, well, the code depends on using PHI node routines to compile then :-)
>
> so poking around and thinking out it a it more, how does this work for you?
>
> I moved the phi_ routines which act as simple accessors to the PHI statement
> kind from tree-flow-inline.h into gimple.h.  I think this makes sense, they
> access elements of the statement.   the phi routines which actually do
> something other than that I put into tree-phinodes.[ch].   So this puts no
> SSA prerequisites into gimple.h.
>
> The park of the walk_* routines whch was causing issues was the dependency
> on PHI_ARG_DEF macro which was using the immediate use operands,
>
> #define PHI_ARG_DEF_PTR(PHI, I) gimple_phi_arg_imm_use_ptr ((PHI), (I))
> #define PHI_ARG_DEF(PHI, I)     USE_FROM_PTR (PHI_ARG_DEF_PTR ((PHI), (I)))
>
> which as I reflected upon it, this really makes very little sense...  I
> changed this to
>
> #define PHI_ARG_DEF(PHI, I)     gimple_phi_arg_def ((PHI), (I))
>
> And that resolved the problem nicely...  another bit of leftover stupidity I
> guess.    I changed the code to call the routine directly instead of using
> the macro so it wont be dependant on tree-ssa-operands.h.  I'll eventually
> revisit tree-ssa-operands.h and try to fix up those macros.  The names are
> confusing with the gimple versions for some of these things. the
> PHI_ARG_DEF_PTR macro there is not compatible with gimple_phi_arg_def since
> it returns a use_operand_p.
>
> With those changes this is the patch.  Bootstraps on
> x86_64-unknown-linux-gnu and running regressions, assuming there are no
> issues.. OK?

Yes.

Thanks,
Richard.

> Andrew
>
>
>
>


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