[llvm-commits] [llvm] r167347 - in /llvm/trunk: include/llvm/Target/TargetTransformImpl.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h test/Analysis/CostModel/X86/arith.ll test/Analysis/CostModel/X86/vectorized-loop.ll

Chris Lattner clattner at apple.com
Mon Nov 5 16:35:41 PST 2012


On Nov 4, 2012, at 1:29 AM, Nadav Rotem <nrotem at apple.com> wrote:
>> Is there some way to have tblgen generate this information from the .td files?
> The TargetLowering interface provides most of the information that we need, and we only want to save information about custom lowered instructions.  Any table that we are going to have is going to be sparse.  Table entries need to contain: the instruction kind, the type (two types in case of a cast), and a feature set (such as HasAVX). 
> 
> I can see us going in two directions:
> 
> 1.  We can use table-gen to auto-generate code that checks for the different lowering rules. Similar to ISel.
> 
> 2. We can construct a map using hard-coded lists. I am thinking about something similar to the way that the memory operand folding is done on x86. 
> 
> I think that I prefer to go with #2, but I want to spend more time on the VectorTargetInfo interfaces before we decide. 

I don't have a strong opinion on how tblgen should encode this (dense array, sparse array, hash table, etc), I just don't want a lot of redundancy between the .td and .cpp file if we can avoid it.  Just "having a pattern" for some operation in some VT (yes, under some predicate, like HasAVX) is a really great sign that it is cheap.

Custom C++ code could then be used in cases where an pattern is not cheap.  I really regret not having the TargetLowering operation legality tables not be inferred from the .td files from the get-go.

-Chris




More information about the llvm-commits mailing list