[LLVMdev] Help needed with creating new and replacing an old instruction

marcchellarmani at email.biz
2013-12-03T03:04:11Z

<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

Hi, I have the
following instruction in my IR- %call2 = call i8*
@strcpy(i8* %1, i8* %2)
#2 I intend to change
call to strcpy with strncpy. I have included the following code in
runOnFunction, so that when it is strcpy's turn to be invoked, strncpy is
invoked instead. Assuming
I* is the strcpy
instruction, CallInst*
x=new
CallInst::CreateCall3(strncpy,1,2,ConstantInt(16),"my_strncpy"); ReplaceInstWithInst(I*,x); I'm
running into a whole bunch of errors in CreateCall3(). How can I go about
writing this
correctly? Any help would
be
appreciated. Thanks. Marc <div
style="color:#aaaaaa;margin-top:10px;padding:10px 10px 10px
0;">---- <div style="background: none
repeat scroll 0 0 #F1F1F1;border: 1px solid #E9E9E9;border-radius: 2px 2px 2px
2px;color:#111111;padding:10px;margin-top:10px;"><a
href="https://www.email.biz">email.biz access any email
create any email









<div style='color:#aaaaaa;margin-top:10px;padding:10px 10px 10px
0;'> <div style='background: none
repeat scroll 0 0 #F1F1F1;border: 1px solid #E9E9E9;border-radius: 2px 2px 2px
2px;color:#111111;padding: 10px;margin-top:10px;'><a
href='https://www.email.biz'>email.biz access any email
create any email