<div dir="ltr"><div class="gmail_extra">Alex:</div><div class="gmail_extra"><br></div><div class="gmail_extra">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.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">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.</div><div class="gmail_extra"><br></div><div class="gmail_extra">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.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Jonathan</div><div class="gmail_extra">shap (at) eros-osdogorg</div><div class="gmail_extra">Dog should be dot, of course. :-)</div></div></div>