Hi Chris, Chris Lattner wrote:> On Wed, 7 Nov 2007, Nicolas Geoffray wrote: > >> Thanks BGB, but at this point I can handle it ;-). The problem is not >> how in theory (patch the caller), but how in the LLVM code generation >> process. There are three steps for that: >> >> 1) How to represent the stub in the IR? An intrinsic? An external field >> with a ghost linkage? >> > > Probably an intrinsic. The trick is making it general purpose, not > language specific. > >I'm not sure actually how can I do that language specific ;). OK currently only Java does that (from what I know), but intrinsics like getElementDouble or setElementDouble do look general purpose. Unless, I'm too Java-minded?>> 2) At which point in LLVM do we know we won't have any optimization, so >> that the field operation is next to the stub call? >> > > You'll probably want to do this late in the code generator. >Therefore when instructions are lowered to target-specific instructions?> >> 3) Make LLVM think the stub call is not a real call, so that >> callee-saved registers do not get clobbered. >> > > LLVM supports calling convetions like "coldcc". The idea of coldcc is > that the function is compiled to not clobber callee-save registers. > However, in practice, no current code generators do anything special with > it, it's compiled like fastcc or ccc. > >As long as there is room for it, and obviously coldcc is here for that, it works fine for me :) Thanks, Nicolas> -Chris > >
On Wed, 7 Nov 2007, Nicolas Geoffray wrote:> I'm not sure actually how can I do that language specific ;). OK > currently only Java does that (from what I know), but intrinsics like > getElementDouble or setElementDouble do look general purpose. Unless, > I'm too Java-minded?Focus on the mechanism behind what you want to do, not on what you want to do itself :). Think about a way to separate what you want to accomplish from how it gets done.>> You'll probably want to do this late in the code generator. > Therefore when instructions are lowered to target-specific instructions?yep, -Chris -- http://nondot.org/sabre/ http://llvm.org/
----- Original Message ----- From: "Chris Lattner" <sabre at nondot.org> To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> Sent: Thursday, November 08, 2007 4:52 AM Subject: Re: [LLVMdev] Dynamic (JIT) type resolution> On Wed, 7 Nov 2007, Nicolas Geoffray wrote: >> I'm not sure actually how can I do that language specific ;). OK >> currently only Java does that (from what I know), but intrinsics like >> getElementDouble or setElementDouble do look general purpose. Unless, >> I'm too Java-minded? > > Focus on the mechanism behind what you want to do, not on what you want to > do itself :). Think about a way to separate what you want to accomplish > from how it gets done. >you know, I often do this, and people accuse me of not thinking "top-down" or having a "driving problem", ... infact I think I think bottom up and wander around until I find interesting things to do. oh well, misc and ammusing...>>> You'll probably want to do this late in the code generator. >> Therefore when instructions are lowered to target-specific instructions? > > yep, > > -Chris > > -- > http://nondot.org/sabre/ > http://llvm.org/ > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >