Is LLVM custom Register Allocation able to only spilling virtual register to memory (original) (raw)
Hi everyone,
I’m learning to customize Register Allocation extending RegAllocBase. Is that technically possible to only spill all virtual register to memory? (I know this sound weird, However, we have more memory than physical register).
Thank you in advance,
James
I’m not quite sure what you’re asking.
The existing allocator should work fine with a very small register file, as long as you don’t have any weird overlapping registers.
The register allocator doesn’t really care what you consider a “register”; if your instruction set allows it, you can designate a region of memory as your register file. That said, the further away you get from “normal” register allocation, the harder it will be to make the regular register allocation infrastructure do what you want.
I don’t quite follow here. Usually we spill physical registers because there are only so many of them. On the other hand, there are unlimited number of virtual registers.
Isn’t that the majority of the cases?
Just to be clear, in LLVM virtual registers mean the symbolic registers we used to represent values before register allocation, and physical registers mean those defined by the ISA.
Unless you’re referring to physical registers in processors that have register renaming. But those are uArch details and LLVM doesn’t really model it, and we usually called it architectural registers v.s. physical registers.