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] FOR_EACH_RTX construct to replace for_each_rtx


I don't like the fact that this isn't an exact drop-in replacement
of FOR_EACH_RTX.  I very much feel that the first version of this
change to be installed should support *exactly* the same interface.

This is not exactly possible; for_each_rtx has a return value, FOR_EACH_RTX cannot for obvious reasons.


Nor should you have done any simultaneous renamings of functions.

Keeping the for_each_rtx idiom of using global variables or structs-for-parameters (a la replace_label) would not have improved readability. I tried to be as thorough as I could in the changelog.


Basically, the changes are:
- wrap the body of the xxx_1 function in FOR_EACH_RTX
- change "return -1" to "rtx_skip_iter (&iter); continue;"
- change "return 0" to "continue;"
- leave other returns in place
- remove the for_each_rtx in the caller (typically lacking a _1 suffix)
- if that was all the caller did, rename the function and polish the way the "data" parameter is handled.


As I said, I actually did not think to do this for 4.0, which also made me more liberal in polishing the resulting code.

Paolo


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