> On Nov 13, 2014, at 2:27 PM, Fariborz Jahanian <[email protected]> wrote:
> 
> /// ObjCMethodList - a linked list of methods with different signatures.
> struct ObjCMethodList {
>   ObjCMethodDecl *Method;
> +  /// \brief count of methods with same signature.
> +  unsigned Count;
>   /// \brief The next list object and 2 bits for extra info.
>   llvm::PointerIntPair<ObjCMethodList *, 2> NextAndExtraBits;
> 
> -  ObjCMethodList() : Method(nullptr) { }
> -  ObjCMethodList(ObjCMethodDecl *M, ObjCMethodList *C)
> -    : Method(M), NextAndExtraBits(C, 0) { }
> +  ObjCMethodList() : Method(nullptr), Count(0) { }
> +  ObjCMethodList(ObjCMethodDecl *M, unsigned count, ObjCMethodList *C)
> +    : Method(M), Count(count), NextAndExtraBits(C, 0) { }
> 
>   ObjCMethodList *getNext() const { return NextAndExtraBits.getPointer(); }
>   unsigned getBits() const { return NextAndExtraBits.getInt(); }

Since we only care about whether there are multiple methods or a single method, 
and don’t care about the exact count, how about use a bit from 
‘NextAndExtraBits' to indicate if it is a single method or not, and save space ?

So something like:

  llvm::PointerIntPair<ObjCMethodList *, 3> NextAndExtraBits;
  bool isSingle() const { <bit stuff> }

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to