<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 5/7/11 11:14 AM, neda 8664 wrote:
<blockquote
cite="mid:BANLkTi=zBQJq0YeQYcFhZV71oYXy5=Gbwg@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="font-family: arial,sans-serif;
font-size: 13px;">
<div id=":zt" class="kf" style="padding-left: 5px;
padding-right: 5px;">
<div class="km" style="margin-left: 1em;">
<div id=":zu" class="kd" style="padding-left: 5px; color:
rgb(119, 119, 119);"><span style="color: rgb(0, 0, 0);"
dir="ltr" id=":13f">Hello all,<br>
<br>
I am a LLVM newer who</span><span style="color: rgb(0,
0, 0);"> want to obtain the use-def chain for all
instruction of a sample code, for this purpose i use
the following code.</span><br>
</div>
</div>
</div>
</span></span></blockquote>
<br>
Disassemble the LLVM bitcode for the file and see what the function
looks like after optimization. It's possible that the optimizations
removed all the computation.<br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:BANLkTi=zBQJq0YeQYcFhZV71oYXy5=Gbwg@mail.gmail.com"
type="cite"><span class="Apple-style-span" style="border-collapse:
separate; color: rgb(0, 0, 0); font-family: 'Times New Roman';
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="font-family: arial,sans-serif;
font-size: 13px;">
<div id=":zt" class="kf" style="padding-left: 5px;
padding-right: 5px;">
<div class="km" style="margin-left: 1em;">
<div id=":zu" class="kd" style="padding-left: 5px; color:
rgb(119, 119, 119);">
</div>
</div>
</div>
</span></span><br>
<div style="margin-left: 40px;">///////////////sample
code://///////////////////////<br>
#include <stdlib.h><br>
#include <stdio.h><br>
#include <time.h><br>
<br>
#define ARRAY_SIZE 5<br>
<br>
<br>
int main() {<br>
int x, y, holder;<br>
int k,z,f,i;<br>
z=0;<br>
f=0;<br>
k=0;<br>
<br>
for(x = 0; x < ARRAY_SIZE; x++)<br>
for(y = 0; y < ARRAY_SIZE-1; y++)<br>
if(x+y>10) {<br>
holder = x+y;<br>
k=z+1;<br>
f=k+x;<br>
if (i>k)<br>
i=i+1;<br>
}<br>
// return 1;<br>
<br>
}<br>
<br>
////////////////////////pass
code://///////////////////////////////<br>
virtual bool runOnFunction(Function &F) {<br>
std::vector<Instruction*> worklist;<br>
<br>
for(inst_iterator I = inst_begin(F), E = inst_end(F); I !=
E; ++I){<br>
worklist.push_back(&*I);<br>
}<br>
<br>
<br>
for(std::vector<Instruction*>::iterator iter =
worklist.begin(); iter != worklist.end(); ++iter){<br>
Instruction* instr = *iter;<br>
errs() << "def: " <<*instr <<
"\n";<br>
for(Value::use_iterator i =
instr->use_begin(), ie = instr->use_end(); i!=ie; ++i){<br>
Value *v = *i;<br>
Instruction *vi =
dyn_cast<Instruction>(*i);<br>
errs() << "\t\t" << *vi <<
"\n";<br>
}<br>
}<br>
<br>
return false;<br>
}<br>
<br>
//////////////output///////////////<br>
def: ret void<br>
<br>
<br>
but my output isn't my aim, <span class="Apple-style-span"
style="border-collapse: separate; color: rgb(0, 0, 0);
font-family: 'Times New Roman'; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: 2; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="font-family:
arial,sans-serif; font-size: 13px;">can anyone help me?<br>
<br>
Thanks<br>
</span></span><br>
<br>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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>