Displaying 3 results from an estimated 3 matches for "pthreadfunctiontyp".
Did you mean:
pthreadfunctiontype
2005 Apr 21
0
[LLVMdev] Using LLVM for a dynamically typed language
...ng to cast a
function pointer from one type to another. Hopefully the line wrapping
won't totally destroy this.
std::vector<const Type*> paramTypes;
// First parameter: a void pointer
paramTypes.push_back( PointerType::get( Type::getPrimitiveType( Type::SByteTyID ) ) );
FunctionType* pthreadFunctionType = FunctionType::get(
PointerType::get( Type::getPrimitiveType( Type::SByteTyID ) ),
paramTypes, false );
assert( pthreadFunctionType != NULL );
// Cast the function to the pthread function type
Value* castedFunction = new CastInst( function,
PointerType::get( pthreadFunctionType ), "&q...
2005 Apr 21
2
[LLVMdev] Using LLVM for a dynamically typed language
I recently ran into the following problem.
I'm prototyping a compiler for a dynamically typed language in which
functions are first class objects. Assuming I have something like
this:
if(rand() > 5)
i = define(x, y, z) { return x + y + z; }
else
i = define(x, y) { return x + y; }
At this point I cannot know the type of 'i' at compile time. At
runtime 'i' is a
2005 Apr 21
5
[LLVMdev] Using LLVM for a dynamically typed language
...type to another. Hopefully the line wrapping
> won't totally destroy this.
>
> std::vector<const Type*> paramTypes;
>
> // First parameter: a void pointer
> paramTypes.push_back( PointerType::get( Type::getPrimitiveType( Type::SByteTyID ) ) );
>
> FunctionType* pthreadFunctionType = FunctionType::get(
> PointerType::get( Type::getPrimitiveType( Type::SByteTyID ) ),
> paramTypes, false );
> assert( pthreadFunctionType != NULL );
>
> // Cast the function to the pthread function type
> Value* castedFunction = new CastInst( function,
>...