aboutsummaryrefslogtreecommitdiffstats
path: root/docs/ProgrammersManual.html
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-05-27 00:57:51 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-05-27 00:57:51 +0000
commit9a5dc4f7e5821a211eb0c7d04c0afcb8c7d58ee0 (patch)
tree1456ce2db2b68cdfbf0744933157e0b836cc4547 /docs/ProgrammersManual.html
parentf3ecf3a40c07d52c6d7817e0dfa75fa38e33e0d3 (diff)
downloadexternal_llvm-9a5dc4f7e5821a211eb0c7d04c0afcb8c7d58ee0.zip
external_llvm-9a5dc4f7e5821a211eb0c7d04c0afcb8c7d58ee0.tar.gz
external_llvm-9a5dc4f7e5821a211eb0c7d04c0afcb8c7d58ee0.tar.bz2
Add section on the newly added Instruction and subclasses constructor
variant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13802 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/ProgrammersManual.html')
-rw-r--r--docs/ProgrammersManual.html17
1 files changed, 16 insertions, 1 deletions
diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html
index 5cfd0ea..8c678a3 100644
--- a/docs/ProgrammersManual.html
+++ b/docs/ProgrammersManual.html
@@ -808,7 +808,22 @@ into an existing sequence of instructions that form a <tt>BasicBlock</tt>:</p>
<tt>BasicBlock</tt>, and a newly-created instruction we wish to insert
before <tt>*pi</tt>, we do the following: </p>
- <pre> BasicBlock *pb = ...;<br> Instruction *pi = ...;<br> Instruction *newInst = new Instruction(...);<br> pb-&gt;getInstList().insert(pi, newInst); // inserts newInst before pi in pb<br></pre></li>
+ <pre> BasicBlock *pb = ...;<br> Instruction *pi = ...;<br> Instruction *newInst = new Instruction(...);<br> pb-&gt;getInstList().insert(pi, newInst); // inserts newInst before pi in pb<br></pre>
+
+ <p>Appending to the end of a <tt>BasicBlock</tt> is so common that
+ the <tt>Instruction</tt> class and <tt>Instruction</tt>-derived
+ classes provide constructors which take a pointer to a
+ <tt>BasicBlock</tt> to be appended to. For example code that
+ looked like: </p>
+
+ <pre> BasicBlock *pb = ...;<br> Instruction *newInst = new Instruction(...);<br> pb-&gt;getInstList().push_back(newInst); // appends newInst to pb<br></pre>
+
+ <p>becomes: </p>
+
+ <pre> BasicBlock *pb = ...;<br> Instruction *newInst = new Instruction(..., pb);<br></pre>
+
+ <p>which is much cleaner, especially if you are creating
+ long instruction streams.</p></li>
<li>Insertion into an implicit instruction list