[LLVMdev] Global register variables/custom calling conventions

Andrew Jeffery andrew at aj.id.au
Sun Sep 20 02:01:36 PDT 2009

Anton Korobeynikov wrote:
> Hello
>> I'm implementing an LLVM backend for qemu-arm (by creating an ARM frontend
>> for LLVM - from what I understand a slightly different approach than the
>> original llvm-qemu project)
> I don't see the difference so far. Could you please explain?

Again, from what I understand, llvm-qemu worked by emitting LLVM IR from 
QEMU IR API calls. This project goes straight from ARM to LLVM IR, 
bypassing QEMU's IR, (partially) in the hope that more information about 
the original intent of the code is retained. I don't have any numbers 
handy for comparison against the argument "it'd optimise away", however, 
we have to have an implementation to test this theory anyway ;)

>> and I've got to the point where I have to deal with Qemu's use of global register variables.
> Why? The whole point of llvm-qemu project was that you don't need to
> go with all that hacks and workarounds

The point of this is to provide an alternative backend to QEMU that can 
be run in a separate thread to generate optimised blocks, while working 
as transparently as possible. A nice property of TCG (QEMU's current 
JIT, which was dyngen when llvm-qemu was written) is that it's extremely 
fast at generating reasonable code - this approach keeps it in place 
while we do extra, possibly more expensive work out of sight. It might 
not be a pretty idea, but LLVM does generate some very tight code :) 
It's an experiment - humour me...

Sorry if this is somewhat OT.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090920/e52618eb/attachment.sig>

More information about the llvm-dev mailing list