How to implement spills into a second bank of registers (?)

Hi All,

For my processor ABI, I have a second bank of registers. The instruction set has ‘mov’ instructions to copy to and from the two register banks. The registers in the second bank have no regular use in instructions, however they are there for temporary storage purposes and it would be desirable that they could be used as spills when there’s shortage of primary registers.

The second bank of registers is defined as a belonging to a separate register class. I have defined the required ‘mov' instructions to move between register classes in tablegen. I also updated copyPhysReg to account for these moves.

However, LLVM does not seem to use the second register bank at all.

As a side note, the spills to the stack are implemented and they work fine. I would have expected that LLVM would use the second register bank as backup storage before creating actual stack spills, but this does not happen.

Why is that?. Should I implement this in some custom way?

any help would be appreciated

Thanks.