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] Fix PR target/33923


Eric Botcazou wrote:
	PR target/33923
	* config/ia64/ia64.h (CANNOT_CHANGE_MODE_CLASS): Forbid mode changes
	for registers in BR_REGS class.

I found this a bit puzzling. HARD_REGNO_MODE_OK says that BR_REGS can only hold DImode, so it seems strange that we need CANNOT_CHANGE_MODE_CLASS support here. I tried debugging this myself.


The underlying problem here is that an SImode register got tied to a DImode register, and then the DImode register got allocated to BR_REGS, thus causing the invalid SImode BR_REGS reference. This makes sense. The MODES_TIEABLE_P docs clearly say that MODES_TIEABLE_P must return false if there is any register class that accepts one mode but not the other. BR_REGS accepts DImode but not SImode, so MODES_TIEABLE_P should return false in this case. I did verify that this fixes the problem. However, the docs also say that returning false for integer mode combinations is a very bad idea, and that you should try an alternative solution if possible. Which is what your patch does by using CANNOT_CHANGE_MODE_CLASS.

The only minor criticism I have is that I'd like the comment to mention the MODES_TIEABLE_P connection, to make it clear why the BR_REGS support in CANNOT_CHANGE_MODE_CLASS is necessary. Otherwise the patch doesn't make much sense to me. The patch is OK with that change.

In theory, we may have the same problem with AR_REGS, the application registers. These registers also only allow DImode. However, the register allocator shouldn't be using those, so it may not be a real problem. I'm not going to worry about this. If it pops up, we can deal with it then.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com



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