[LLVMdev] Named register variables GNU-style

Renato Golin renato.golin at linaro.org
Sun Apr 27 13:41:28 PDT 2014


On 19 April 2014 22:15, Edward Z. Yang <ezyang at mit.edu> wrote:
> Like the kernel, we use register variables to store thread-local state
> in our garbage collector [1]; on Clang, the lack of this capability
> costs us 30% in overall runtime of all programs.  We can't use inline
> assembly, because that would require us rewriting our entire garbage
> collector (i.e. all code which uses the thread-local state) in inline
> assembly, but this is all code that should be written in C.

Hi Edward,

This is another good reason to have named registers implemented. Many
people replied to my original email with "write inline assembly
instead", but there are cases that doing so would make the project *a
lot* more complex.


> Perhaps this is simply an advertisement for Clang to optimize __thread
> variables in some way further; certainly this would solve our (and other
> folks) problem.

You can certainly propose an optimization that would be beneficial,
and if shown to be safe, you or someone else could implement it in
LLVM or Clang.

cheers,
--renato



More information about the llvm-dev mailing list