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: [tree-ssa] Virtual operands in tree-tailcall


In message <20040107175616.GA22631@atrey.karlin.mff.cuni.cz>, Zdenek Dvorak wri
tes:
 >Hello,
 >
 >>  >	* tree-tailcall.c (eliminate_tail_call): Add phi nodes for the call
 >>  >	vdefs.
 >> You seem to have some gratutious changes included in this patch.  For
 >> example, why did you reverse the loops in the first hunk?  If there's
 >> a reason you did that, then you should indicate why you changed the
 >> iteration order of those loops.
 >
 >since it is no longer true that every phi node corresponds to the
 >function's arguments, we must look for a phi for the argument, not
 >vice versa.
 >
 >> Consider this pre-approved after you update the comment above and after
 >> you either revert the gratutious changes in loop order noted above or
 >> document the change to the loop ordering.
 >
 >I am not really sure how to document this.  I may add a comment that
 >we are looking for the phi node for the argument, but it is obvious
 >from the code anyway.
Use what you wrote above since that states pretty clearly why you had
to change the loop.   ie, something like:

/* Not every PHI node corresponds to a function argument, so we search
   for a PHI corresponding to each argument rather than searching for
   which argument a PHI node corresponds to.  */

Do you see how this makes the code more readable and more maintainable in
the long term?   What is obvious to the author is not always obvious to
someone else reading the code.  Hell, it's even guaranteed to be obvious
to the author later.


jeff



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