[LLVMdev] getMinimalPhysRegClass

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon May 14 14:17:45 PDT 2012


On May 14, 2012, at 1:02 PM, reed kotler wrote:

> Does anyone understand the purpose of :
> 
> TargetRegisterInfo::getMinimalPhysRegClass ???

Barely.

> Why is there the presumption to use the minimal subclass?

The function can be traced back to a time when men were men and registers belonged to ONE register class. That concept doesn't make sense any longer, as LLVM supports and aggressively uses overlapping register classes.

I changed the meaning of the function to be 'the most specific register class containing Reg' which at least attempts to assign some meaning to a unique answer.

In general, there isn't a good answer to "What is the register class of R?"

> I want to introduct a different register class for MIPS 16 but don't 
> want it to chose MIPS 16 when
> I'm compiling for MIPS 32.

What exactly are you trying to do? The getMinimalPhysRegClass hook shouldn't be used for much these days. The most prominent client is PEI spilling callee-saved registers.

The register allocator is generally assuming that sub-classes of legal register classes are usable. That is a pervasive assumption.

/jakob




More information about the llvm-dev mailing list