<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Oct 19, 2013 at 8:20 AM, Abhinash Jain <span dir="ltr"><<a href="mailto:omnia@mailinator.com" target="_blank">omnia@mailinator.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">How can I get the name of the virtual Registers present on an instruction.<br>

eg.   %add18 = add nsw i32 %mul17, %37<br>
<br>
in this case I want to extract the name of the virutal registers as "add18",<br>
"mul17","37".<br>
<br>
This can easily be done in the case of store Instruction<br>
eg.  store i32 %add20, i32* %t, align 4<br>
<br>
in this case functions like instr->getOperand(0)->getName() and<br>
instr->getOperand(1)->getName() will fetch me "add20" and "t" respectively.<br>
<br>
But I want this for every Instruction, So How can I achieve this??<br></blockquote><div><br></div><div>The number is not stored with the instruction. Only the name (see getName()). The number is computed when the module/function is printed and requires global information (since it depends on all the previous values in the function). See the class SlotTracker in lib/IR/AsmWriter.cpp.</div>
<div><br></div><div>Also, see this: <a href="http://llvm.org/docs/FAQ.html#what-api-do-i-use-to-store-a-value-to-one-of-the-virtual-registers-in-llvm-ir-s-ssa-representation">http://llvm.org/docs/FAQ.html#what-api-do-i-use-to-store-a-value-to-one-of-the-virtual-registers-in-llvm-ir-s-ssa-representation</a></div>
<div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://llvm.1065342.n5.nabble.com/Name-of-Virtual-Registers-tp62256.html" target="_blank">http://llvm.1065342.n5.nabble.com/Name-of-Virtual-Registers-tp62256.html</a><br>
Sent from the LLVM - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div></div>