Thank you so much,<br><br>removing then solved the problem.<br><br>I did not know thre where such a thing as anonymous blocks I thought llvm was going to ignore anything after a terminator instruction (br, ret, etc)<br><br>
I'll make my code generator "block aware" :P<br><br>thank you again!!! :P<br><br><div class="gmail_quote">On Fri, Mar 11, 2011 at 8:11 AM, Frits van Bommel <span dir="ltr"><<a href="mailto:fvbommel@gmail.com">fvbommel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Fri, Mar 11, 2011 at 11:48 AM, Judison <<a href="mailto:judison@gmail.com">judison@gmail.com</a>> wrote:<br>

> I hope this is the right place to ask it, sorry if I'm wrong...<br>
<br>
</div>It's the right place, though the IRC channel would have been good too.<br>
<div class="im"><br>
> My compiler is generating this code:<br>
><br>
> (line numbers included) (Please ignore the extra br label %b0 and the whole<br>
> b0)<br>
<br>
</div>Sorry, but the extra branches can't be ignored since they are exactly<br>
your problem.<br>
<div class="im"><br>
>   54  define i32 @std_lang__rest() {<br>
>   55    entry:<br>
>   56      %ret = alloca i32                        ; <i32*> int*<br>
><br>
>   57      %0 = icmp eq i32 4, 5                    ; <i1> boolean<br>
><br>
>   58      br i1 %0, label %b0_t, label %b0_f<br>
><br>
>   59    b0_t:<br>
>   60      %1 = add i32 5, 2                        ; <i32> int<br>
><br>
>   61      store i32 %1, i32* %ret<br>
>   62      br label %return<br>
<br>
<br>
</div>This "br label %return" ended block %b0_t and automatically started a<br>
new one. Since you didn't provide a label, it's named %2.<br>
<div class="im"><br>
><br>
>   63      br label %b0<br>
>   64    b0_f:<br>
>   65      store i32 5, i32* %ret<br>
><br>
>   66      br label %return<br>
<br>
</div>And here block %b0_f ends, and block %3 begins.<br>
<div class="im"><br>
>   67      br label %b0<br>
><br>
>   68    b0:<br>
>   69      store i32 0, i32* %ret<br>
><br>
>   70      br label %return<br>
>   71    return:<br>
>   72      %2 = load i32* %ret                      ; <i32> int<br>
<br>
</div>Leading to %4 being the next anonymous value here, not %2.<br>
<div class="im"><br>
><br>
>   73      ret i32 %2<br>
>   74  }<br>
> ...<br>
><br>
> llvm-as std_lang.ll<br>
> llvm-as: std_lang.ll:72:5: error: instruction expected to be numbered '%4'<br>
>     %2 = load i32* %ret                      ; <i32> int<br>
>     ^<br>
><br>
> Why %4 ??? what I did wrong?<br>
<br>
</div>You didn't realize there were anonymous blocks in your code, I'm guessing.<br>
</blockquote></div><br><br clear="all"><br>-- <br>Judison<br><a href="mailto:judison@gmail.com" target="_blank">judison@gmail.com</a><br><br>"O ignorante que procura se instruir é como um sábio; o sábio que fala sem discernimento se assemelha a um ignorante." Imam Ali (as)<br>