<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 6, 2010, at 11:47 AM, Nick Lewycky wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Tue, Jul 6, 2010 at 11:07 AM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Author: rjmccall<br>
Date: Tue Jul  6 13:07:52 2010<br>
New Revision: 107677<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=107677&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=107677&view=rev</a><br>
Log:<br>
Provide an abstraction to save and restore the current insertion point of<br>
an IRBuilder.<br>
<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/Support/IRBuilder.h<br>
<br>
Modified: llvm/trunk/include/llvm/Support/IRBuilder.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=107677&r1=107676&r2=107677&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=107677&r1=107676&r2=107677&view=diff</a><br>


==============================================================================<br>
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)<br>
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Jul  6 13:07:52 2010<br>
@@ -97,6 +97,48 @@<br>
       I->setDebugLoc(CurDbgLocation);<br>
   }<br>
<br>
+  /// InsertPoint - A saved insertion point.<br>
+  class InsertPoint {<br>
+    BasicBlock *Block;<br>
+    BasicBlock::iterator Point;<br></blockquote><div><br>Can't we just store the BasicBlock::iterator? You can always walk from it (aka. Instruction*) to its parent BasicBlock.</div></div></blockquote><br></div><div>AFAIK this has two problems:  there's no supported way to represent the null insertion point, and there's no way to get from BB->end() to BB.   The former can be easily fixed, but the latter can't.</div><div><br></div><div>If I'm wrong, then absolutely we should just store an iterator.</div><div><br></div><div>John.</div><br></body></html>