This is the mail archive of the gcc@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: new register allocator and HARD_REGNO_CALL_PART_CLOBBERED



On Tuesday, May 13, 2003, at 03:40 PM, Joern Rennecke wrote:


Daniel Berlin wrote:

On Tue, 13 May 2003, Joern Rennecke wrote:


Daniel Berlin wrote:
No, they are invalid. It frequently gives us regs we can't use *at all*
(IE regardless of call status, they just aren't even okay for the
mode at all).

That is a different problem then, which indeed would be a bug in regclass.


You can do this ahead of time, by looking at the modes of the pseudos
you want to allocate in the register.

Which is what i suggested, rather than putting it in get_free_reg. The portion of code we have now that looks at the modes is regclass. So i suggested it goes there.

That would require to create new register classes to cover all
call-used/call-saved boundaries, both for full and partial saves, plus the
resultant unions and intersections.
No it wouldn't require new regclasses.
It simply requires giving a HARD_REG_SET of preferred registers, rather than a register class.
This is what the new register allocator converts the regclass into anyway.
The whole notion of explicit register classes hardly ever meshes well with reality.
What we really need is for each port to have a function, that when passed a struct df (or something) with dataflow info already generated, gives us two arrays. First, for each pseudo, a valid list of preferred usable registers (in terms of constraints like call clobbered or not, not in terms of non-conflicting with any other pseudo's set of registers)for that pseudo. Second, a valid list of *all* usable registers for the pseudo.
This is basically what web_class ends up doing.
We really shouldn't be trying to shoehorn pseudos into a fixed set of register classes for no good reason.


So it seems that choose_spill_colors should take HARD_REGNO_CALL_PART_CLOBBERED
into account, except that we are short of a mode there.
No, this is also wrong.
Note that choose_spill_colors uses the usable_regs. Usable_regs should *not* have any unusable regs in it.
The only reason we have to test HARD_REGNO_MODE_OK *now* is because some ports (or regclass itself) are broken, so we end up with unusable regs in usable_regs (since it's initialized based on register class).
Get it?
It was to work around broken ports, but it shouldn't be necessary.



Going back a bit in this thread, I see: Herman ten Brugge:
I do not think the problem is in df.c. The code in df.c walks through the
rtl and sets clobbered/used register info. We do not yet know what mode
the hard registers will get (reg_raw_mode can not be used here). The mode
is assigned in the new-ra pass.

I must say that I don't understand why reg_raw_mode can not be used there.
reg_raw_mode should be HFmode for the c4x registers in question, and
Dale Johannesen's patch to df_insn_refs_record should find the calls/register
combinations that could potentially cause a problem.


It's actually my patch, sent to Dale privately.


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