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

Ahmed Bougacha ahmed.bougacha at gmail.com
Thu Dec 4 13:04:44 PST 2014


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).

http://reviews.llvm.org/D6537

Files:
  include/llvm/CodeGen/MachineValueType.h
  lib/Target/X86/X86ISelLowering.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6537.16948.patch
Type: text/x-patch
Size: 2910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141204/f23ae0c1/attachment.bin>


More information about the llvm-commits mailing list