/// pointers vs. 64-bit pointers by extending LayoutAlignment, but for now,
/// we don't.
SmallVector<LayoutAlignElem, 16> Alignments;
- DenseMap<unsigned, PointerAlignElem> Pointers;
+ typedef SmallVector<PointerAlignElem, 8> PointersTy;
+ PointersTy Pointers;
+
+ PointersTy::const_iterator
+ findPointerLowerBound(uint32_t AddressSpace) const {
+ return const_cast<DataLayout *>(this)->findPointerLowerBound(AddressSpace);
+ }
+
+ PointersTy::iterator findPointerLowerBound(uint32_t AddressSpace);
/// InvalidAlignmentElem - This member is a signal that a requested alignment
/// type and bit width were not found in the SmallVector.
return *this;
}
+ bool operator==(const DataLayout &Other) const;
+ bool operator!=(const DataLayout &Other) const { return !(*this == Other); }
+
~DataLayout(); // Not virtual, do not subclass this class
/// Parse a data layout string (with fallback to default values).
/// The width is specified in bits.
///
bool isLegalInteger(unsigned Width) const {
- for (unsigned i = 0, e = (unsigned)LegalIntWidths.size(); i != e; ++i)
- if (LegalIntWidths[i] == Width)
+ for (unsigned LegalIntWidth : LegalIntWidths)
+ if (LegalIntWidth == Width)
return true;
return false;
}
/// fitsInLegalInteger - This function returns true if the specified type fits
/// in a native integer type supported by the CPU. For example, if the CPU
/// only supports i32 as a native integer type, then i27 fits in a legal
- // integer type but i45 does not.
+ /// integer type but i45 does not.
bool fitsInLegalInteger(unsigned Width) const {
- for (unsigned i = 0, e = (unsigned)LegalIntWidths.size(); i != e; ++i)
- if (Width <= LegalIntWidths[i])
+ for (unsigned LegalIntWidth : LegalIntWidths)
+ if (Width <= LegalIntWidth)
return true;
return false;
}