<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 8/11/11 5:06 AM, Grégory Ruch wrote:
<blockquote cite="mid:4E43C5DA.80407@heig-vd.ch" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Hi everybody,<br>
<br>
I'm trying to implement a LLVM Pass that insert instructions into
a basicblock.<br>
<br>
I'm using a FunctionPass and I want to add somthing like this :<br>
<br>
%tmp = alloca i32, align 4<br>
%tmp2 = alloca i32, align 4<br>
<br>
store i32 10, i32* %tmp<br>
store i32 2, i32* %tmp2<br>
<br>
%tmp3 = add i32 %tmp, %tmp2<br>
<span class="Apple-style-span" style="color: rgb(0, 0, 0);
font-family: 'Times New Roman'; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: 2; text-align: left;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; background-color: rgb(238, 238,
238); font-size: medium;"></span><br>
I try to follow the official tuto, I think this part is out of
date. <a moz-do-not-send="true"
href="http://llvm.org/docs/ProgrammersManual.html#simplechanges">http://llvm.org/docs/ProgrammersManual.html#simplechanges</a><br>
I'm using IRBuilder to create an alloc instruction but I can not
for now.<br>
</blockquote>
<br>
First, there are two ways to insert instructions:<br>
<br>
1) Use the IRBuilder class to create instructions.<br>
2) Use the LLVM internal API directly and use a method of the
AllocaInst class.<br>
<br>
Either way, you should read the LLVM doxygen documentation of the
class you want to use to get the latest API for it. So, in this
case, either read the doxygen documentation on IRBuilder or the
documentation on AllocaInst.<br>
<br>
Doxygen docs are at <a class="moz-txt-link-freetext" href="http://llvm.org/doxygen/hierarchy.html">http://llvm.org/doxygen/hierarchy.html</a>.<br>
<br>
-- John T.<br>
<br>
<blockquote cite="mid:4E43C5DA.80407@heig-vd.ch" type="cite"> <br>
Someone could help me to get started ?<br>
<br>
Thanks !<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>