Displaying 1 result from an estimated 1 matches for "functionconst".
Did you mean:
functioncast
2008 Feb 25
0
[LLVMdev] Calling functions
...I've tried that approach to the c++ function calls. I ended up with this code:
#######
float test( float input )
{
return 0.0;
}
[...]
typedef float (*P_FUNCTION) ( float );
P_FUNCTION pt2Function = &test;
intptr_t functionInt = (intptr_t)pt2Function;
Constant *functionConstant = ConstantInt::get( APInt( sizeof(intptr_t), functionInt) );
const Type *ArgTy = Type::FloatTy;
PointerType* arg = PointerType::get( ArgTy, 0 );
functionConstant = ConstantExpr::getIntToPtr( functionConstant, arg );
[...] (BB and CoefficientOne definition and other stuff)
CallIns...