[LLVMdev] Explicit register usage in LLVM assembly

Frits van Bommel fvbommel at gmail.com
Sat Apr 2 16:09:56 PDT 2011

On Sun, Apr 3, 2011 at 12:51 AM, Yiannis Tsiouris
<yiannis.tsiouris at gmail.com> wrote:
> On 04/03/2011 12:43 AM, Frits van Bommel wrote:
>> P.S. If it's important (or just convenient) for you to use a
>> unmodified LLVM, you might be able to get these changes into the
>> repository if you post a patch to the commits list. GHC had their own
>> special calling convention committed, for example.
> I am working on creating a backend for a language that already has a
> compiler. This compiler already maps some virtual registers of the VM,
> such as stack and heap pointers, to physical ones for performance and
> interoperability. If I understood well, there is no simple, predefined
> way to retain these conventions (custom pre-coloured registers) with
> LLVM compiler infrastructure. I would be surprised if I was the first
> one to have ever stumbled upon this problem!

No, like I said you're not the first one: GHC also had this problem
(but on perhaps a slightly larger scale: they seemed to have multiple
pinned registers). They fixed it by implementing a custom calling
convention, and getting it committed in the LLVM repository.

More information about the llvm-dev mailing list