[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.63 -> 1.64 --- Log message: Fix typo in comment. --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.63 llvm/include/llvm/Target/TargetData.h:1.64 --- llvm/include/llvm/Target/TargetData.h:1.63 Wed May 2 20:11:53 2007 +++ llvm/include/llvm/Target/TargetData.h Sun May 6 08:37:16 2007 @@ -202,7 +202,7 @@ /// requested alignment (if the global has one). unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; - static char ID; // Pass identifcation, replacement for typeid + static char ID; // Pass identification, replacement for typeid }; /// StructLayout - used to lazily calculate structure layout information for a ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.62 -> 1.63 --- Log message: Drop 'const' --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.62 llvm/include/llvm/Target/TargetData.h:1.63 --- llvm/include/llvm/Target/TargetData.h:1.62 Wed May 2 16:39:18 2007 +++ llvm/include/llvm/Target/TargetData.h Wed May 2 20:11:53 2007 @@ -202,7 +202,7 @@ /// requested alignment (if the global has one). unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; - static const char ID; // Pass identifcation, replacement for typeid + static char ID; // Pass identifcation, replacement for typeid }; /// StructLayout - used to lazily calculate structure layout information for a ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.61 -> 1.62 --- Log message: Use 'static const char' instead of 'static const int'. Due to darwin gcc bug, one version of darwin linker coalesces static const int, which defauts PassID based pass identification. --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.61 llvm/include/llvm/Target/TargetData.h:1.62 --- llvm/include/llvm/Target/TargetData.h:1.61 Tue May 1 16:15:46 2007 +++ llvm/include/llvm/Target/TargetData.h Wed May 2 16:39:18 2007 @@ -202,7 +202,7 @@ /// requested alignment (if the global has one). unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; - static const int ID; // Pass identifcation, replacement for typeid + static const char ID; // Pass identifcation, replacement for typeid }; /// StructLayout - used to lazily calculate structure layout information for a ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.60 -> 1.61 --- Log message: Do not use typeinfo to identify pass in pass manager. --- Diffs of the changes: (+6 -3) TargetData.h |9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.60 llvm/include/llvm/Target/TargetData.h:1.61 --- llvm/include/llvm/Target/TargetData.h:1.60 Thu Apr 26 14:39:32 2007 +++ llvm/include/llvm/Target/TargetData.h Tue May 1 16:15:46 2007 @@ -108,14 +108,15 @@ /// /// @note This has to exist, because this is a pass, but it should never be /// used. - TargetData() { + TargetData() : ImmutablePass((intptr_t)&ID) { assert(0 && "ERROR: Bad TargetData ctor used. " "Tool did not specify a TargetData to use?"); abort(); } /// Constructs a TargetData from a specification string. See init(). - TargetData(const std::string &TargetDescription) { + TargetData(const std::string &TargetDescription) +: ImmutablePass((intptr_t)&ID) { init(TargetDescription); } @@ -123,7 +124,7 @@ TargetData(const Module *M); TargetData(const TargetData &TD) : -ImmutablePass(), +ImmutablePass((intptr_t)&ID), LittleEndian(TD.isLittleEndian()), PointerMemSize(TD.PointerMemSize), PointerABIAlign(TD.PointerABIAlign), @@ -200,6 +201,8 @@ /// specified global, returned in log form. This includes an explicitly /// requested alignment (if the global has one). unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; + + static const int ID; // Pass identifcation, replacement for typeid }; /// StructLayout - used to lazily calculate structure layout information for a ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.59 -> 1.60 --- Log message: Fix a typo in a comment. --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.59 llvm/include/llvm/Target/TargetData.h:1.60 --- llvm/include/llvm/Target/TargetData.h:1.59 Mon Mar 19 09:25:02 2007 +++ llvm/include/llvm/Target/TargetData.h Thu Apr 26 14:39:32 2007 @@ -179,7 +179,7 @@ /// const Type *getIntPtrType() const; - /// getIndexOffset - return the offset from the beginning of the type for the + /// getIndexedOffset - return the offset from the beginning of the type for the /// specified indices. This is used to implement getelementptr. /// uint64_t getIndexedOffset(const Type *Ty, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.58 -> 1.59 --- Log message: Fix obvious typo in comment. --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.58 llvm/include/llvm/Target/TargetData.h:1.59 --- llvm/include/llvm/Target/TargetData.h:1.58 Mon Feb 19 16:35:00 2007 +++ llvm/include/llvm/Target/TargetData.h Mon Mar 19 09:25:02 2007 @@ -157,7 +157,7 @@ /// type. uint64_t getTypeSize(const Type *Ty) const; - /// getTypeSizeInBits - Return the number of bytes necessary to hold the + /// getTypeSizeInBits - Return the number of bits necessary to hold the /// specified type. uint64_t getTypeSizeInBits(const Type* Ty) const; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.57 -> 1.58 --- Log message: Implement support for non-standard integer bit widths of any size. The rules alignment is to pick the alignment that corresponds to the smallest specified alignment that is larger than the bit width of the type or the largest specified integer alignment if none are larger than the bitwidth of the type. For the byte size, the size returned is the next larger multiple of the alignment for that type (using the above rule). This patch also changes bit widths from "short" to "uint32_t" to ensure there are enough bits to specify any bit width that LLVM can handle (currently 2^23); 16-bits isn't enough. --- Diffs of the changes: (+6 -6) TargetData.h | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.57 llvm/include/llvm/Target/TargetData.h:1.58 --- llvm/include/llvm/Target/TargetData.h:1.57 Fri Feb 16 18:41:42 2007 +++ llvm/include/llvm/Target/TargetData.h Mon Feb 19 16:35:00 2007 @@ -51,11 +51,11 @@ AlignTypeEnum AlignType : 8; //< Alignment type (AlignTypeEnum) unsigned char ABIAlign; //< ABI alignment for this type/bitw unsigned char PrefAlign; //< Pref. alignment for this type/bitw - short TypeBitWidth; //< Type bit width + uint32_tTypeBitWidth; //< Type bit width /// Initializer static TargetAlignElem get(AlignTypeEnum align_type, unsigned char abi_align, - unsigned char pref_align, short bit_width); + unsigned char pref_align, uint32_t bit_width); /// Equality predicate bool operator==(const TargetAlignElem &rhs) const; /// output stream operator @@ -89,8 +89,8 @@ //! Set/initialize target alignments void setAlignment(AlignTypeEnum align_type, unsigned char abi_align, -unsigned char pref_align, short bit_width); - unsigned getAlignmentInfo(AlignTypeEnum align_type, short bit_width, +unsigned char pref_align, uint32_t bit_width); + unsigned getAlignmentInfo(AlignTypeEnum align_type, uint32_t bit_width, bool ABIAlign) const; //! Internal helper method that returns requested alignment for type. unsigned char getAlignment(const Type *Ty, bool abi_or_pref) const; @@ -161,11 +161,11 @@ /// specified type. uint64_t getTypeSizeInBits(const Type* Ty) const; - /// getTypeAlignmentABI - Return the minimum ABI-required alignment for the + /// getABITypeAlignment - Return the minimum ABI-required alignment for the /// specified type. unsigned char getABITypeAlignment(const Type *Ty) const; - /// getTypeAlignmentPref - Return the preferred stack/global alignment for + /// getPrefTypeAlignment - Return the preferred stack/global alignment for /// the specified type. unsigned char getPrefTypeAlignment(const Type *Ty) const; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.56 -> 1.57 --- Log message: Do not dereference invalid ranges. Generalize targetdata alignment model. This fixes the UnitTests/Vector/sumarray-dbl regressions. --- Diffs of the changes: (+2 -5) TargetData.h |7 ++- 1 files changed, 2 insertions(+), 5 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.56 llvm/include/llvm/Target/TargetData.h:1.57 --- llvm/include/llvm/Target/TargetData.h:1.56 Thu Feb 15 16:07:05 2007 +++ llvm/include/llvm/Target/TargetData.h Fri Feb 16 18:41:42 2007 @@ -56,8 +56,6 @@ /// Initializer static TargetAlignElem get(AlignTypeEnum align_type, unsigned char abi_align, unsigned char pref_align, short bit_width); - /// Less-than predicate - bool operator<(const TargetAlignElem &rhs) const; /// Equality predicate bool operator==(const TargetAlignElem &rhs) const; /// output stream operator @@ -92,9 +90,8 @@ //! Set/initialize target alignments void setAlignment(AlignTypeEnum align_type, unsigned char abi_align, unsigned char pref_align, short bit_width); - //! Get TargetAlignElem from alignment type and bit width - const TargetAlignElem &getAlignment(AlignTypeEnum align_type, - short bit_width) const; + unsigned getAlignmentInfo(AlignTypeEnum align_type, short bit_width, +bool ABIAlign) const; //! Internal helper method that returns requested alignment for type. unsigned char getAlignment(const Type *Ty, bool abi_or_pref) const; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.55 -> 1.56 --- Log message: For PR1195: http://llvm.org/PR1195 : PACKED_ALIGN -> VECTOR_ALIGN --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.55 llvm/include/llvm/Target/TargetData.h:1.56 --- llvm/include/llvm/Target/TargetData.h:1.55 Wed Feb 14 20:11:06 2007 +++ llvm/include/llvm/Target/TargetData.h Thu Feb 15 16:07:05 2007 @@ -36,7 +36,7 @@ /// Enum used to categorize the alignment types stored by TargetAlignElem enum AlignTypeEnum { INTEGER_ALIGN = 'i', ///< Integer type alignment - PACKED_ALIGN = 'v',///< Vector type alignment + VECTOR_ALIGN = 'v',///< Vector type alignment FLOAT_ALIGN = 'f', ///< Floating point type alignment AGGREGATE_ALIGN = 'a' ///< Aggregate alignment }; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.54 -> 1.55 --- Log message: Fixed packed structure breakage from earlier TargetData patch; applied Chris Lattner's code style suggestions. Patch by Scott Michel! --- Diffs of the changes: (+4 -9) TargetData.h | 13 - 1 files changed, 4 insertions(+), 9 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.54 llvm/include/llvm/Target/TargetData.h:1.55 --- llvm/include/llvm/Target/TargetData.h:1.54 Tue Feb 13 23:52:16 2007 +++ llvm/include/llvm/Target/TargetData.h Wed Feb 14 20:11:06 2007 @@ -48,7 +48,7 @@ /// @note The unusual order of elements in the structure attempts to reduce /// padding and make the structure slightly more cache friendly. struct TargetAlignElem { - unsigned char AlignType; //< Alignment type (AlignTypeEnum) + AlignTypeEnum AlignType : 8; //< Alignment type (AlignTypeEnum) unsigned char ABIAlign; //< ABI alignment for this type/bitw unsigned char PrefAlign; //< Pref. alignment for this type/bitw short TypeBitWidth; //< Type bit width @@ -64,18 +64,12 @@ std::ostream &dump(std::ostream &os) const; }; -//! TargetAlignElem output stream inserter -/*! - @sa TargetAlignElem::dump() - */ -std::ostream &operator<<(std::ostream &os, const TargetAlignElem &elem); - class TargetData : public ImmutablePass { private: bool LittleEndian; ///< Defaults to false unsigned char PointerMemSize;///< Pointer size in bytes unsigned char PointerABIAlign; ///< Pointer ABI alignment - unsigned char PointerPrefAlign; ///< Pointer preferred global alignment + unsigned char PointerPrefAlign; ///< Pointer preferred alignment //! Where the primitive type alignment data is stored. /*! @@ -99,7 +93,8 @@ void setAlignment(AlignTypeEnum align_type, unsigned char abi_align, unsigned char pref_align, short bit_width); //! Get TargetAlignElem from alignment type and bit width - const TargetAlignElem &getAlignment(AlignTypeEnum, short) const; + const TargetAlignElem &getAlignment(AlignTypeEnum align_type, + short bit_width) const; //! Internal helper method that returns requested alignment for type. unsigned char getAlignment(const Type *Ty, bool abi_or_pref) const; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
On Feb 13, 2007, at 9:52 PM, Chris Lattner wrote: > Generalize TargetData strings, to support more interesting forms of > data. > Patch by Scott Michel. Scott, > Index: llvm/include/llvm/Target/TargetData.h > diff -u llvm/include/llvm/Target/TargetData.h:1.53 llvm/include/ > llvm/Target/TargetData.h:1.54 > --- llvm/include/llvm/Target/TargetData.h:1.53Sat Feb 10 14:37:40 > 2007 > +++ llvm/include/llvm/Target/TargetData.h Tue Feb 13 23:52:16 2007 > @@ -22,6 +22,8 @@ > > #include "llvm/Pass.h" > #include "llvm/Support/DataTypes.h" > +#include "llvm/ADT/SmallVector.h" > +#include > > namespace llvm { > > @@ -31,45 +33,96 @@ > class StructLayout; > class GlobalVariable; > > -class TargetData : public ImmutablePass { > - bool LittleEndian; // Defaults to false > +/// Enum used to categorize the alignment types stored by > TargetAlignElem > +enum AlignTypeEnum { > + INTEGER_ALIGN = 'i', ///< Integer type alignment > + PACKED_ALIGN = 'v',///< Vector type alignment > + FLOAT_ALIGN = 'f', ///< Floating point type > alignment > + AGGREGATE_ALIGN = 'a' ///< Aggregate alignment > +}; > +/// Target alignment element. > +/// > +/// Stores the alignment data associated with a given alignment > type (pointer, > +/// integer, packed/vector, float) and type bit width. > +/// > +/// @note The unusual order of elements in the structure attempts > to reduce > +/// padding and make the structure slightly more cache friendly. > +struct TargetAlignElem { > + unsigned char AlignType; //< Alignment type > (AlignTypeEnum) This should be: AlignTypeEnum AlignType : 8; > + unsigned char ABIAlign; //< ABI alignment for this > type/bitw > + unsigned char PrefAlign; //< Pref. alignment for this > type/bitw > + short TypeBitWidth; //< Type bit width > + > + /// Initializer > + static TargetAlignElem get(AlignTypeEnum align_type, unsigned > char abi_align, > + unsigned char pref_align, short > bit_width); > + /// Less-than predicate > + bool operator<(const TargetAlignElem &rhs) const; > + /// Equality predicate > + bool operator==(const TargetAlignElem &rhs) const; > + /// output stream operator > + std::ostream &dump(std::ostream &os) const; > +}; > > - // ABI alignments > - unsigned char BoolABIAlignment; // Defaults to 1 byte > - unsigned char ByteABIAlignment; // Defaults to 1 byte > - unsigned char ShortABIAlignment; // Defaults to 2 bytes > - unsigned char IntABIAlignment;// Defaults to 4 bytes > - unsigned char LongABIAlignment; // Defaults to 8 bytes > - unsigned char FloatABIAlignment; // Defaults to 4 bytes > - unsigned char DoubleABIAlignment; // Defaults to 8 bytes > - unsigned char PointerMemSize;// Defaults to 8 bytes > - unsigned char PointerABIAlignment;// Defaults to 8 bytes > - > - // Preferred stack/global type alignments > - unsigned char BoolPrefAlignment;// Defaults to BoolABIAlignment > - unsigned char BytePrefAlignment;// Defaults to ByteABIAlignment > - unsigned char ShortPrefAlignment; // Defaults to > ShortABIAlignment > - unsigned char IntPrefAlignment; // Defaults to IntABIAlignment > - unsigned char LongPrefAlignment;// Defaults to LongABIAlignment > - unsigned char FloatPrefAlignment; // Defaults to > FloatABIAlignment > - unsigned char DoublePrefAlignment; // Defaults to > DoubleABIAlignment > - unsigned char PointerPrefAlignment; // Defaults to > PointerABIAlignment > - unsigned char AggMinPrefAlignment; // Defaults to 0 bytes > +//! TargetAlignElem output stream inserter > +/*! > + @sa TargetAlignElem::dump() > + */ > +std::ostream &operator<<(std::ostream &os, const TargetAlignElem > &elem); > + > +class TargetData : public ImmutablePass { > +private: > + bool LittleEndian; ///< Defaults to false > + unsigned char PointerMemSize;///< Pointer size in bytes > + unsigned char PointerABIAlign; ///< Pointer ABI alignment > + unsigned char PointerPrefAlign; ///< Pointer preferred > global alignment 'Pointer preferred global alignment' ? global what? > + > + //! 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 Alignments; > + //! Alignment iterator shorthand > + typedef SmallVector::iterator align_iterator; I don't think the elements in 'Alignments' should ever be mutable through iterators. I'd suggest using: typedef SmallVector::const_iterator align_iterator; > + //! Invalid alignment. > + /*! > +This member is a signal that a requested alignment type and > bit width were > +not found in the SmallVec
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.53 -> 1.54 --- Log message: Generalize TargetData strings, to support more interesting forms of data. Patch by Scott Michel. --- Diffs of the changes: (+99 -153) TargetData.h | 252 +++ 1 files changed, 99 insertions(+), 153 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.53 llvm/include/llvm/Target/TargetData.h:1.54 --- llvm/include/llvm/Target/TargetData.h:1.53 Sat Feb 10 14:37:40 2007 +++ llvm/include/llvm/Target/TargetData.h Tue Feb 13 23:52:16 2007 @@ -22,6 +22,8 @@ #include "llvm/Pass.h" #include "llvm/Support/DataTypes.h" +#include "llvm/ADT/SmallVector.h" +#include namespace llvm { @@ -31,45 +33,96 @@ class StructLayout; class GlobalVariable; -class TargetData : public ImmutablePass { - bool LittleEndian; // Defaults to false +/// Enum used to categorize the alignment types stored by TargetAlignElem +enum AlignTypeEnum { + INTEGER_ALIGN = 'i', ///< Integer type alignment + PACKED_ALIGN = 'v',///< Vector type alignment + FLOAT_ALIGN = 'f', ///< Floating point type alignment + AGGREGATE_ALIGN = 'a' ///< Aggregate alignment +}; +/// Target alignment element. +/// +/// Stores the alignment data associated with a given alignment type (pointer, +/// integer, packed/vector, float) and type bit width. +/// +/// @note The unusual order of elements in the structure attempts to reduce +/// padding and make the structure slightly more cache friendly. +struct TargetAlignElem { + unsigned char AlignType; //< Alignment type (AlignTypeEnum) + unsigned char ABIAlign; //< ABI alignment for this type/bitw + unsigned char PrefAlign; //< Pref. alignment for this type/bitw + short TypeBitWidth; //< Type bit width + + /// Initializer + static TargetAlignElem get(AlignTypeEnum align_type, unsigned char abi_align, + unsigned char pref_align, short bit_width); + /// Less-than predicate + bool operator<(const TargetAlignElem &rhs) const; + /// Equality predicate + bool operator==(const TargetAlignElem &rhs) const; + /// output stream operator + std::ostream &dump(std::ostream &os) const; +}; - // ABI alignments - unsigned char BoolABIAlignment; // Defaults to 1 byte - unsigned char ByteABIAlignment; // Defaults to 1 byte - unsigned char ShortABIAlignment; // Defaults to 2 bytes - unsigned char IntABIAlignment;// Defaults to 4 bytes - unsigned char LongABIAlignment; // Defaults to 8 bytes - unsigned char FloatABIAlignment; // Defaults to 4 bytes - unsigned char DoubleABIAlignment; // Defaults to 8 bytes - unsigned char PointerMemSize;// Defaults to 8 bytes - unsigned char PointerABIAlignment;// Defaults to 8 bytes - - // Preferred stack/global type alignments - unsigned char BoolPrefAlignment;// Defaults to BoolABIAlignment - unsigned char BytePrefAlignment;// Defaults to ByteABIAlignment - unsigned char ShortPrefAlignment; // Defaults to ShortABIAlignment - unsigned char IntPrefAlignment; // Defaults to IntABIAlignment - unsigned char LongPrefAlignment;// Defaults to LongABIAlignment - unsigned char FloatPrefAlignment; // Defaults to FloatABIAlignment - unsigned char DoublePrefAlignment; // Defaults to DoubleABIAlignment - unsigned char PointerPrefAlignment; // Defaults to PointerABIAlignment - unsigned char AggMinPrefAlignment; // Defaults to 0 bytes +//! TargetAlignElem output stream inserter +/*! + @sa TargetAlignElem::dump() + */ +std::ostream &operator<<(std::ostream &os, const TargetAlignElem &elem); + +class TargetData : public ImmutablePass { +private: + bool LittleEndian; ///< Defaults to false + unsigned char PointerMemSize;///< Pointer size in bytes + unsigned char PointerABIAlign; ///< Pointer ABI alignment + unsigned char PointerPrefAlign; ///< Pointer preferred global 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. + */ + SmallVector Alignments; + //! Alignment iterator shorthand + typedef SmallVector::iterator align_iterator; + //! Constant alignment iterator shorthand + typedef SmallVector::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; + + //! Set/initialize target alignments + void setAlignment(AlignTypeEnum align_type, unsigned char abi_align, +unsigned char pref_a
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.52 -> 1.53 --- Log message: remove dead method. --- Diffs of the changes: (+0 -7) TargetData.h |7 --- 1 files changed, 7 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.52 llvm/include/llvm/Target/TargetData.h:1.53 --- llvm/include/llvm/Target/TargetData.h:1.52 Sat Feb 10 14:15:41 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Feb 10 14:37:40 2007 @@ -22,8 +22,6 @@ #include "llvm/Pass.h" #include "llvm/Support/DataTypes.h" -#include -#include namespace llvm { @@ -249,11 +247,6 @@ uint64_t getIndexedOffset(const Type *Ty, Value* const* Indices, unsigned NumIndices) const; - uint64_t getIndexedOffset(const Type *Ty, -const std::vector &Indices) const { -return getIndexedOffset(Ty, &Indices[0], Indices.size()); - } - /// getStructLayout - Return a StructLayout object, indicating the alignment /// of the struct, its size, and the offsets of its fields. Note that this /// information is lazily cached. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.51 -> 1.52 --- Log message: eliminate the std::vector from StructLayout, allocating the elements immediately after the StructLayout object in memory. This marginally improves locality, speeding up -load-vn -gcse by ~0.8%. --- Diffs of the changes: (+4 -3) TargetData.h |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.51 llvm/include/llvm/Target/TargetData.h:1.52 --- llvm/include/llvm/Target/TargetData.h:1.51 Sat Feb 10 13:59:22 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Feb 10 14:15:41 2007 @@ -275,9 +275,10 @@ /// target machine, based on the TargetData structure. /// class StructLayout { - std::vector MemberOffsets; - unsigned StructAlignment; uint64_t StructSize; + unsigned StructAlignment; + unsigned NumElements; + uint64_t MemberOffsets[1]; // variable sized array! public: uint64_t getSizeInBytes() const { @@ -294,7 +295,7 @@ unsigned getElementContainingOffset(uint64_t Offset) const; uint64_t getElementOffset(unsigned Idx) const { -assert(Idx < MemberOffsets.size() && "Invalid element idx!"); +assert(Idx < NumElements && "Invalid element idx!"); return MemberOffsets[Idx]; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.50 -> 1.51 --- Log message: encapsulate the rest of the StructLayout members. --- Diffs of the changes: (+9 -1) TargetData.h | 10 +- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.50 llvm/include/llvm/Target/TargetData.h:1.51 --- llvm/include/llvm/Target/TargetData.h:1.50 Sat Feb 10 13:55:17 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Feb 10 13:59:22 2007 @@ -276,10 +276,18 @@ /// class StructLayout { std::vector MemberOffsets; -public: unsigned StructAlignment; uint64_t StructSize; +public: + uint64_t getSizeInBytes() const { +return StructSize; + } + + unsigned getAlignment() const { +return StructAlignment; + } + /// getElementContainingOffset - Given a valid offset into the structure, /// return the structure index that contains it. /// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.49 -> 1.50 --- Log message: Privatize StructLayout::MemberOffsets, adding an accessor --- Diffs of the changes: (+7 -2) TargetData.h |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.49 llvm/include/llvm/Target/TargetData.h:1.50 --- llvm/include/llvm/Target/TargetData.h:1.49 Sat Feb 10 13:33:15 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Feb 10 13:55:17 2007 @@ -275,16 +275,21 @@ /// target machine, based on the TargetData structure. /// class StructLayout { -public: std::vector MemberOffsets; - uint64_t StructSize; +public: unsigned StructAlignment; + uint64_t StructSize; /// getElementContainingOffset - Given a valid offset into the structure, /// return the structure index that contains it. /// unsigned getElementContainingOffset(uint64_t Offset) const; + uint64_t getElementOffset(unsigned Idx) const { +assert(Idx < MemberOffsets.size() && "Invalid element idx!"); +return MemberOffsets[Idx]; + } + private: friend class TargetData; // Only TargetData can create this class StructLayout(const StructType *ST, const TargetData &TD); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.48 -> 1.49 --- Log message: Change TargetData::getIndexedOffset interface to not require indices in a vector. --- Diffs of the changes: (+6 -1) TargetData.h |7 ++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.48 llvm/include/llvm/Target/TargetData.h:1.49 --- llvm/include/llvm/Target/TargetData.h:1.48 Wed Jan 24 01:03:39 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Feb 10 13:33:15 2007 @@ -247,7 +247,12 @@ /// specified indices. This is used to implement getelementptr. /// uint64_t getIndexedOffset(const Type *Ty, -const std::vector &Indices) const; +Value* const* Indices, unsigned NumIndices) const; + + uint64_t getIndexedOffset(const Type *Ty, +const std::vector &Indices) const { +return getIndexedOffset(Ty, &Indices[0], Indices.size()); + } /// getStructLayout - Return a StructLayout object, indicating the alignment /// of the struct, its size, and the offsets of its fields. Note that this ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.47 -> 1.48 --- Log message: Renamed getTypeAlignmentShift() to getPreferredTypeAlignmentShift(). --- Diffs of the changes: (+2 -2) TargetData.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.47 llvm/include/llvm/Target/TargetData.h:1.48 --- llvm/include/llvm/Target/TargetData.h:1.47 Mon Jan 22 17:14:52 2007 +++ llvm/include/llvm/Target/TargetData.h Wed Jan 24 01:03:39 2007 @@ -233,10 +233,10 @@ /// the specified type. unsigned char getTypeAlignmentPref(const Type *Ty) const; - /// getTypeAlignmentShift - Return the preferred alignment for the + /// getPreferredTypeAlignmentShift - Return the preferred alignment for the /// specified type, returned as log2 of the value (a shift amount). /// - unsigned char getTypeAlignmentShift(const Type *Ty) const; + unsigned char getPreferredTypeAlignmentShift(const Type *Ty) const; /// getIntPtrType - Return an unsigned integer type that is the same size or /// greater to the host pointer size. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.46 -> 1.47 --- Log message: Update comment. --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.46 llvm/include/llvm/Target/TargetData.h:1.47 --- llvm/include/llvm/Target/TargetData.h:1.46 Sat Jan 20 17:32:04 2007 +++ llvm/include/llvm/Target/TargetData.h Mon Jan 22 17:14:52 2007 @@ -233,7 +233,7 @@ /// the specified type. unsigned char getTypeAlignmentPref(const Type *Ty) const; - /// getTypeAlignmentShift - Return the minimum required alignment for the + /// getTypeAlignmentShift - Return the preferred alignment for the /// specified type, returned as log2 of the value (a shift amount). /// unsigned char getTypeAlignmentShift(const Type *Ty) const; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.45 -> 1.46 --- Log message: Implement a getTypeSizeInBits method. This helps in transforms that want to ensure the bit size of a type is identical before proceeding. --- Diffs of the changes: (+4 -0) TargetData.h |4 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.45 llvm/include/llvm/Target/TargetData.h:1.46 --- llvm/include/llvm/Target/TargetData.h:1.45 Sat Jan 20 17:07:13 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Jan 20 17:32:04 2007 @@ -221,6 +221,10 @@ /// uint64_t getTypeSize(const Type *Ty) const; + /// getTypeSizeInBits - Return the number of bytes necessary to hold the + /// specified type. + uint64_t getTypeSizeInBits(const Type* Ty) const; + /// getTypeAlignmentABI - Return the minimum ABI-required alignment for the /// specified type. unsigned char getTypeAlignmentABI(const Type *Ty) const; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.44 -> 1.45 --- Log message: TargetData assumes (and some regression tests depend on it) that the size of an unspecified datatype in the datalayout is capped by the size of a pointer. --- Diffs of the changes: (+2 -1) TargetData.h |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.44 llvm/include/llvm/Target/TargetData.h:1.45 --- llvm/include/llvm/Target/TargetData.h:1.44 Sat Jan 20 16:35:55 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Jan 20 17:07:13 2007 @@ -70,7 +70,8 @@ /// Constructs a TargetData from a string of the following format: /// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" /// The above string is considered the default, and any values not specified - /// in the string will be assumed to be as above. + /// in the string will be assumed to be as above, with the caveat that unspecified + /// values are always assumed to be smaller than the size of a pointer. TargetData(const std::string &TargetDescription) { init(TargetDescription); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.43 -> 1.44 --- Log message: Teach TargetData to handle 'preferred' alignment for each target, and use these alignment amounts to align scalars when we can. Patch by Scott Michel! --- Diffs of the changes: (+131 -50) TargetData.h | 181 ++- 1 files changed, 131 insertions(+), 50 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.43 llvm/include/llvm/Target/TargetData.h:1.44 --- llvm/include/llvm/Target/TargetData.h:1.43 Wed Jan 17 01:28:48 2007 +++ llvm/include/llvm/Target/TargetData.h Sat Jan 20 16:35:55 2007 @@ -35,15 +35,28 @@ class TargetData : public ImmutablePass { bool LittleEndian; // Defaults to false - unsigned char BoolAlignment; // Defaults to 1 byte - unsigned char ByteAlignment; // Defaults to 1 byte - unsigned char ShortAlignment;// Defaults to 2 bytes - unsigned char IntAlignment; // Defaults to 4 bytes - unsigned char LongAlignment; // Defaults to 8 bytes - unsigned char FloatAlignment;// Defaults to 4 bytes - unsigned char DoubleAlignment; // Defaults to 8 bytes - unsigned char PointerSize; // Defaults to 8 bytes - unsigned char PointerAlignment; // Defaults to 8 bytes + + // ABI alignments + unsigned char BoolABIAlignment; // Defaults to 1 byte + unsigned char ByteABIAlignment; // Defaults to 1 byte + unsigned char ShortABIAlignment; // Defaults to 2 bytes + unsigned char IntABIAlignment;// Defaults to 4 bytes + unsigned char LongABIAlignment; // Defaults to 8 bytes + unsigned char FloatABIAlignment; // Defaults to 4 bytes + unsigned char DoubleABIAlignment; // Defaults to 8 bytes + unsigned char PointerMemSize;// Defaults to 8 bytes + unsigned char PointerABIAlignment;// Defaults to 8 bytes + + // Preferred stack/global type alignments + unsigned char BoolPrefAlignment;// Defaults to BoolABIAlignment + unsigned char BytePrefAlignment;// Defaults to ByteABIAlignment + unsigned char ShortPrefAlignment; // Defaults to ShortABIAlignment + unsigned char IntPrefAlignment; // Defaults to IntABIAlignment + unsigned char LongPrefAlignment;// Defaults to LongABIAlignment + unsigned char FloatPrefAlignment; // Defaults to FloatABIAlignment + unsigned char DoublePrefAlignment; // Defaults to DoubleABIAlignment + unsigned char PointerPrefAlignment; // Defaults to PointerABIAlignment + unsigned char AggMinPrefAlignment; // Defaults to 0 bytes public: /// Default ctor - This has to exist, because this is a pass, but it should @@ -68,15 +81,24 @@ TargetData(const TargetData &TD) : ImmutablePass(), LittleEndian(TD.isLittleEndian()), -BoolAlignment(TD.getBoolAlignment()), -ByteAlignment(TD.getByteAlignment()), -ShortAlignment(TD.getShortAlignment()), -IntAlignment(TD.getIntAlignment()), -LongAlignment(TD.getLongAlignment()), -FloatAlignment(TD.getFloatAlignment()), -DoubleAlignment(TD.getDoubleAlignment()), -PointerSize(TD.getPointerSize()), -PointerAlignment(TD.getPointerAlignment()) { +BoolABIAlignment(TD.getBoolABIAlignment()), +ByteABIAlignment(TD.getByteABIAlignment()), +ShortABIAlignment(TD.getShortABIAlignment()), +IntABIAlignment(TD.getIntABIAlignment()), +LongABIAlignment(TD.getLongABIAlignment()), +FloatABIAlignment(TD.getFloatABIAlignment()), +DoubleABIAlignment(TD.getDoubleABIAlignment()), +PointerMemSize(TD.getPointerSize()), +PointerABIAlignment(TD.getPointerABIAlignment()), +BoolPrefAlignment(TD.getBoolPrefAlignment()), +BytePrefAlignment(TD.getBytePrefAlignment()), +ShortPrefAlignment(TD.getShortPrefAlignment()), +IntPrefAlignment(TD.getIntPrefAlignment()), +LongPrefAlignment(TD.getLongPrefAlignment()), +FloatPrefAlignment(TD.getFloatPrefAlignment()), +DoublePrefAlignment(TD.getDoublePrefAlignment()), +PointerPrefAlignment(TD.getPointerPrefAlignment()), +AggMinPrefAlignment(TD.getAggMinPrefAlignment()) { } ~TargetData(); // Not virtual, do not subclass this class @@ -86,10 +108,16 @@ /// Parse a target data layout string, initializing the various TargetData /// members along the way. A TargetData specification string looks like /// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" and specifies the - /// target's endianess, the alignments of various data types and - /// the size of pointers. The "-" is used as a separator and ":" - /// separates a token from its argument. Alignment is indicated in bits - /// and internally converted to the appropriate number of bytes. + /// target's endianess, the ABI alignments of various data types and + /// the size of pointers. + /// + /// "-" is used as a separator and ":" separates a token from its argument. +
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.42 -> 1.43 --- Log message: make doxygen comment much better. Patch by B. Scott Michel! --- Diffs of the changes: (+31 -1) TargetData.h | 32 +++- 1 files changed, 31 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.42 llvm/include/llvm/Target/TargetData.h:1.43 --- llvm/include/llvm/Target/TargetData.h:1.42 Tue Oct 24 15:48:29 2006 +++ llvm/include/llvm/Target/TargetData.h Wed Jan 17 01:28:48 2007 @@ -81,8 +81,38 @@ ~TargetData(); // Not virtual, do not subclass this class - /// init - Specify configuration if not available at ctor time. + /// Parse a target data layout string and initialize TargetData members. /// + /// Parse a target data layout string, initializing the various TargetData + /// members along the way. A TargetData specification string looks like + /// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" and specifies the + /// target's endianess, the alignments of various data types and + /// the size of pointers. The "-" is used as a separator and ":" + /// separates a token from its argument. Alignment is indicated in bits + /// and internally converted to the appropriate number of bytes. + /// + /// Valid tokens: + /// + /// E specifies big endian architecture (1234) [default] + /// e specifies little endian architecture (4321) + /// p:[ptr size]:[ptr align] specifies pointer size and alignment + /// [default = 64:64] + /// d:[align] specifies double floating point alignment + /// [default = 64] + /// f:[align] specifies single floating point alignment + /// [default = 32] + /// l:[align] specifies long integer alignment + /// [default = 64] + /// i:[align] specifies integer alignment + /// [default = 32] + /// s:[align] specifies short integer alignment + /// [default = 16] + /// b:[align] specifies byte data type alignment + /// [default = 8] + /// B:[align] specifies boolean data type alignment + /// [default = 8] + /// + /// All other token types are silently ignored. void init(const std::string &TargetDescription); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.41 -> 1.42 --- Log message: TargetData is not subclassed. So no need to have virtual method. --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.41 llvm/include/llvm/Target/TargetData.h:1.42 --- llvm/include/llvm/Target/TargetData.h:1.41 Tue Oct 24 15:32:14 2006 +++ llvm/include/llvm/Target/TargetData.h Tue Oct 24 15:48:29 2006 @@ -147,7 +147,7 @@ /// getPreferredAlignmentLog - Return the preferred alignment of the /// specified global, returned in log form. This includes an explicitly /// requested alignment (if the global has one). - virtual unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; + unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; }; /// StructLayout - used to lazily calculate structure layout information for a ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.40 -> 1.41 --- Log message: Move getPreferredAlignmentLog from AsmPrinter to TargetData --- Diffs of the changes: (+6 -0) TargetData.h |6 ++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.40 llvm/include/llvm/Target/TargetData.h:1.41 --- llvm/include/llvm/Target/TargetData.h:1.40 Fri Jun 16 13:21:53 2006 +++ llvm/include/llvm/Target/TargetData.h Tue Oct 24 15:32:14 2006 @@ -31,6 +31,7 @@ class Type; class StructType; class StructLayout; +class GlobalVariable; class TargetData : public ImmutablePass { bool LittleEndian; // Defaults to false @@ -142,6 +143,11 @@ /// removed, this method must be called whenever a StructType is removed to /// avoid a dangling pointer in this cache. void InvalidateStructLayoutInfo(const StructType *Ty) const; + + /// getPreferredAlignmentLog - Return the preferred alignment of the + /// specified global, returned in log form. This includes an explicitly + /// requested alignment (if the global has one). + virtual unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; }; /// StructLayout - used to lazily calculate structure layout information for a ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.39 -> 1.40 --- Log message: Simplify the targetdata ctor by not passing in a "targetname" which is always ignored. --- Diffs of the changes: (+14 -8) TargetData.h | 22 ++ 1 files changed, 14 insertions(+), 8 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.39 llvm/include/llvm/Target/TargetData.h:1.40 --- llvm/include/llvm/Target/TargetData.h:1.39 Fri Jun 16 13:11:07 2006 +++ llvm/include/llvm/Target/TargetData.h Fri Jun 16 13:21:53 2006 @@ -45,19 +45,26 @@ unsigned char PointerAlignment; // Defaults to 8 bytes public: + /// Default ctor - This has to exist, because this is a pass, but it should + /// never be used. + TargetData() { +assert(0 && "ERROR: Bad TargetData ctor used. " + "Tool did not specify a TargetData to use?"); +abort(); + } + /// Constructs a TargetData from a string of the following format: /// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" /// The above string is considered the default, and any values not specified /// in the string will be assumed to be as above. - TargetData(const std::string &TargetName = "", - const std::string &TargetDescription = "") { -assert(!TargetName.empty() && - "ERROR: Tool did not specify a target data to use!"); + TargetData(const std::string &TargetDescription) { init(TargetDescription); } - - // Copy constructor - TargetData (const TargetData &TD) : + + /// Initialize target data from properties stored in the module. + TargetData(const Module *M); + + TargetData(const TargetData &TD) : ImmutablePass(), LittleEndian(TD.isLittleEndian()), BoolAlignment(TD.getBoolAlignment()), @@ -71,7 +78,6 @@ PointerAlignment(TD.getPointerAlignment()) { } - TargetData(const std::string &ToolName, const Module *M); ~TargetData(); // Not virtual, do not subclass this class /// init - Specify configuration if not available at ctor time. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.38 -> 1.39 --- Log message: Remove ctor with each piece specifyable (which causes overload ambiguities), add a new init method. --- Diffs of the changes: (+11 -10) TargetData.h | 21 +++-- 1 files changed, 11 insertions(+), 10 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.38 llvm/include/llvm/Target/TargetData.h:1.39 --- llvm/include/llvm/Target/TargetData.h:1.38 Sat May 20 18:28:54 2006 +++ llvm/include/llvm/Target/TargetData.h Fri Jun 16 13:11:07 2006 @@ -45,20 +45,16 @@ unsigned char PointerAlignment; // Defaults to 8 bytes public: - TargetData(const std::string &TargetName = "", - bool LittleEndian = false, - unsigned char PtrSize = 8, - unsigned char PtrAl = 8, unsigned char DoubleAl = 8, - unsigned char FloatAl = 4, unsigned char LongAl = 8, - unsigned char IntAl = 4, unsigned char ShortAl = 2, - unsigned char ByteAl = 1, unsigned char BoolAl = 1); - /// Constructs a TargetData from a string of the following format: /// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" /// The above string is considered the default, and any values not specified /// in the string will be assumed to be as above. - TargetData(const std::string &TargetName, - const std::string &TargetDescription); + TargetData(const std::string &TargetName = "", + const std::string &TargetDescription = "") { +assert(!TargetName.empty() && + "ERROR: Tool did not specify a target data to use!"); +init(TargetDescription); + } // Copy constructor TargetData (const TargetData &TD) : @@ -78,6 +74,11 @@ TargetData(const std::string &ToolName, const Module *M); ~TargetData(); // Not virtual, do not subclass this class + /// init - Specify configuration if not available at ctor time. + /// + void init(const std::string &TargetDescription); + + /// Target endianness... bool isLittleEndian() const { return LittleEndian; } bool isBigEndian() const { return!LittleEndian; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.37 -> 1.38 --- Log message: Make TargetData strings less redundant. --- Diffs of the changes: (+1 -1) TargetData.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.37 llvm/include/llvm/Target/TargetData.h:1.38 --- llvm/include/llvm/Target/TargetData.h:1.37 Fri May 12 02:01:44 2006 +++ llvm/include/llvm/Target/TargetData.h Sat May 20 18:28:54 2006 @@ -54,7 +54,7 @@ unsigned char ByteAl = 1, unsigned char BoolAl = 1); /// Constructs a TargetData from a string of the following format: - /// "E-p:64:64-d:64:64-f:32:32-l:64:64-i:32:32-s:16:16-b:8:8-B:8:8" + /// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" /// The above string is considered the default, and any values not specified /// in the string will be assumed to be as above. TargetData(const std::string &TargetName, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.36 -> 1.37 --- Log message: Add a method to generate a string representation from a TargetData. This continues the work on PR 761: http://llvm.cs.uiuc.edu/PR761 . --- Diffs of the changes: (+5 -0) TargetData.h |5 + 1 files changed, 5 insertions(+) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.36 llvm/include/llvm/Target/TargetData.h:1.37 --- llvm/include/llvm/Target/TargetData.h:1.36 Fri May 12 00:49:47 2006 +++ llvm/include/llvm/Target/TargetData.h Fri May 12 02:01:44 2006 @@ -94,6 +94,11 @@ unsigned char getPointerSize() const { return PointerSize; } unsigned char getPointerSizeInBits() const { return8*PointerSize; } + /// getStringRepresentation - Return the string representation of the + /// TargetData. This representation is in the same format accepted by the + /// string constructor above. + std::string getStringRepresentation() const; + /// getTypeSize - Return the number of bytes necessary to hold the specified /// type. /// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.35 -> 1.36 --- Log message: Add a new constructor to TargetData that builds a TargetData from its string representation. This is part of PR 761: http://llvm.cs.uiuc.edu/PR761 . --- Diffs of the changes: (+7 -0) TargetData.h |7 +++ 1 files changed, 7 insertions(+) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.35 llvm/include/llvm/Target/TargetData.h:1.36 --- llvm/include/llvm/Target/TargetData.h:1.35 Thu May 4 16:17:35 2006 +++ llvm/include/llvm/Target/TargetData.h Fri May 12 00:49:47 2006 @@ -53,6 +53,13 @@ unsigned char IntAl = 4, unsigned char ShortAl = 2, unsigned char ByteAl = 1, unsigned char BoolAl = 1); + /// Constructs a TargetData from a string of the following format: + /// "E-p:64:64-d:64:64-f:32:32-l:64:64-i:32:32-s:16:16-b:8:8-B:8:8" + /// The above string is considered the default, and any values not specified + /// in the string will be assumed to be as above. + TargetData(const std::string &TargetName, + const std::string &TargetDescription); + // Copy constructor TargetData (const TargetData &TD) : ImmutablePass(), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.34 -> 1.35 --- Log message: Fix this to be a proper copy ctor --- Diffs of the changes: (+11 -11) TargetData.h | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.34 llvm/include/llvm/Target/TargetData.h:1.35 --- llvm/include/llvm/Target/TargetData.h:1.34 Tue May 2 20:29:56 2006 +++ llvm/include/llvm/Target/TargetData.h Thu May 4 16:17:35 2006 @@ -54,18 +54,18 @@ unsigned char ByteAl = 1, unsigned char BoolAl = 1); // Copy constructor - TargetData (const TargetData *TD) : + TargetData (const TargetData &TD) : ImmutablePass(), -LittleEndian(TD->isLittleEndian()), -BoolAlignment(TD->getBoolAlignment()), -ByteAlignment(TD->getByteAlignment()), -ShortAlignment(TD->getShortAlignment()), -IntAlignment(TD->getIntAlignment()), -LongAlignment(TD->getLongAlignment()), -FloatAlignment(TD->getFloatAlignment()), -DoubleAlignment(TD->getDoubleAlignment()), -PointerSize(TD->getPointerSize()), -PointerAlignment(TD->getPointerAlignment()) { +LittleEndian(TD.isLittleEndian()), +BoolAlignment(TD.getBoolAlignment()), +ByteAlignment(TD.getByteAlignment()), +ShortAlignment(TD.getShortAlignment()), +IntAlignment(TD.getIntAlignment()), +LongAlignment(TD.getLongAlignment()), +FloatAlignment(TD.getFloatAlignment()), +DoubleAlignment(TD.getDoubleAlignment()), +PointerSize(TD.getPointerSize()), +PointerAlignment(TD.getPointerAlignment()) { } TargetData(const std::string &ToolName, const Module *M); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h TargetLowering.h TargetMachine.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.33 -> 1.34 TargetLowering.h updated: 1.69 -> 1.70 TargetMachine.h updated: 1.63 -> 1.64 --- Log message: Refactor TargetMachine, pushing handling of TargetData into the target-specific subclasses. This has one caller-visible change: getTargetData() now returns a pointer instead of a reference. This fixes PR 759: http://llvm.cs.uiuc.edu/PR759 . --- Diffs of the changes: (+15 -23) TargetData.h | 22 +++--- TargetLowering.h |4 ++-- TargetMachine.h | 12 ++-- 3 files changed, 15 insertions(+), 23 deletions(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.33 llvm/include/llvm/Target/TargetData.h:1.34 --- llvm/include/llvm/Target/TargetData.h:1.33 Fri Jan 13 18:06:42 2006 +++ llvm/include/llvm/Target/TargetData.h Tue May 2 20:29:56 2006 @@ -54,18 +54,18 @@ unsigned char ByteAl = 1, unsigned char BoolAl = 1); // Copy constructor - TargetData (const TargetData &TD) : + TargetData (const TargetData *TD) : ImmutablePass(), -LittleEndian(TD.isLittleEndian()), -BoolAlignment(TD.getBoolAlignment()), -ByteAlignment(TD.getByteAlignment()), -ShortAlignment(TD.getShortAlignment()), -IntAlignment(TD.getIntAlignment()), -LongAlignment(TD.getLongAlignment()), -FloatAlignment(TD.getFloatAlignment()), -DoubleAlignment(TD.getDoubleAlignment()), -PointerSize(TD.getPointerSize()), -PointerAlignment(TD.getPointerAlignment()) { +LittleEndian(TD->isLittleEndian()), +BoolAlignment(TD->getBoolAlignment()), +ByteAlignment(TD->getByteAlignment()), +ShortAlignment(TD->getShortAlignment()), +IntAlignment(TD->getIntAlignment()), +LongAlignment(TD->getLongAlignment()), +FloatAlignment(TD->getFloatAlignment()), +DoubleAlignment(TD->getDoubleAlignment()), +PointerSize(TD->getPointerSize()), +PointerAlignment(TD->getPointerAlignment()) { } TargetData(const std::string &ToolName, const Module *M); Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.69 llvm/include/llvm/Target/TargetLowering.h:1.70 --- llvm/include/llvm/Target/TargetLowering.h:1.69 Thu Apr 20 03:54:13 2006 +++ llvm/include/llvm/Target/TargetLowering.h Tue May 2 20:29:56 2006 @@ -78,7 +78,7 @@ virtual ~TargetLowering(); TargetMachine &getTargetMachine() const { return TM; } - const TargetData &getTargetData() const { return TD; } + const TargetData *getTargetData() const { return TD; } bool isLittleEndian() const { return IsLittleEndian; } MVT::ValueType getPointerTy() const { return PointerTy; } @@ -648,7 +648,7 @@ std::vector LegalAddressScales; TargetMachine &TM; - const TargetData &TD; + const TargetData *TD; /// IsLittleEndian - True if this is a little endian target. /// Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.63 llvm/include/llvm/Target/TargetMachine.h:1.64 --- llvm/include/llvm/Target/TargetMachine.h:1.63 Thu Apr 20 13:17:21 2006 +++ llvm/include/llvm/Target/TargetMachine.hTue May 2 20:29:56 2006 @@ -50,19 +50,11 @@ /// class TargetMachine { const std::string Name; - const TargetData DataLayout; // Calculates type size & alignment TargetMachine(const TargetMachine&); // DO NOT IMPLEMENT void operator=(const TargetMachine&); // DO NOT IMPLEMENT protected: // Can only create subclasses... - TargetMachine(const std::string &name, bool LittleEndian = false, -unsigned char PtrSize = 8, unsigned char PtrAl = 8, -unsigned char DoubleAl = 8, unsigned char FloatAl = 4, -unsigned char LongAl = 8, unsigned char IntAl = 4, -unsigned char ShortAl = 2, unsigned char ByteAl = 1, -unsigned char BoolAl = 1); - - TargetMachine(const std::string &name, const TargetData &TD); + TargetMachine(const std::string &name) : Name(name) { }; /// This constructor is used for targets that support arbitrary TargetData /// layouts, like the C backend. It initializes the TargetData to match that @@ -101,7 +93,7 @@ virtual const TargetInstrInfo*getInstrInfo() const { return 0; } virtual const TargetFrameInfo*getFrameInfo() const { return 0; } virtual TargetLowering*getTargetLowering() const { return 0; } - const TargetData &getTargetData() const { return DataLayout; } + virtual const TargetData*getTargetData() const { return 0; } /// getSubtarget - This method returns a pointer to the specified type of /// TargetSubtarget. In debug builds, it verifies that the object being ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h
Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.32 -> 1.33 --- Log message: Add a new InvalidateStructLayoutInfo method and some comments. --- Diffs of the changes: (+9 -0) TargetData.h |9 + 1 files changed, 9 insertions(+) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.32 llvm/include/llvm/Target/TargetData.h:1.33 --- llvm/include/llvm/Target/TargetData.h:1.32 Sat Apr 23 17:35:26 2005 +++ llvm/include/llvm/Target/TargetData.h Fri Jan 13 18:06:42 2006 @@ -113,7 +113,16 @@ uint64_t getIndexedOffset(const Type *Ty, const std::vector &Indices) const; + /// getStructLayout - Return a StructLayout object, indicating the alignment + /// of the struct, its size, and the offsets of its fields. Note that this + /// information is lazily cached. const StructLayout *getStructLayout(const StructType *Ty) const; + + /// InvalidateStructLayoutInfo - TargetData speculatively caches StructLayout + /// objects. If a TargetData object is alive when types are being refined and + /// removed, this method must be called whenever a StructType is removed to + /// avoid a dangling pointer in this cache. + void InvalidateStructLayoutInfo(const StructType *Ty) const; }; /// StructLayout - used to lazily calculate structure layout information for a ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits