[llvm-commits] [PATCH] Bug 889: make FixedNumOperandTraits and VariadicOperandTraits more robust

Chris Lattner clattner at apple.com
Fri Jan 7 22:55:33 PST 2011


On Jan 5, 2011, at 7:29 AM, Jay Foad wrote:
> http://llvm.org/bugs/show_bug.cgi?id=889
> 
> This bug is about removing virtual methods from Value and its subclasses.

Nice.  It would be really great to fix this.  Doing so will save 8 bytes off *every* IR object when the compiler is built for 64-bit.  This is "a big deal" :).

> While playing with fixes for this bug, I noticed that
> FixedNumOperandTraits and VariadicOperandTraits only work for
> subclasses of User, where the instance data for User is at offset 0 in
> the instance data for the subclass. However, if the subclass has
> virtual methods but User does not, this is no longer true. (There are
> probably other cases where it would not be true, e.g. for a subclass
> that inherits from multiple base classes, and User is not the first
> base class.)
> 
> The attached patch fixes this by making FixedNumOperandTraits and
> VariadicOperandTraits take an extra template argument specifying the
> type of the subclass. It passes "make check".

Makes sense: it is a good intermediate step before zapping all virtual methods, looks great to me!

-Chris



More information about the llvm-commits mailing list