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]

Re: try_replace_reg improvement


> This code needs a fair amount of work.  You've created something that is
> far more difficult to read and understand than it should be.  I have no 
> idea why you made the code as complex as you did.
OK.. Next time I will re-read code at morning...
> 
> I don't see the need to handle update of the notes separately when we have
> a valid replacement for the insn vs when we do not have a valid replacement.
This has envolved from original code, that wasn't doing the replacement in
sucessfull case.. Sorry :)
I can join this together.

But we have IMO second posibility - add replacement to the
validate_change stuff in recog, where it belongs IMO (once you replace code,
I think you ought to update the notes...)
Then the code will be still twice, but in case we will use replace_src in
other passes as well, we would not need to do the notes manually.
> It seems to me you should always do that replacement.  That will simplify
> the code quite a bit.
> 
> You also have to be careful about having something like (REG_EQUAL, (reg X))).
> A REG_EQUAL should be an expression or constant, not a naked register.
OK.
When such note can be created?
If I am changing move insn, the validate_change ought to succeed (and we will
not get REG_EQUAL insn).
If I am changing set with the expression, the REG_EQUAL ought not to be
(reg X) so I will not get it by replacing one register by another.
Am I missing something?
> 
> So, while I generally like the idea, I think the code you wrote is, well,
> a minor mess and will create notes like (REG_EQUAL, (reg X)), which is a 
> no-no.
> 
> Finally, I would expect the vast majority of the time if the insn already has
> a note, that it will reference FROM, so I believe calling reg_mentioned_p is
> just a waste of time.
What I was trying to avoid is following situation:
pass 1: the cprop does propagation on insn X, validate_change fails, I
create the note.
pass 2: the cprop does propagation again on insn X (because it still contains
old register in the PATTERN), I attempt to update note, return 1 (succeed)
so cprop will think it has succeeded with the replacement.
In case we will want to do cprop more times until it converges, we will
get unnecesary looping and also we get extra "replaced" messages in dumps.

Thank you for looking at my patches :)
Honza
> 
> jeff

-- 
                       OK. Lets make a signature file.
+-------------------------------------------------------------------------+
|        Jan Hubicka (Jan Hubi\v{c}ka in TeX) hubicka@freesoft.cz         |
|         Czech free software foundation: http://www.freesoft.cz          |
|AA project - the new way for computer graphics - http://www.ta.jcu.cz/aa |
|  homepage: http://www.paru.cas.cz/~hubicka/, games koules, Xonix, fast  |
|  fractal zoomer XaoS, index of Czech GNU/Linux/UN*X documentation etc.  | 
+-------------------------------------------------------------------------+


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