summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2011-10-18 00:23:49 +0000
committerLang Hames <lhames@gmail.com>2011-10-18 00:23:49 +0000
commitd8ffe5bb162bf97a7b0a323d2edcf8b83ca5dada (patch)
tree8b9ff25f14c277e69bad17f42fb0d8140e6cea9f /include
parent6248a546f23e7ffa84c171dc364b922e28467275 (diff)
downloadllvm-d8ffe5bb162bf97a7b0a323d2edcf8b83ca5dada.tar.gz
llvm-d8ffe5bb162bf97a7b0a323d2edcf8b83ca5dada.tar.bz2
llvm-d8ffe5bb162bf97a7b0a323d2edcf8b83ca5dada.tar.xz
Backing out patch. Will refactor to remove the AsmParser dependency on Target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Target/TargetData.h34
1 files changed, 13 insertions, 21 deletions
diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h
index d116f392fb..26fd1870ac 100644
--- a/include/llvm/Target/TargetData.h
+++ b/include/llvm/Target/TargetData.h
@@ -44,7 +44,7 @@ enum AlignTypeEnum {
AGGREGATE_ALIGN = 'a', ///< Aggregate alignment
STACK_ALIGN = 's' ///< Stack objects alignment
};
-
+
/// Target alignment element.
///
/// Stores the alignment data associated with a given alignment type (pointer,
@@ -80,7 +80,7 @@ private:
unsigned StackNaturalAlign; ///< Stack natural alignment
SmallVector<unsigned char, 8> LegalIntWidths; ///< Legal Integers.
-
+
/// Alignments- Where the primitive type alignment data is stored.
///
/// @sa init().
@@ -88,7 +88,7 @@ private:
/// pointers vs. 64-bit pointers by extending TargetAlignment, but for now,
/// we don't.
SmallVector<TargetAlignElem, 16> Alignments;
-
+
/// InvalidAlignmentElem - This member is a signal that a requested alignment
/// type and bit width were not found in the SmallVector.
static const TargetAlignElem InvalidAlignmentElem;
@@ -112,30 +112,19 @@ private:
return &align != &InvalidAlignmentElem;
}
- /// Initialise a TargetData object with default values, ensure that the
- /// target data pass is registered.
- void init();
-
public:
/// Default ctor.
///
/// @note This has to exist, because this is a pass, but it should never be
/// used.
TargetData();
-
+
/// Constructs a TargetData from a specification string. See init().
explicit TargetData(StringRef TargetDescription)
: ImmutablePass(ID) {
- std::string errMsg = parseSpecifier(TargetDescription, this);
- assert(errMsg == "" && "Invalid target data layout string.");
- (void)errMsg;
+ init(TargetDescription);
}
- /// Parses a target data specification string. Returns an error message
- /// if the string is malformed, or the empty string on success. Optionally
- /// initialises a TargetData object if passed a non-null pointer.
- static std::string parseSpecifier(StringRef TargetDescription, TargetData* td = 0);
-
/// Initialize target data from properties stored in the module.
explicit TargetData(const Module *M);
@@ -152,6 +141,9 @@ public:
~TargetData(); // Not virtual, do not subclass this class
+ //! Parse a target data layout string and initialize TargetData alignments.
+ void init(StringRef TargetDescription);
+
/// Target endianness...
bool isLittleEndian() const { return LittleEndian; }
bool isBigEndian() const { return !LittleEndian; }
@@ -160,7 +152,7 @@ public:
/// TargetData. This representation is in the same format accepted by the
/// string constructor above.
std::string getStringRepresentation() const;
-
+
/// isLegalInteger - This function returns true if the specified type is
/// known to be a native integer type supported by the CPU. For example,
/// i64 is not native on most 32-bit CPUs and i37 is not native on any known
@@ -174,7 +166,7 @@ public:
return true;
return false;
}
-
+
bool isIllegalInteger(unsigned Width) const {
return !isLegalInteger(Width);
}
@@ -259,11 +251,11 @@ public:
/// getABITypeAlignment - Return the minimum ABI-required alignment for the
/// specified type.
unsigned getABITypeAlignment(Type *Ty) const;
-
+
/// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for
/// an integer type of the specified bitwidth.
unsigned getABIIntegerTypeAlignment(unsigned BitWidth) const;
-
+
/// getCallFrameTypeAlignment - Return the minimum ABI-required alignment
/// for the specified type when it is part of a call frame.
@@ -313,7 +305,7 @@ public:
assert((Alignment & (Alignment-1)) == 0 && "Alignment must be power of 2!");
return (Val + (Alignment-1)) & ~UIntTy(Alignment-1);
}
-
+
static char ID; // Pass identification, replacement for typeid
};