On 1/23/25 8:49 AM, Stefan Schulze Frielinghaus wrote:
On Sat, Jan 18, 2025 at 09:36:14AM -0700, Jeff Law wrote:
[...]
Do we detect conflicts between a hard register constraint and another
constraint which requires a singleton class?  That's going to be an error I
suspect, but curious if it's handled.

That is a good point.  Currently I suspect no.  I will have a look.
Thanks.  It's not the most important thing on our plate, but given the way
x86 is structured we probably need to do something sensible here.

I also worry a bit about non-singleton classes that the target may have
added to CLASS_LIKELY_SPILLED_P, though unlike the singleton case, there's
at least a chance these will work, albeit potentially generating poor code
when an object needs spilling.  I also don't think it's terribly common to
add non-singleton classes to that set.

I was first worried that the single register class construct is somewhat
special.  To me, it turns out that they behave very similar to my
current draft.  Basically during LRA in process_alt_operands() I'm
installing
Yea, I would think they'd largely behave like your proposal. Given the presence of a singleton class one could use that to write an ASM just as effectively as your hard register proposal. And satisfying the constraints should boil down to the same basic process.

What your proposal does is give users fine grained control as-if the port had a singleton class for every register -- without us having to add all those pesky register classes.

[ ... ]


(I have tested those only on x86_64 so far but I expect them to work on
32-bit, too, module int128)

I will include those, and of course, similar ones for constraints
b,c,d,S,D in a future patch revision.  If there is any other target with
non-ordinary register classes/constraints/whatnot just let me know and I
will have a look.
Thanks for pulling together some tests around that.

armv7 might be interesting to play with, though I suspect it'll just work. It adds LO_REGS to the likely spilled classes when thumb is enabled. LO_REGS isn't a singleton class. So it may be worth a quick test on that target. A few others do similar things (arm, pru, etc). But again, I think it'll just work since it sounds like singletons already work.

Jeff

Reply via email to