Camille Troillard
2009-Jun-11 10:27 UTC
[LLVMdev] Access a specific address in the JIT compiler
Hi, I am using the JIT compiler to execute code that must interface with the running process. I would like to access some specific addresses. The solution I found is to create a global variable for each address I want to reference, and pass it as a mapping to the ExecutionEngine with addGlobalMapping. Is that how I should do this? Is there no way to just reference the addresses with constants? Best, Cam
Olivier Meurant
2009-Jun-11 11:17 UTC
[LLVMdev] Access a specific address in the JIT compiler
This seems to be the "proper" way to do that. Another possibility, is to create a ConstantInt with the size of the pointer (found in TargetData), then do a IntToPtr cast, and use this absolute address in load/store/call. Cheers, Olivier. On Thu, Jun 11, 2009 at 12:27 PM, Camille Troillard <camille at osculator.net>wrote:> Hi, > > I am using the JIT compiler to execute code that must interface with > the running process. > I would like to access some specific addresses. > > The solution I found is to create a global variable for each address I > want to reference, and pass it as a mapping to the ExecutionEngine > with addGlobalMapping. > > Is that how I should do this? > Is there no way to just reference the addresses with constants? > > > Best, > Cam > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090611/12186791/attachment.html>
Camille Troillard
2009-Jun-11 11:23 UTC
[LLVMdev] Access a specific address in the JIT compiler
On Thu, Jun 11, 2009 at 1:17 PM, Olivier Meurant<meurant.olivier at gmail.com> wrote:> This seems to be the "proper" way to do that. > > Another possibility, is to create a ConstantInt with the size of the pointer > (found in TargetData), then do a IntToPtr cast, and use this absolute > address in load/store/call.Thanks Olivier, this is what I was looking for.