[LLVMdev] Explicit register usage in LLVM assembly

Yiannis Tsiouris yiannis.tsiouris at gmail.com
Sat Apr 2 12:46:15 PDT 2011


On 04/02/2011 06:26 PM, Samuel Crow wrote:
> Hello Yiannis,
>
> You could write a custom backend that doesn't allocate %r15 for general usage. 
>  The normal way to do this is to set up a custom calling convention for all 
> functions that keeps a sentinel in %r15 so that it always holds the sentinel. 
>  This is how new operating systems are supported with custom ABIs.  The only 
> problem is that you cannot be assured that %r15 stays put between function calls 
> such as for an interrupt.
>
> If you had asked "Is there another EASY way to force explicit register usage?" 
> the answer would have been "No."
>
>
> --Sam Crow
>
>
> ----- Original Message ----
>   
>> From: Yiannis Tsiouris <yiannis.tsiouris at gmail.com>
>> To: llvmdev at cs.uiuc.edu
>> Cc: Chris Stavrakakis <hydralisk.r at gmail.com>
>> Sent: Sat, April 2, 2011 9:39:13 AM
>> Subject: [LLVMdev] Explicit register usage in LLVM assembly
>>
>> Hello!
>>      Is there a way to force explicit register usage (e.g.  %r15 in amd64 
>> architecture) in
>> LLVM assembly code? I was proposed in  #llvm channel at irc.oftc.net to 
>> use inline
>> assembly but i find it rather impractical in my case. Is  there any other 
>> way?
>>
>> Thanx,
>> ~y.
>>     
Hello Sam,
  I am not sure i made myself clear about what i want. I was wondering
if there
is a way to communicate to LLVM's register allocator and define which
registers are pre-coloured and should not be used for allocation.


~y.



More information about the llvm-dev mailing list