[LLVMdev] Is using lots of in-register values in IR bad?

Duncan Sands baldrick at free.fr
Fri Jul 29 07:23:09 PDT 2011


Hi Carlo,

> Nella citazione venerdì 29 luglio 2011 11:24:47, Duncan Sands ha scritto:
>> In-register structs and arrays are not intended to be used for large structs and
>> arrays.
> Out of curiosity, why would that be the case?

because it is not efficient, and there's no point in putting effort into making
it efficient since it would be way easier to just go through memory in the first
place.

If you use a struct virtual register with (recursively) N fields then that is
equivalent to using N scalar virtual registers.  So first off if N is large
then you will use many many registers which will doubtless be spilled to the
stack resulting in gazillions of stack loads and stores if you actually do
anything useful with the struct.

Ciao, Duncan.



More information about the llvm-dev mailing list