[llvm-dev] InstIterator

mbraun via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 9 13:00:58 PDT 2018


Within a basic block this is just normal iterator usage/manipulation:

for (instr : llvm::make_range(FromInstruction.getIterator(), ToInstruction.getIterator())) { ... }

Use std::next() on ToInstruction.getIterator() if you want it included.

- Matthias

> On Apr 9, 2018, at 10:04 AM, Alexandre Isoard via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hello,
> 
> Is there an iterator to iterate over a "range" of instructions in a Function?
> 
> "range" meaning from an instruction::iterator up to an other instruction::iterator which either:
> - point to instructions in the same basic block (the first one first, second one second)
> - point to instructions in different basic block (the BB of the first dominate the BB of the second, and the BB of the second post-dominate the BB of the first)
> 
> I'm not sure if I can trick InstIterator into doing that for me (with a custom BB type?).
> 
> -- 
> Alexandre Isoard
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180409/305f1814/attachment.html>


More information about the llvm-dev mailing list