<div dir="ltr"><div><div><div><div><div>Hi<br>1-<br>for(rit=Result.begin();rit!=Result.end();++rit)<br>  {<br>          Value* Address= BlockAddress::get (*rit);<br>           IndirectBrInst *IBI = IndirectBrInst::Create(Address, Result.size(),i->getTerminator() );<br>
           IBI->addDestination((*rit));<br>  }<br><br></div>I tried this code , but the needed destination wasn't added. <br></div><br></div>2- About LLVM backend<br>
$ llc -march=cpp example_file.ll -o <br></div>I think it will be so helpful for my work <br><br></div>Thanks <br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 24 July 2013 08:37, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Rasha,<br>
<div class="im"><br>
On Wed, Jul 24, 2013 at 12:28 AM, Rasha Omar <<a href="mailto:rasha.sala7@gmail.com">rasha.sala7@gmail.com</a>> wrote:<br>
> 1- I need the first example.<br>
<br>
</div>Oh good.<br>
<div class="im">> 2- I set the Address uninitialized according to the documentation<br>
> " Setting the name on the Value automatically updates the module's symbol<br>
> table" from Value.h source code<br>
<br>
</div>That's referring to a string name, and is only really important for<br>
clarity and debugging the IR being produced. It means you could start<br>
out with something like<br>
<br>
    [...]<br>
    %1 = add i32 %lhs, %rhs<br>
    ret i32 %1<br>
    [...]<br>
<br>
(where the %1 is just an automatically incrementing label provided by<br>
LLVM) then call MyAddInst.setName("theSum") and LLVM would<br>
automatically convert this to:<br>
<br>
    %theSum = add i32 %lhs, %rhs<br>
    ret i32 %theSum<br>
<br>
You still have to have an initialised, valid Value pointer to be able<br>
to do this.<br>
<div class="im"><br>
> 3- I'm not sure about "select" instruction, you mean that the address is the<br>
> new destination (basic block)that will be added<br>
<br>
</div>The address will be, directly or indirectly, the result of a<br>
"BlockAddress::get(...)" call. Perhaps directly (though that would be<br>
rather useless since then you'd just as well create a direct branch to<br>
that block, perhaps via a "select" as in my code, or via load/store.<br>
Perhaps even passed into the function as a parameter in a rather<br>
bizarre set of circumstances.<br>
<br>
Do you know about the Cpp backend, by the way? It can be very useful<br>
for working out just what you have to write to emit certain LLVM IR.<br>
<br>
What you do is write your own .ll file by hand, having the features<br>
you want, then run<br>
<br>
$ llc -march=cpp example_file.ll -o -<br>
<br>
LLVM will produce some C++ code that generates the module you wrote.<br>
It's not necessarily in the best of styles, but shows you roughly<br>
which calls you should be making.<br>
<br>
Cheers.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><b><span style="color:rgb(0,0,102)">Rasha Salah Omar</span><br style="color:rgb(0,0,102)"><span style="color:rgb(0,0,102)">Msc Student at E-JUST</span><br style="color:rgb(0,0,102)">
<span style="color:rgb(0,0,102)">Demonestrator  at Faculty of Computers and Informatics</span><br style="color:rgb(0,0,102)"><span style="color:rgb(0,0,102)">Benha University</span><br></b></div>
</div>