<br><br><div class="gmail_quote">On Nov 23, 2007 5:29 PM, Duncan Sands <<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><div class="Ih2E3d"><br>>    I want to know how to dump the a instruction in gdb. I can dump a Module<br>> use M.dump(), also is there any such print function which can be used in gdb<br>> for a single instruction and its operand?
<br><br></div>you can dump most things in LLVM the same way as for a module: if I is your<br>instruction, I.dump() or I->dump() should work, depending on whether it is<br>a pointer or a reference.<br><div class="Ih2E3d">
</div></blockquote><div>thanks very much. so for following iterator, how can I use the dump function?<br>  for (inst_iterator II = inst_begin(F), E = inst_end(F); II != E; ++II) {<br><br>} <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>> also I'm confused with the concept about " the type a instruction", why a<br>> instruction should have a type, how we decide the type of a instruction? for<br>> example, for the following instruction:
<br>> %i = alloca i32, align 4        ; <i32*> [#uses=2]<br>> the following isa is true:<br>> isa<PointerType>(II->getType())<br>><br>> is that the type of a instruction is decided by the type of the result
<br>> operand? and it has nothing to do  with the opcode for a instruction?<br><br></div>You can see the type in the assembler above:<br><div class="Ih2E3d"><br>%i = alloca i32, align 4        ; <i32*> [#uses=2]<br>
<br></div>the <i32*> in the comment at the end tells you that %i is an i32*.<br>The alloca instruction allocates the given type on the stack and<br>returns a pointer to it.  You allocate an i32 so you get a pointer<br>
to an i32 back.<br></blockquote><div>ok,  I will read the language reference manual again. thanks.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>I hope this helps,<br><font color="#888888"><br>Duncan.<br></font></blockquote></div><br><br clear="all"><br>-- <br>Sheng, Tianwei<br>Inst. of High Performance Computing<br>Dept. of Computer Sci. & Tech.<br>Tsinghua Univ.