Memory intrinsics not working
wintermute-motherbrain opened this issue · 2 comments
It seems that trying to access any of the memory intrinsic functions will cause a seg fault e.g.:
const memcpy = llvm.Intrinsic.getDeclaration(module, llvm.Intrinsic.memmove)
The intrinsic function highlighted in the test folder (debugtrap) does work but none of the memory related ones seem to work (memcpy, memcpy_inline, memmove, etc).
Also, thank you for putting this library together, its great to finally have access to the larger feature set of llvm through node!
As the llvm source code comment says:
The Tys parameter is for intrinsics with overloaded types (e.g., those
using iAny, fAny, vAny, or iPTRAny). For a declaration of an overloaded
intrinsic, Tys must provide exactly one type for each overloaded type in the intrinsic.
You need to pass the third argument for llvm.Intrinsic.getDeclaration
if you want to get memmove intrinsic.
I have given an example in test folder:
llvm-bindings/test/intrinsic.ts
Lines 12 to 16 in c23b779
BTW, there is a small bug in parameter processing of Intrinsic.getDeclaration
before v0.3.1. Please update llvm-bindings to v0.3.1
That was it! Cheers