[llvm-commits] [llvm] r107677 - /llvm/trunk/include/llvm/Support/IRBuilder.h

John McCall rjmccall at apple.com
Tue Jul 6 11:51:51 PDT 2010


On Jul 6, 2010, at 11:47 AM, Nick Lewycky wrote:

> On Tue, Jul 6, 2010 at 11:07 AM, John McCall <rjmccall at apple.com> wrote:
> Author: rjmccall
> Date: Tue Jul  6 13:07:52 2010
> New Revision: 107677
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=107677&view=rev
> Log:
> Provide an abstraction to save and restore the current insertion point of
> an IRBuilder.
> 
> 
> Modified:
>    llvm/trunk/include/llvm/Support/IRBuilder.h
> 
> Modified: llvm/trunk/include/llvm/Support/IRBuilder.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=107677&r1=107676&r2=107677&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
> +++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Jul  6 13:07:52 2010
> @@ -97,6 +97,48 @@
>       I->setDebugLoc(CurDbgLocation);
>   }
> 
> +  /// InsertPoint - A saved insertion point.
> +  class InsertPoint {
> +    BasicBlock *Block;
> +    BasicBlock::iterator Point;
> 
> Can't we just store the BasicBlock::iterator? You can always walk from it (aka. Instruction*) to its parent BasicBlock.

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.

If I'm wrong, then absolutely we should just store an iterator.

John.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100706/976ccbe2/attachment.html>


More information about the llvm-commits mailing list