diff options
Diffstat (limited to 'docs/ProgrammersManual.html')
-rw-r--r-- | docs/ProgrammersManual.html | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index 548a6828c1..9d4f9615d4 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -22,10 +22,14 @@ in a <tt>Function</tt></a> <li><a href="#iterate_basicblock">Iterating over the <tt>Instruction</tt>s in a <tt>BasicBlock</tt></a> + <li><a href="#iterate_institer">Iterating over the <tt>Instruction</tt>s + in a <tt>Function</tt></a> <li><a href="#iterate_convert">Turning an iterator into a class pointer</a> <li><a href="#iterate_complex">Finding call sites: a more complex example</a> + <li><a href="#iterate_chains">Iterating over def-use & use-def + chains</a> </ul> <li><a href="#simplechanges">Making simple changes</a> <ul> @@ -269,6 +273,19 @@ be removed in the future, so it's best not to depend on it. To print out the pointer value for now, you must cast to <tt>void*</tt>.<p> <!-- _______________________________________________________________________ --> +</ul><h4><a name="iterate_institer"><hr size=0>Iterating over the +<tt>Instruction</tt>s in a <tt>Function</tt></h4><ul> + +<!-- Using llvm/Support/InstIterator.h to directly get at the instructions in a +function. + +Warning: *I returns an Instruction*, not an Instruction& + + --> + + + +<!-- _______________________________________________________________________ --> </ul><h4><a name="iterate_convert"><hr size=0>Turning an iterator into a class pointer </h4><ul> @@ -328,11 +345,9 @@ better to explicitly grab the next instruction directly from inst. iterators automatically convert to 'Class *' except in dyn_cast<> case --> -<!-- -_______________________________________________________________________ ---> </ul><h4><a name="iterate_complex"><hr size=0>Finding call sites: -a slightly more complex example -</h4><ul> +<!--_______________________________________________________________________--> +</ul><h4><a name="iterate_complex"><hr size=0>Finding call sites: a slightly +more complex example </h4><ul> Say that you're writing a FunctionPass and would like to count all the locations in the entire module (that is, across every <tt>Function</tt>) @@ -394,6 +409,17 @@ virtual runOnFunction(Function& F) { We could then print out the value of callCounter (if we wanted to) inside the doFinalization method of our FunctionPass. + +<!--_______________________________________________________________________--> +</ul><h4><a name="iterate_chains"><hr size=0>Iterating over def-use & +use-def chains</h4><ul> + + +<!-- + def-use chains ("finding all users of"): Value::use_begin/use_end + use-def chains ("finding all values used"): User::op_begin/op_end [op=operand] +--> + <!-- ======================================================================= --> </ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0> <tr><td> </td><td width="100%"> @@ -1235,10 +1261,6 @@ pointer to the parent Function. <a href="mailto:sabre@nondot.org">Chris Lattner</a></address> <!-- Created: Tue Aug 6 15:00:33 CDT 2002 --> <!-- hhmts start --> -<<<<<<< ProgrammersManual.html -Last modified: Fri Sep 6 18:24:38 EDT 2002 -======= -Last modified: Fri Sep 6 18:03:31 EDT 2002 ->>>>>>> 1.10 +Last modified: Mon Sep 9 00:48:53 CDT 2002 <!-- hhmts end --> </font></body></html> |