mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
*** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3611 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
72ef35ea5f
commit
aaeb1c160e
@ -244,19 +244,17 @@ exactly equivalent to <tt>(*i).size()</tt> just like you'd expect.
|
|||||||
</ul><h4><a name="iterate_basicblock"><hr size=0>Iterating over the
|
</ul><h4><a name="iterate_basicblock"><hr size=0>Iterating over the
|
||||||
<tt>Instruction</tt>s in a <tt>BasicBlock</tt> </h4><ul>
|
<tt>Instruction</tt>s in a <tt>BasicBlock</tt> </h4><ul>
|
||||||
|
|
||||||
Just like when dealing with <tt>BasicBlock</tt>s in <tt>Function</tt>s, it's
|
Just like when dealing with <tt>BasicBlock</tt>s in
|
||||||
easy to iterate over the individual instructions that make up
|
<tt>Function</tt>s, it's easy to iterate over the individual
|
||||||
<tt>BasicBlock</tt>s. Here's a code snippet that prints out each instruction in
|
instructions that make up <tt>BasicBlock</tt>s. Here's a code snippet
|
||||||
a <tt>BasicBlock</tt>:
|
that prints out each instruction in a <tt>BasicBlock</tt>:
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
// blk is a pointer to a BasicBlock instance
|
// blk is a pointer to a BasicBlock instance
|
||||||
for(BasicBlock::iterator i = blk->begin(), e = blk->end(); i != e; ++i) {
|
for(BasicBlock::iterator i = blk->begin(), e = blk->end(); i != e; ++i) {
|
||||||
// the next statement works since operator<<(ostream&,...)
|
// the next statement works since operator<<(ostream&,...)
|
||||||
// is overloaded for Instruction&
|
// is overloaded for Instruction&
|
||||||
|
|
||||||
cerr << *i << endl;
|
cerr << *i << endl;
|
||||||
}
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
However, this isn't really the best way to print out the contents of a
|
However, this isn't really the best way to print out the contents of a
|
||||||
@ -323,12 +321,8 @@ void printNextInstruction(Instruction* inst) {
|
|||||||
if(it != inst->getParent()->end()) cerr << *it << endl;
|
if(it != inst->getParent()->end()) cerr << *it << endl;
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
Of course, this example is strictly pedagogical, because it'd be much
|
||||||
Of course, this example is strictly pedagogical, because it'd be
|
better to explicitly grab the next instruction directly from inst.
|
||||||
better to do something like
|
|
||||||
|
|
||||||
<pre>if(inst->getNext()) cerr << inst->getNext() << endl;</pre>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- dereferenced iterator = Class &
|
<!-- dereferenced iterator = Class &
|
||||||
iterators have converting constructor for 'Class *'
|
iterators have converting constructor for 'Class *'
|
||||||
@ -401,7 +395,6 @@ virtual runOnFunction(Function& F) {
|
|||||||
We could then print out the value of callCounter (if we wanted to)
|
We could then print out the value of callCounter (if we wanted to)
|
||||||
inside the doFinalization method of our FunctionPass.
|
inside the doFinalization method of our FunctionPass.
|
||||||
|
|
||||||
|
|
||||||
<!-- ======================================================================= -->
|
<!-- ======================================================================= -->
|
||||||
</ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
|
</ul><table width="100%" bgcolor="#441188" border=0 cellpadding=4 cellspacing=0>
|
||||||
<tr><td> </td><td width="100%">
|
<tr><td> </td><td width="100%">
|
||||||
@ -1243,6 +1236,10 @@ pointer to the parent Function.
|
|||||||
<a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
|
<a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
|
||||||
<!-- Created: Tue Aug 6 15:00:33 CDT 2002 -->
|
<!-- Created: Tue Aug 6 15:00:33 CDT 2002 -->
|
||||||
<!-- hhmts start -->
|
<!-- hhmts start -->
|
||||||
|
<<<<<<< ProgrammersManual.html
|
||||||
|
Last modified: Fri Sep 6 18:24:38 EDT 2002
|
||||||
|
=======
|
||||||
Last modified: Fri Sep 6 18:03:31 EDT 2002
|
Last modified: Fri Sep 6 18:03:31 EDT 2002
|
||||||
|
>>>>>>> 1.10
|
||||||
<!-- hhmts end -->
|
<!-- hhmts end -->
|
||||||
</font></body></html>
|
</font></body></html>
|
||||||
|
Loading…
Reference in New Issue
Block a user