[AVX512] Add class to group common template arguments related to vector type
authorAdam Nemet <anemet@apple.com>
Thu, 21 Aug 2014 19:50:07 +0000 (19:50 +0000)
committerAdam Nemet <anemet@apple.com>
Thu, 21 Aug 2014 19:50:07 +0000 (19:50 +0000)
commit9db660ecaa0c9b1c6cce74570fb02aebdd068a8e
tree2ccc6de18028eb42437dee00fb3e9bd7b8b152eb
parent93695d2395725008c1ce207e8b6a04a982ebb3fc
[AVX512] Add class to group common template arguments related to vector type

We discussed the issue of generality vs. readability of the AVX512 classes
recently.  I proposed this approach to try to hide and centralize the mappings
we commonly perform based on the vector type.  A new class X86VectorVTInfo
captures these.

The idea is to pass an instance of this class to classes/multiclasses instead
of the corresponding ValueType.  Then the class/multiclass can use its field
for things that derive from the type rather than passing all those as separate
arguments.

I modified avx512_valign to demonstrate this new approach.  As you can see
instead of 7 related template parameters we now have one.  The downside is
that we have to refer to fields for the derived values.  I named the argument
'_' in order to make this as invisible as possible.  Please let me know if you
absolutely hate this.  (Also once we allow local initializations in
multiclasses we can recover the original version by assigning the fields to
local variables.)

Another possible use-case for this class is to directly map things, e.g.:

  RegisterClass KRC = X86VectorVTInfo<32, i16>.KRC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216209 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86InstrAVX512.td