Spilling in Register allocator.


I am currently working on a simple graph coloring based register allocator on llvm.

So far my code builds the interference graph and assigns physical registers using the VirtRegMap. However I am facing some trouble while spilling.

I used assignVirt2StackSlot method of VirtRegMap and got “UNREACHABLE EXECUTED” error.

I would like to know if simply calling this method is enough to spill the register or whether I need to explicitly assign memory location. Also I do not understand how the spiller object is to be used.

Any help regarding this would be appreciated.