<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Sorry, I have typo in my question.<br>
I will be careful next time.<br>
<br>
This is how I obtain the source operands of an instruction.<br>
// -----------------------------------------------------------------<br>
BasicBlock::iterator it;<br>
...<br>
for(int k=0; k<OpNum; k++){<br>
errs()<<it->getOperand(k)<<" ";<br>
}<br>
...<br>
//
--------------------------------------------------------------------<br>
<br>
Also I try<br>
it->getVaueID(), and it->InstructionVal<br>
to get destination operand.<br>
They don't work and I know what they return now ).<br>
<br>
<a class="moz-txt-link-rfc2396E" href="mailto:ofv@wanadoo.es"><ofv@wanadoo.es></a>(My computer can't display your name
correctly, and I am sorry for this.) is right, <br>
getOperand() actually returns Value*. The reason that I see string
like '0x9063489' is that I print it using<br>
'errs()<<'. I notice that all the variables with different
names have different strings like '0x9063489' and <br>
I think I can use it to identify different variables as well as
instruction instances (I need this to extract data <br>
dependence graph/data flow graph from each basicblcok). I guess
there may be operator<< overload<br>
in value.h and I looked into the source code value.h, but I didn't
find it. I still do not know how to get<br>
strings/number like '0x9063489' without using errs()<<. <br>
<br>
As for destination operand or instruction, I need similar numbers or
strings to identify all the variables <br>
and instruction instances. John gave a suggestion, but I am not sure
whether I got it right. <br>
//----------------------------------------------------------------------------------------------<br>
--In LLVM, the instruction <b class="moz-txt-star"><span
class="moz-txt-tag">*</span>is<span class="moz-txt-tag">*</span></b>
the same as it's result. Let us say that instruction pointer I1
points to an add instruction and I2 points to a subtract
instruction. Then:
<br>
<br>
--I2->setOperand (I1, 1);
<br>
<br>
--will make instruction I1 the first operand of instruction I2 (note
that I didn't check the exact arguments of the setOperand() method,
so they may be off, but I think you get the --idea).
<br>
//----------------------------------------------------------------------------------------<br>
Since I can get the representation (I mean the strings like
0x9063489 ) of all source operands, and I can trace back to get the
instruction's representation. <br>
It seems a little bit wired for me because I am finding unique
representations for variables and instruction instances to determine
the instruction dependence.<br>
In this case, now finding dependence turns to be a preliminary issue
).<br>
<br>
--------------------------------------------------------------------<br>
<br>
I think people may get confused about what I am talking. Just make
it short and clear. <br>
<br>
For example, I have a few instructions in the same basic block. <br>
instruction1: add %a %b %c<br>
...<br>
instruction10: add %e %d %a<br>
<br>
Now I use this code to identify the source operands. <br>
<br>
for(int k=0; k<OpNum; k++){<br>
errs()<<it->getOperand(k)<<" ";<br>
}<br>
<br>
I find that<br>
%b->0x90<br>
%c->0x91<br>
%d->0x92<br>
%a->0x93<br>
but I do not know<br>
%a->?<br>
%e->?<br>
Actually I am expecting that %a->0x93, and then I can declare
that instruction10 depends instruction1.<br>
<br>
<br>
On 5/9/2012 11:14 AM, =?utf-8?Q?=C3=93scar_Fuentes?= wrote:
<blockquote cite="mid:87aa1i11wx.fsf@wanadoo.es" type="cite">
<pre wrap="">::getValueID, don't you?
</pre>
</blockquote>
<br>
</body>
</html>