<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 10/6/11 11:48 AM, Rafael Baldiati Parizi wrote:
<blockquote
cite="mid:CALhe0+Gqxppx_04XRbWAr8zVdYd2TE0=2wxNB1y2PPPT3bjkQQ@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<font class="Apple-style-span" face="arial, sans-serif">Hello,<br>
</font>
<div>
<div>
<div>
<div><font class="Apple-style-span" face="arial, sans-serif">I
need create a CallInst to this function</font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="arial, sans-serif">define
i32 @function(i32 %n, i8 %m){ ... }</font></div>
<div><br>
</div>
<div>I now how get argument's type but <span
class="Apple-style-span" style="color: rgb(34, 34, 34);
font-family: arial, sans-serif; font-size: 13px; ">I do
not know how to create arguments that meet these types.</span></div>
<div><span class="Apple-style-span" style="color: rgb(34,
34, 34); font-family: arial, sans-serif; font-size:
13px; ">For example, if the argument is long, accurate
pass CallInst an integer argument, however, if a Char,
Char must pass an argument.</span></div>
<div><span class="Apple-style-span" style="color: rgb(34,
34, 34); font-family: arial, sans-serif; font-size:
13px; ">How to get the type of the argument of the
function definition and create the same type to pass the
Callinst???</span></div>
</div>
</div>
</div>
</blockquote>
<br>
If you want to pass a value to a function that doesn't match the
type, you will need to insert a cast instruction to cast the value
to the correct type. Which cast instruction you insert will depend
on the value's type and the type you want it to be.<br>
<br>
SAFECode has a utility function castTo() that takes a Value * and a
desired Type * and inserts a cast instruction if Value * is not of
the desired type. It's designed to minimize the number of cast
instructions it inserts so that the resulting LLVM IR is more
readable for debugging:<br>
<br>
<a class="moz-txt-link-freetext" href="http://llvm.org/viewvc/llvm-project/safecode/trunk/include/safecode/Utility.h?view=markup">http://llvm.org/viewvc/llvm-project/safecode/trunk/include/safecode/Utility.h?view=markup</a><br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:CALhe0+Gqxppx_04XRbWAr8zVdYd2TE0=2wxNB1y2PPPT3bjkQQ@mail.gmail.com"
type="cite">
<div>
<div>
<div>
<div><span class="Apple-style-span" style="color: rgb(34,
34, 34); font-family: arial, sans-serif; font-size:
13px; "><br>
</span></div>
<div><br>
</div>
-- <br>
<font size="2"><b><i>Rafael Parizi</i></b></font><br>
<br>
<br>
<br>
</div>
</div>
</div>
<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>