[LLVMdev] JIT compiled intrinsics calls is call to null pointer
Taco H. in den Bosch
taco at heddesit.nl
Thu Sep 19 01:57:25 PDT 2013
Hi Andrew,
this sounded a plausible explanation, because the X86 processor does not
have an instruction to calculate the power function.
So I tried the llvm.sin.f32 intrinsic, as the X86 processor family does
have an instruction for that, but I still get the same problem. While you
may still be right, there is at least something else going on as well.
Thanks for your input, though.
Taco.
----------------------------------------
From: "Andrew MacPherson" <andrew.macp at gmail.com>
Sent: Thursday, September 19, 2013 10:36 AM
To: taco at heddesit.nl
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] JIT compiled intrinsics calls is call to null
pointer
Hi Taco,
We had a similar issue where a math intrinsic was being converted to a call
to null and it turned out to be because the system didn't support the CPU
instructions for the operation so the intrinsic used a call to the library
function (pow in your case). However because we weren't expecting this math
function to be looked up by MCJIT in our
JITMemoryManager::getPointerToNamedFunction() we weren't making it
available and it was returning null.
Not sure if this is relevant to your case but maybe it'll help point you in
the right direction.
Cheers,
Andrew
On Wed, Sep 18, 2013 at 8:32 AM, Taco H. in den Bosch <taco at heddesit.nl>
wrote:
Hi everyone,
I am trying to call an LLVM intrinsic (llvm.pow.f32), inserted with the
following call:
std::vector<llvm::Type *>
arg_types;arg_types.push_back(llvm::Type::getFloatTy(context)); auto
function=llvm::Intrinsic::getDeclaration(module, llvm::Intrinsic::pow,
arg_types);auto result=ir_builder->CreateCall(function, args);
When I try to execute the code generated by the JIT compiler, I see that
the intrinsic is not compiled into a math coprocessor instruction, but in a
call to a null address:
002300B8 sub esp,8 002300BB movss xmm0,dword ptr
ds:[2300B0h] 002300C3 movss dword ptr [esp+4],xmm0 002300C9
movss xmm0,dword ptr ds:[2300B4h] 002300D1 movss dword ptr
[esp],xmm0 002300D6 call 00000000 002300DB add esp,8
002300DE ret
Is there anything special that I need to do in order to be able to call
intrinsics, either in general or when JITting? I am either doing something
wrong, or forgetting to do something, but I don't know what.
I am working with a Visual Studio compiled version on Windows (x86).
All hints will be appreciated, with kind regards,
Taco H. in den Bosch.
_______________________________________________
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/20130919/0fcf9fb2/attachment.html>
More information about the llvm-dev
mailing list