[llvm-dev] Creating a virtual machine: stack, regs alloc & other problems

Jonathan S. Shapiro via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 7 16:43:38 PDT 2015


Alex:

I'm not sure you're taking the right approach with this. You can either
have portability or you can play games with the calling convention assumed
by the back end, or you can modify the compiler to suit your desired
calling convention, but you probably can't get all three.

I'm the guy behind HDTrans (dynamic binrary translation for x86), and we
used direct x86 instruction emission as well, and we cheated like crazy on
calling conventions, stacks, you name it. So I understand where you are
coming from. I've also done some bytecode VM work. You just aren't going to
get a portable result that way, and as others have said already, using
llvm-il isn't going to get you there. I think you are better off stepping
back and looking at this as a new engineering problem rather than trying to
translate your existing solution piece by piece. The bad news is that this
infrastructure my not let you get quite as far down toward the bare metal.
The good news is that it can be exploited to do more in the way of dynamic
optimization than is typically feasible with directly hand-generated
machine code.

If you like, get in touch with me off-line. I don't want to go spouting off
useless ideas here, because I don't understand what you are trying to do
yet. But I'd be happy to talk with you to get a slightly better sense and
see if I can offer some practical help.


Jonathan
shap (at) eros-osdogorg
Dog should be dot, of course. :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150807/37359f19/attachment.html>


More information about the llvm-dev mailing list