John,<div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; ">I needed just this: </span><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; ">Value * Val2 = Constant::getNullValue (arg_iti->getType());</span></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Thanks.<br>
</span></font><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 class="im">
    On 10/6/11 12:40 PM, Rafael Baldiati Parizi wrote:
    <blockquote type="cite">
      
      <div>virtual std::vector<Value *>
        getESetArgumentosFunc(Function *F){</div>
      <div><span style="white-space:pre-wrap"> </span>std::vector<Value
        *> varg_list;</div>
      <div><span style="white-space:pre-wrap"> </span>varg_list.clear();</div>
      <div><span style="white-space:pre-wrap"> </span>for(Function::arg_iterator
        arg_iti = F->getArgumentList().begin(), arg_ite =
        F->getArgumentList().end(); arg_iti != arg_ite; ++arg_iti){</div>
      <div>
        <span style="white-space:pre-wrap"> </span>Value
        *para =
        ConstantInt::get(IntegerType::get(getGlobalContext(),32), 0);</div>
      <div><span style="white-space:pre-wrap"> </span><b>Value
          *val2 = cast<</b> arg_iti->getType()<b>>(para);      
                                                   
          <--------------------------</b></div>
      <div><span style="white-space:pre-wrap"> </span>para->setName("test");<span style="white-space:pre-wrap"> </span></div>
      <div><span style="white-space:pre-wrap"> </span>varg_list.push_back(para);</div>
      <div><span style="white-space:pre-wrap"> </span>} </div>
      <div><span style="white-space:pre-wrap"> </span>return
        varg_list;</div>
      <div>}</div>
      <div><br>
      </div>
      <div>How can I make this cast??<br>
      </div>
    </blockquote>
    <br></div>
    I think you misunderstood me.  You need to *insert* an LLVM cast
    instruction.  For example, you might insert the following code:<div class="im"><br>
    <br>
    Value *para =
    ConstantInt::get(IntegerType::get(getGlobalContext(),32), 0);<br></div>
    Value * Val2 = CastInst::CreateZExtOrBitCast (para,
    arg_iti->getType(), "test", InsertPt)<br>
    <br>
    ... where InsertPt is an Instruction * specifying where to insert
    the cast instruction.<br>
    <br>
    Having said that, if all you're doing is inserting zero values of
    the appropriate type, it might be easier to use:<br>
    <br>
    Value * Val2 = Constant::getNullValue (arg_iti->getType());<br>
    <br>
    -- John T.<div class="im"><br>
    <br>
    <blockquote type="cite">
      <div><br>
      </div>
      <br>
      <div class="gmail_quote">2011/10/6 John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu" target="_blank">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> 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>
    </blockquote>
    <br>
  </div></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>
</div>