[llvm-dev] RFC: Refactor SubclassData
Craig Topper via llvm-dev
llvm-dev at lists.llvm.org
Fri Dec 27 10:57:27 PST 2019
Ehud, can you elaborate on which classes you're trying to change. I know
some of the classes already use methods
like getSubclassDataFromInstruction() to hide bits from the subclasses.
They could probably shift the data too.
On Fri, Dec 27, 2019 at 9:35 AM Bruno Ricci via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> On 26/12/2019 20:53, Ehud Katz via llvm-dev wrote:
> > I've tested it on MSVC, gcc, clang and icc.
> > The solution in clang (in Decl.h) is not ideal (as you have said
> yourself). The solution I offer, is using a union of fields of class
> BitField (this is a new class that implements a bitfield of a specific type
> requested). With this, the definition, of the required bitfields in the
> subclass data, remains in the hands of the actual class needing them. And
> these are all restricted hierarchically by the superclasses of that class.
> I spent some time packing various bits of data into bit-fields in clang.
> My experience
> is that the solution in clang actually works just fine. The Stmt hierarchy
> has a huge
> number of bit-field classes (I count more than 40! ), but because the
> offsets are
> relative adding a bit means only adding one to an enum value a few lines
> (a static_assert then checks that the union is not too large).
> Bruno Ricci
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev