[PATCH] D117262: [NFC] Store Address's alignment into PointerIntPairs
Arthur Eubanks via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 18 21:42:29 PST 2022
aeubanks added inline comments.
Comment at: clang/lib/CodeGen/Address.h:30
+ // Int portion stores lower 3 bits of the log of the alignment.
+ llvm::PointerIntPair<llvm::Type *, 3, unsigned> ElementType;
> Are we guaranteed 3 bits even on 32-bit architectures?
Apparently not, a static assert fires for a 32-bit build of clang. I was assuming 3 was fine based on the PointerIntPair comments.
/// PointerIntPair - This class implements a pair of a pointer and small
/// integer. It is designed to represent this in the space required by one
/// pointer by bitmangling the integer into the low part of the pointer. This
/// can only be done for small integers: typically up to 3 bits, but it depends
/// on the number of bits available according to PointerLikeTypeTraits for the
I suppose we could have a separate 32-bit vs 64-bit implementation of `Address`, although that's not very nice.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits