aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/IR/DataLayout.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-16 16:01:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-16 16:01:22 +0000
commit71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch)
tree5343938942df402b49ec7300a1c25a2d4ccd5821 /include/llvm/IR/DataLayout.h
parent31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff)
Diffstat (limited to 'include/llvm/IR/DataLayout.h')
-rw-r--r--include/llvm/IR/DataLayout.h42
1 files changed, 16 insertions, 26 deletions
diff --git a/include/llvm/IR/DataLayout.h b/include/llvm/IR/DataLayout.h
index 6f37669f9768..1930d48577d4 100644
--- a/include/llvm/IR/DataLayout.h
+++ b/include/llvm/IR/DataLayout.h
@@ -104,6 +104,7 @@ private:
/// Defaults to false.
bool BigEndian;
+ unsigned AllocaAddrSpace;
unsigned StackNaturalAlign;
enum ManglingModeT {
@@ -118,8 +119,19 @@ private:
SmallVector<unsigned char, 8> LegalIntWidths;
- /// \brief Primitive type alignment data.
- SmallVector<LayoutAlignElem, 16> Alignments;
+ /// \brief Primitive type alignment data. This is sorted by type and bit
+ /// width during construction.
+ typedef SmallVector<LayoutAlignElem, 16> AlignmentsTy;
+ AlignmentsTy Alignments;
+
+ AlignmentsTy::const_iterator
+ findAlignmentLowerBound(AlignTypeEnum AlignType, uint32_t BitWidth) const {
+ return const_cast<DataLayout *>(this)->findAlignmentLowerBound(AlignType,
+ BitWidth);
+ }
+
+ AlignmentsTy::iterator
+ findAlignmentLowerBound(AlignTypeEnum AlignType, uint32_t BitWidth);
/// \brief The string representation used to create this DataLayout
std::string StringRepresentation;
@@ -134,14 +146,6 @@ private:
PointersTy::iterator findPointerLowerBound(uint32_t AddressSpace);
- /// This member is a signal that a requested alignment type and bit width were
- /// not found in the SmallVector.
- static const LayoutAlignElem InvalidAlignmentElem;
-
- /// This member is a signal that a requested pointer type and bit width were
- /// not found in the DenseSet.
- static const PointerAlignElem InvalidPointerElem;
-
// The StructType -> StructLayout map.
mutable void *LayoutMap;
@@ -159,22 +163,6 @@ private:
/// Internal helper method that returns requested alignment for type.
unsigned getAlignment(Type *Ty, bool abi_or_pref) const;
- /// \brief Valid alignment predicate.
- ///
- /// Predicate that tests a LayoutAlignElem reference returned by get() against
- /// InvalidAlignmentElem.
- bool validAlignment(const LayoutAlignElem &align) const {
- return &align != &InvalidAlignmentElem;
- }
-
- /// \brief Valid pointer predicate.
- ///
- /// Predicate that tests a PointerAlignElem reference returned by get()
- /// against \c InvalidPointerElem.
- bool validPointer(const PointerAlignElem &align) const {
- return &align != &InvalidPointerElem;
- }
-
/// Parses a target data specification string. Assert if the string is
/// malformed.
void parseSpecifier(StringRef LayoutDescription);
@@ -199,6 +187,7 @@ public:
clear();
StringRepresentation = DL.StringRepresentation;
BigEndian = DL.isBigEndian();
+ AllocaAddrSpace = DL.AllocaAddrSpace;
StackNaturalAlign = DL.StackNaturalAlign;
ManglingMode = DL.ManglingMode;
LegalIntWidths = DL.LegalIntWidths;
@@ -254,6 +243,7 @@ public:
}
unsigned getStackAlignment() const { return StackNaturalAlign; }
+ unsigned getAllocaAddrSpace() const { return AllocaAddrSpace; }
bool hasMicrosoftFastStdCallMangling() const {
return ManglingMode == MM_WinCOFFX86;