Deepak Rajendrakumaran via llvm-dev
2016-Aug-19 17:47 UTC
[llvm-dev] Passing character array as argument in inserted function call during IR pass
Hi,
I am trying to insert a function call inside a module during an LLVM IR
pass. One of the arguments is a character array and I need to initialize it
with a string during the IR pass. But I am not able to create a *value*
object to use as the function argument. For example,
In my IR pass, I have the following : *sringRef str("StringValue")*
I want to insert the following call(FuncCall) in the source file being
compiled.
*void foo(){*
*//code*
*FuncCall("StringValue");*
*//code*
*}*
Can someone please tell me how this can be done?
Regards,
Deepak
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20160819/ab1826d9/attachment-0001.html>
Ismail Badawi (ibadawi) via llvm-dev
2016-Aug-19 18:17 UTC
[llvm-dev] Passing character array as argument in inserted function call during IR pass
You can use IRBuilder::CreateGlobalStringPtr: http://llvm.org/docs/doxygen/html/classllvm_1_1IRBuilder.html#ab81bf85457770dc76f2e536f201db219 Hope this helps, Ismail> On Aug 19, 2016, at 1:47 PM, Deepak Rajendrakumaran via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > > I am trying to insert a function call inside a module during an LLVM IR pass. One of the arguments is a character array and I need to initialize it with a string during the IR pass. But I am not able to create a value object to use as the function argument. For example, > > In my IR pass, I have the following : sringRef str("StringValue") > > I want to insert the following call(FuncCall) in the source file being compiled. > > void foo(){ > //code > FuncCall("StringValue"); > //code > } > > Can someone please tell me how this can be done? > > Regards, > Deepak > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev