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 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. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
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.
Possibly Parallel Threads
- [LLVMdev] Explicit register usage in LLVM assembly
- [LLVMdev] Explicit register usage in LLVM assembly
- [LLVMdev] Publication - ErLLVM: An LLVM backend for Erlang
- [LLVMdev] Publication - ErLLVM: An LLVM backend for Erlang
- [LLVMdev] Publication - ErLLVM: An LLVM backend for Erlang