The compilation error is : `error: ‘LD100’ was not declared in this scope.`<br><br><br><div class="gmail_quote">On Mon, Jan 28, 2013 at 11:31 AM, Alexandru Ionut Diaconescu <span dir="ltr"><<a href="mailto:alexandruionutdiaconescu@gmail.com" target="_blank">alexandruionutdiaconescu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello everyone,<br><br>Can you please tell me if it is possible in LLVM to cast a `Value*` to an `Instruction*/LoadInst*` if for example `isa<LoadInst>(MyValue)` is true? In my particular piece of code:<br>
<br> Value* V1 = icmpInstrArray[i]->getOperand(0);<br>
Value* V2 = icmpInstrArray[i]->getOperand(1);<br> if (isa<LoadInst>(V1) || isa<LoadInst>(V2)){<br> ...<br> if(isa<LoadInst>(icmpInstrArray[i]->getOperand(0)))<br> LoadInst *LD100 = cast<LoadInst>(icmpInstrArray[i]->getOperand(0));<br>
Value *C100 = LD100->getPointerOperand(); //HERE COMPILATION ERROR<br>Further, I just need to make `C100->getName()` and I will get the loaded variable.<br><br>I don't think that I can use cast like that. Can you tell me a method to obtain the loaded variable from a Load instruction correspondent to my ICMP instructions? Or better how I can extract the Load instruction from `icmpInstrArray[i]->getOperand(0)`?<br>
<br>Thank you a lot !
</blockquote></div><br><br clear="all"><br>-- <br><font style="background-color:rgb(255,255,255);color:rgb(153,153,153)">Best regards,</font><br style="background-color:rgb(255,255,255);color:rgb(153,153,153)"><font style="background-color:rgb(255,255,255);color:rgb(153,153,153)">Alexandru Ionut Diaconescu</font><br>