LWN.net Logo

Greedy register allocation in LLVM 3.0

Greedy register allocation in LLVM 3.0

Posted Sep 23, 2011 4:30 UTC (Fri) by wahern (subscriber, #37304)
In reply to: Greedy register allocation in LLVM 3.0 by vonbrand
Parent article: Greedy register allocation in LLVM 3.0

Well written code will use lots of local, temporary variables. The more efficient the allocator the fewer and smaller the spills to the stack. So, yeah, register allocation is important _because_ of finite memory bandwidth and latency.


(Log in to post comments)

Greedy register allocation in LLVM 3.0

Posted Sep 23, 2011 10:31 UTC (Fri) by etienne (subscriber, #25256) [Link]

Register allocation is also very complex if you target Intel/AMD processors, with their 8/16/32 or 8/32/64 registers size: if the lower 8 bits (AL) are taken you can still use the upper 8 bits (AH), but then using the 16/32 bits register (AX/EAX) makes register allocation very complex.
Most code use boolean variables, and using 32/64 bits to store a boolean is very inefficient on Intel/AMD processor.
I wonder if LLVM is able to coalesce multiple boolean into a single register and use bits-and/or/test to manage them, I didn't see GCC doing it nicely (and it is probably very complex to implement).

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds