[LLVMdev] how create a pointer to FILE*

eric.lew eirc.lew at gmail.com
Fri Jun 27 00:34:55 PDT 2014


Thanks, Tim.

It works. 

 

VoidPtrTy = Type::getInt8PtrTy(M.getContext());
M.getOrInsertFunction("__to_prof", VoidTy, VoidPtrTy, NULL);   
==>
declare void @__to_prof(i8*)  

CallInst *CallI;
    Instruction *I = LoopHeader->begin();
    Value * Null =  (Value*) ConstantPointerNull::get(VoidPtrTy );
    //Value * Null =  (Value*) ConstantPointerNull::get( 0 ); 
    Value *PtrNull = Builder->CreatePointerCast( Null, VoidPtrTy);
    Builder->SetInsertPoint(I );
    CallI = Builder->CreateCall( __TO_PROF_FUNCTION,  PtrNull ); //
__to_prof(i8* null)

==>
call void @__to_prof(i8* null)



Eric



--
View this message in context: http://llvm.1065342.n5.nabble.com/how-create-a-pointer-to-FILE-tp69982p69987.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list