[cfe-dev] RFC: Reclaiming some bits in IdentifierInfo

dgregor at apple.com dgregor at apple.com
Thu Nov 6 07:25:13 PST 2008


The attached patch reclaims 5 bits in the IdentifierInfo structure by
collapsing the 5-bit field for the Objective-C '@' keywords into the
10-bit field for builtin identifiers.

The motivation for this change is simple: I need 6 bits in IdentifierInfo
to represent the names of all of the overloaded operators in C++
(operator+, operator[], operator new, etc.), but we only had 5 bits free.
This patch makes  room for a compact representation of overloaded operator
names.

The downside to this patch is that it makes
IdentifierInfo::getObjCKeywordId and IdentifierInfo::getBuiltinID slightly
slower--they each have a branch now--but these functions aren't called all
that often (and are typically only called when we're already doing
something expensive), I doubt it matters.

Any comments, or shall I just go ahead?

  - Doug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: identifier-info-bits.patch
Type: text/x-patch
Size: 3289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081106/069f1139/attachment.bin>


More information about the cfe-dev mailing list