Displaying 1 result from an estimated 1 matches for "load_int".
Did you mean:
load_idt
2009 May 21
3
[LLVMdev] Passing a pointer to a function
...try checking the type before building the function, as in:
void
visitLoadInst(LoadInst &I) {
Value *P;
P = I.getPointerOperand();
PointerType* PtrTy = (PointerType*)(P);
Constant* fcall;
if (PtrTy->getElementType()->isInteger()) {
fcall = buildFcallMem(*theModule, "load_int", Type::Int32Ty);
CallInst::Create(fcall, P, "", &I);
} else if (PtrTy->getElementType()->isInteger()){
fcall = buildFcallMem(*theModule, "load_float", Type::FloatTy);
CallInst::Create(fcall, P, "", &I);
}
}
But then I get segfaults...