This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Add iterator ranges for the MVT::SimpleValueType enum.
ClosedPublic

Authored by ab on Dec 4 2014, 1:04 PM.

Details

Summary

While changing backends for D6532, I quickly got fed up with all the loops and casts to MVT::SimpleValueType. This patch adds a simple iterator over that enum, and a few functions to create iterator ranges over the most common types.

As I suspect there's lots of room for bikeshedding (I'm not even comfortable with enum iterators), I'd like to have opinions before changing the rest of the code to use these. I added an X86 example to illustrate the nicer code with this.

Also, I think there's quite a few places that iterate over custom ranges (say [v2i8,v2i64[ ), so maybe a more general (MVT static) make_range would be useful as well (I think it's best if we keep the iterator private).

Diff Detail

Repository
rL LLVM

Event Timeline

ab updated this revision to Diff 16948.Dec 4 2014, 1:04 PM
ab retitled this revision from to [CodeGen] Add iterator ranges for the MVT::SimpleValueType enum..
ab updated this object.
ab edited the test plan for this revision. (Show Details)
ab added a subscriber: Unknown Object (MLST).
ab updated this revision to Diff 17042.Dec 8 2014, 10:33 AM

Ping!

With correct ++ and end iterators..

ab added a comment.Jan 6 2015, 1:01 PM

And another, post-holiday, ping!

hfinkel accepted this revision.Jan 6 2015, 1:47 PM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

LGTM.

This revision is now accepted and ready to land.Jan 6 2015, 1:47 PM
This revision was automatically updated to reflect the committed changes.