Hi Matthias,
Sorry, my original question may have been ambiguously formulated.
I would like a range that handle any of those two cases transparently so
that I can simply iterate without having to handle two different cases.
Today we can build an InstIterator that, for a given set of BB, will
iterate over all of the instructions in each of them. This almost match my
need except that when I am in the BB that contains the "begin"
instruction
I need to start from that one, and when I am in the BB that contains the
"end" instruction I need to stop right before.
In addition, I need to build that list of BB from the DomTree and
PostDomTree (Ideally I don't need the PostDomTree, maybe I can simply
iterate on all BB dominated by the entry until I reach the exit
instruction, which is guaranteed to finish thanks to the post-dominance
property?).
On Mon, Apr 9, 2018 at 1:00 PM, mbraun <mbraun at apple.com> wrote:
> 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
>
>
>
--
*Alexandre Isoard*
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180411/2649e6ca/attachment.html>