<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 7/24/11 10:28 AM, neda 8664 wrote:
<blockquote
cite="mid:CAHbEVmTBaLNw5NDkB_cuQzLKbnS+p54p2iXhzQGeuWyKA08VuQ@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<p class="MsoNormal"><span style="">Hi All</span></p>
<p class="MsoNormal"><span style=""><br>
</span></p>
<p class="MsoNormal"><span style="">I extract Def_Use chain by
following code:</span></p>
<p class="MsoNormal"><br>
<span style=""></span></p>
<p class="MsoNormal"><span style="mso-bidi-language:FA"><br>
</span></p>
<p class="MsoNormal"
style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt
320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt
687.0pt 732.8pt"><span
style="font-size:10.0pt;font-family:"Courier
New";mso-fareast-font-family:"Times New Roman";
color:black">for (Value::use_iterator i = F->use_begin(), e
=
F->use_end(); i != e; ++i)</span></p>
<p class="MsoNormal"
style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt
320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt
687.0pt 732.8pt"><span
style="font-size:10.0pt;font-family:"Courier
New";mso-fareast-font-family:"Times New Roman";
color:black"><span style="mso-spacerun:yes"> </span>if
(Instruction *Inst =
dyn_cast<Instruction>(*i)) {</span></p>
<p class="MsoNormal"
style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt
320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt
687.0pt 732.8pt"><span
style="font-size:10.0pt;font-family:"Courier
New";mso-fareast-font-family:"Times New Roman";
color:black"><span style="mso-spacerun:yes"> </span>errs()
<< "F
is used in instruction:\n";</span></p>
<p class="MsoNormal"
style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt
320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt
687.0pt 732.8pt"><span
style="font-size:10.0pt;font-family:"Courier
New";mso-fareast-font-family:"Times New Roman";
color:black"><span style="mso-spacerun:yes"> </span>errs()
<< *Inst
<< "\n";</span></p>
<p class="MsoNormal"
style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt
320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt
687.0pt 732.8pt"><span
style="font-size:10.0pt;font-family:"Courier
New";mso-fareast-font-family:"Times New Roman";
color:black"><span style="mso-spacerun:yes"> </span>}</span></p>
<p class="MsoNormal"><span style=""><br>
</span></p>
<p class="MsoNormal"><span style="mso-bidi-language:FA"> </span></p>
<p class="MsoNormal"><span style="">Now, I want to distinguish
the register name or memory variable that lead to this data
dependency.</span></p>
</blockquote>
<br>
Can you clarify what you mean? Are you talking about LLVM virtual
registers or physical registers assigned during code generation?<br>
<br>
If you're talking about the former, then recall that LLVM IR is in
SSA form, and each virtual register is equivalent to the instruction
that defines it. In other words, a virtual register and the
instruction that generates its value are one and the same.<br>
<br>
So, if you want to know the name of the virtual register for Inst in
the code above, just call Inst->getName(). The name of the
instruction is the name of the virtual register it defines.<br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:CAHbEVmTBaLNw5NDkB_cuQzLKbnS+p54p2iXhzQGeuWyKA08VuQ@mail.gmail.com"
type="cite">
<p class="MsoNormal"><span style="mso-bidi-language:FA"><br>
</span></p>
<p class="MsoNormal"><span style="mso-bidi-language:FA">Thanks</span></p>
<div style="visibility: hidden; left: -5000px; position: absolute;
z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px;
overflow: hidden; word-wrap: break-word; color: black;
font-size: 10px; text-align: left; line-height: 130%;"
id="avg_ls_inline_popup">
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>