This is an archive of the discontinued LLVM Phabricator instance.

Add iterator and iterator range to PredIteratorCache
ClosedPublic

Authored by dberlin on Apr 21 2015, 1:00 PM.

Details

Summary

This lets us use range based for loops, and generally makes the interface much closer to
normal pred iterators.

Diff Detail

Repository
rL LLVM

Event Timeline

dberlin retitled this revision from to Add iterator and iterator range to PredIteratorCache.
dberlin updated this object.
dberlin edited the test plan for this revision. (Show Details)
dberlin added a reviewer: chandlerc.
dberlin added a subscriber: Unknown Object (MLST).

Update to make interface more consistent with normal pred interface

dblaikie accepted this revision.Apr 21 2015, 1:53 PM
dblaikie added a reviewer: dblaikie.
dblaikie added a subscriber: dblaikie.

Looks reasonable.

Optional: Rather than having range access as a free function and begin/end as member functions, I'd be inclined to put them at the same level, or possibly even go without begin/end entirely and just have:

PredCache.predecessors(BB);

(or s/predecessors/cached_predecessors/ - though of course both names are somewhat redundant with the name of the object... - maybe it should just be PredCache.get(BB); or something? )

This revision is now accepted and ready to land.Apr 21 2015, 1:53 PM

The redundancy is why i made it a free function, but happy to make it
a member function.

The liklihood we would ever have cached_predecessors(something else) seems low.
:)

I don't see any loops that use begin()/end(), so i'll delete them for now.

I'll make cached_predecessors a member function named get, and if we
find a use for begin/end later, we can add them then.

This revision was automatically updated to reflect the committed changes.