<div>virtual std::vector<Value *> getESetArgumentosFunc(Function *F){</div><div><span class="Apple-tab-span" style="white-space:pre">                 </span>std::vector<Value *> varg_list;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>varg_list.clear();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                      </span>for(Function::arg_iterator arg_iti = F->getArgumentList().begin(), arg_ite = F->getArgumentList().end(); arg_iti != arg_ite; ++arg_iti){</div><div>
<span class="Apple-tab-span" style="white-space:pre">                         </span>Value *para = ConstantInt::get(IntegerType::get(getGlobalContext(),32), 0);</div><div><span class="Apple-tab-span" style="white-space:pre">                          </span><b>Value *val2 = cast<</b> arg_iti->getType()<b>>(para);                                                 <--------------------------</b></div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-tab-span" style="white-space:pre">                         </span>para->setName("test");<span class="Apple-tab-span" style="white-space:pre"> </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                              </span>varg_list.push_back(para);</div><div><span class="Apple-tab-span" style="white-space:pre">                   </span>} </div><div><span class="Apple-tab-span" style="white-space:pre">   </span>return varg_list;</div>
<div>}</div><div><br></div><div>How can I make this cast??<br><br></div><br><div class="gmail_quote">2011/10/6 John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu">criswell@illinois.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div></div><div class="h5">
    On 10/6/11 11:48 AM, Rafael Baldiati Parizi wrote:
    <blockquote type="cite">
      
      <font face="arial, sans-serif">Hello,<br>
      </font>
      <div>
        <div>
          <div>
            <div><font face="arial, sans-serif">I
                need create a CallInst to this function</font></div>
            <div><font face="arial, sans-serif"><br>
              </font></div>
            <div><font 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 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 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 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></div></div>
    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 href="http://llvm.org/viewvc/llvm-project/safecode/trunk/include/safecode/Utility.h?view=markup" target="_blank">http://llvm.org/viewvc/llvm-project/safecode/trunk/include/safecode/Utility.h?view=markup</a><br>
    <br>
    -- John T.<br>
    <br>
    <blockquote type="cite">
      <div>
        <div>
          <div>
            <div><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></fieldset>
      <br>
      <pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><font size="2"><b><i>Rafael Parizi</i></b></font><br><br><br><br>