#define LLVM_TARGET_TARGETDATA_H
#include "llvm/Pass.h"
-#include "llvm/System/DataTypes.h"
-#include "llvm/Support/ErrorHandling.h"
#include "llvm/ADT/SmallVector.h"
-#include <string>
namespace llvm {
unsigned char PointerABIAlign; ///< Pointer ABI alignment
unsigned char PointerPrefAlign; ///< Pointer preferred alignment
- //! Where the primitive type alignment data is stored.
- /*!
- @sa init().
- @note Could support multiple size pointer alignments, e.g., 32-bit pointers
- vs. 64-bit pointers by extending TargetAlignment, but for now, we don't.
- */
+ /// Alignments- Where the primitive type alignment data is stored.
+ ///
+ /// @sa init().
+ /// @note Could support multiple size pointer alignments, e.g., 32-bit
+ /// pointers vs. 64-bit pointers by extending TargetAlignment, but for now,
+ /// we don't.
SmallVector<TargetAlignElem, 16> Alignments;
- //! Alignment iterator shorthand
- typedef SmallVector<TargetAlignElem, 16>::iterator align_iterator;
- //! Constant alignment iterator shorthand
- typedef SmallVector<TargetAlignElem, 16>::const_iterator align_const_iterator;
- //! Invalid alignment.
+
+
+
/*!
This member is a signal that a requested alignment type and bit width were
not found in the SmallVector.
static const TargetAlignElem InvalidAlignmentElem;
// Opaque pointer for the StructType -> StructLayout map.
- mutable void* LayoutMap;
+ mutable void *LayoutMap;
//! Set/initialize target alignments
void setAlignment(AlignTypeEnum align_type, unsigned char abi_align,
///
/// Predicate that tests a TargetAlignElem reference returned by get() against
/// InvalidAlignmentElem.
- inline bool validAlignment(const TargetAlignElem &align) const {
- return (&align != &InvalidAlignmentElem);
+ bool validAlignment(const TargetAlignElem &align) const {
+ return &align != &InvalidAlignmentElem;
}
public:
///
/// @note This has to exist, because this is a pass, but it should never be
/// used.
- TargetData() : ImmutablePass(&ID) {
- llvm_report_error("Bad TargetData ctor used. "
- "Tool did not specify a TargetData to use?");
- }
-
+ TargetData();
+
/// Constructs a TargetData from a specification string. See init().
explicit TargetData(StringRef TargetDescription)
: ImmutablePass(&ID) {
}
}
+/// Default ctor.
+///
+/// @note This has to exist, because this is a pass, but it should never be
+/// used.
+TargetData::TargetData() : ImmutablePass(&ID) {
+ llvm_report_error("Bad TargetData ctor used. "
+ "Tool did not specify a TargetData to use?");
+}
+
TargetData::TargetData(const Module *M)
: ImmutablePass(&ID) {
init(M->getDataLayout());
OS << (LittleEndian ? "e" : "E")
<< "-p:" << PointerMemSize*8 << ':' << PointerABIAlign*8
<< ':' << PointerPrefAlign*8;
- for (align_const_iterator I = Alignments.begin(), E = Alignments.end();
- I != E; ++I)
- OS << '-' << (char)I->AlignType << I->TypeBitWidth << ':'
- << I->ABIAlign*8 << ':' << I->PrefAlign*8;
+ for (unsigned i = 0, e = Alignments.size(); i != e; ++i) {
+ const TargetAlignElem &AI = Alignments[i];
+ OS << '-' << (char)AI.AlignType << AI.TypeBitWidth << ':'
+ << AI.ABIAlign*8 << ':' << AI.PrefAlign*8;
+ }
return OS.str();
}