+ typedef SmallDenseMap<const GlobalValue *, ModRefInfo, 16> GlobalInfoMapType;
+
+ /// Build a wrapper struct that has 8-byte alignment. All heap allocations
+ /// should provide this much alignment at least, but this makes it clear we
+ /// specifically rely on this amount of alignment.
+ struct LLVM_ALIGNAS(8) AlignedMap {
+ AlignedMap() {}
+ AlignedMap(const AlignedMap &Arg) : Map(Arg.Map) {}
+ GlobalInfoMapType Map;
+ };
+
+ /// Pointer traits for our aligned map.
+ struct AlignedMapPointerTraits {
+ static inline void *getAsVoidPointer(AlignedMap *P) { return P; }
+ static inline AlignedMap *getFromVoidPointer(void *P) {
+ return (AlignedMap *)P;
+ }
+ enum { NumLowBitsAvailable = 3 };
+ static_assert(AlignOf<AlignedMap>::Alignment >= (1 << NumLowBitsAvailable),
+ "AlignedMap insufficiently aligned to have enough low bits.");
+ };
+
+ /// The bit that flags that this function may read any global. This is
+ /// chosen to mix together with ModRefInfo bits.
+ enum { MayReadAnyGlobal = 4 };
+
+ /// Checks to document the invariants of the bit packing here.
+ static_assert((MayReadAnyGlobal & MRI_ModRef) == 0,
+ "ModRef and the MayReadAnyGlobal flag bits overlap.");
+ static_assert(((MayReadAnyGlobal | MRI_ModRef) >>
+ AlignedMapPointerTraits::NumLowBitsAvailable) == 0,
+ "Insufficient low bits to store our flag and ModRef info.");
+