Here is the second step of #1, this does the datalayout renaming. I've also 
renamed TargetAlignElem and TargetTypeEnum as they are not 'Target' objects but 
Layout objects.

The next step will be to remap TargetData to DataLayout.

From: Chandler Carruth [mailto:[email protected]]
Sent: Thursday, October 04, 2012 11:46 AM
To: Villmow, Micah
Cc: Chris Lattner; [email protected] LLVM; [email protected] cfe
Subject: Re: [llvm-commits] [cfe-commits] [Patch] Move TargetData from Target 
to Support/VMCore

On Thu, Oct 4, 2012 at 11:40 AM, Villmow, Micah 
<[email protected]<mailto:[email protected]>> wrote:
Chris, the problem with steps #2/#3 is that plenty of clients have forward 
declarations of TargetData and the typedef won't work in this case, so I need 
to update the clients anyways.

What about this sequence:
1) Introduce include/llvm/DataLayout.h and lib/VMCore/DataLayout.cpp(which is a 
functionally equivalent copy of TargetData).

First just copy the files over without any edits, then in a second commit 
rename stuff to DataLayout. That way we can see the rename. It's all dead code 
until #2

2) Update each client to point to DataLayout.

This step needs to be a single commit.

Otherwise, this seems a reasonable way to cope with forward declarations. They 
make renaming really hard. =/

3) Remove TargetData.




> -----Original Message-----
> From: Chris Lattner [mailto:[email protected]<mailto:[email protected]>]
> Sent: Tuesday, October 02, 2012 10:02 PM
> To: Villmow, Micah
> Cc: Evan Cheng; Hal Finkel; 
> [email protected]<mailto:[email protected]> LLVM; Nadav Rotem;
> [email protected]<mailto:[email protected]> cfe
> Subject: Re: [cfe-commits] [llvm-commits] [Patch] Move TargetData from
> Target to Support/VMCore
>
>
> On Oct 2, 2012, at 5:57 PM, "Villmow, Micah" 
> <[email protected]<mailto:[email protected]>>
> wrote:
>
> > Chris,
> > Here is an attachd patch. It is quite large because the number of
> places within the LLVM tree where TargetData is used.
> >
> > My only question is did you want a new subdirectory, VMCore, created
> in the include directory?
>
> My mistake, sorry for being unclear.  More specifically, please do this
> as a series of independent patches:
>
> 1. Add a typedef for TargetData -> DataLayout in TargetData.h 2. Rename
> the TargetData class & implementation (but not the file or clients) to
> DataLayout.  Switch the typedef to DataLayout -> TargetData.
> 3. Rename uses of the "TargetData" typedef to be DataLayout.  Remove the
> typedef.
> 4. Move lib/Target/TargetData.cpp to lib/VMCore/DataLayout.cpp 5. Move
> the contents the header from include/llvm/Target/TargetData.h to
> include/llvm/DataLayout.h and keep TargetData.h as just a single
> #include of the new header.
> 6. Update all the clients to switch from TargetData.h to DataLayout.h in
> the various projects (clang/llvm/dragonegg/lldb) that include it.  When
> they're all converted, remove the forwarding header.
>
> The idea of each of these steps is that they become "obvious" and really
> simple to review.  Thanks for tackling this Micah!
>
> -Chris
>
> >
> > Micah
> >
> >> -----Original Message-----
> >> From: Chris Lattner [mailto:[email protected]<mailto:[email protected]>]
> >> Sent: Tuesday, October 02, 2012 9:26 AM
> >> To: Villmow, Micah
> >> Cc: Evan Cheng; Hal Finkel; 
> >> [email protected]<mailto:[email protected]> LLVM; Nadav
> >> Rotem; [email protected]<mailto:[email protected]> cfe
> >> Subject: Re: [cfe-commits] [llvm-commits] [Patch] Move TargetData
> >> from Target to Support/VMCore
> >>
> >> Yes.  How about just llvm/VMCore/DataLayout.h?
> >>
> >> -Chris
> >>
> >> On Oct 2, 2012, at 8:55 AM, "Villmow, Micah" 
> >> <[email protected]<mailto:[email protected]>>
> >> wrote:
> >>
> >>> Chris,
> >>> So if I renamed it to something like DataLayoutParser, that would be
> >> acceptable to move the functionality into core?
> >>>
> >>> Micah
> >>>
> >>>> -----Original Message-----
> >>>> From: Chris Lattner 
> >>>> [mailto:[email protected]<mailto:[email protected]>]
> >>>> Sent: Sunday, September 30, 2012 9:03 AM
> >>>> To: Evan Cheng
> >>>> Cc: Hal Finkel; Villmow, Micah; 
> >>>> [email protected]<mailto:[email protected]> LLVM;
> >>>> Nadav Rotem; [email protected]<mailto:[email protected]> cfe
> >>>> Subject: Re: [cfe-commits] [llvm-commits] [Patch] Move TargetData
> >>>> from Target to Support/VMCore
> >>>>
> >>>> On Sep 26, 2012, at 9:18 PM, Evan Cheng 
> >>>> <[email protected]<mailto:[email protected]>>
> wrote:
> >>>>> On Sep 26, 2012, at 11:07 AM, Hal Finkel 
> >>>>> <[email protected]<mailto:[email protected]>> wrote:
> >>>>>
> >>>>>> On Tue, 25 Sep 2012 16:16:22 -0700 Evan Cheng
> >>>>>> <[email protected]<mailto:[email protected]>> wrote:
> >>>>>>
> >>>>>>> Sorry, I understand why you are requesting this but I thinking
> >>>>>>> moving TargetData to support is conceptually dirty.
> >>>>>>
> >>>>>> Can you please explain this? I think that the opposite is true:
> >>>>>> Having TargetData in Target is conceptually dirty. TargetData
> >>>>>> represents 'target information that is available to frontends and
> >>>>>> IR-level passes without linking to the target descriptions'.
> >>>>>
> >>>>> Agreed.
> >>>>>
> >>>>>> As a result, I feel
> >>>>>> that TargetData does not belong with the target-description
> >>>>>> infrastructure, and so it should be moved out of Target so that
> >>>>>> everyone can use it.
> >>>>>
> >>>>> I agree it should be moved out but at least it's target related.
> >>>> Polluting Support / VMCore with it is just worse. They have nothing
> >>>> to do with target data conceptually. This is all a matter of taste.
> >>>> I'll let Chris make the decision.
> >>>>
> >>>> I agree with this patch in principle: TargetData should be moved to
> >>>> VMCore.  However, the class should also be renamed.
> >>>>
> >>>> -Chris
> >>>
> >>>
> >
> > <move_TargetData_to_DataLayout.txt>
>



_______________________________________________
llvm-commits mailing list
[email protected]<mailto:[email protected]>
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Index: include/llvm/DataLayout.h
===================================================================
--- include/llvm/DataLayout.h   (revision 165262)
+++ include/llvm/DataLayout.h   (working copy)
@@ -1,4 +1,4 @@
-//===-- llvm/Target/TargetData.h - Data size & alignment info ---*- C++ 
-*-===//
+//===--------- llvm/DataLayout.h - Data size & alignment info ---*- C++ 
-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +7,7 @@
 //
 
//===----------------------------------------------------------------------===//
 //
-// This file defines target properties related to datatype 
size/offset/alignment
+// This file defines layout properties related to datatype 
size/offset/alignment
 // information.  It uses lazy annotations to cache information about how
 // structure types are laid out and used.
 //
@@ -17,8 +17,8 @@
 //
 
//===----------------------------------------------------------------------===//
 
-#ifndef LLVM_TARGET_TARGETDATA_H
-#define LLVM_TARGET_TARGETDATA_H
+#ifndef LLVM_DATALAYOUT_H
+#define LLVM_DATALAYOUT_H
 
 #include "llvm/Pass.h"
 #include "llvm/ADT/SmallVector.h"
@@ -36,7 +36,7 @@
 template<typename T>
 class ArrayRef;
 
-/// Enum used to categorize the alignment types stored by TargetAlignElem
+/// Enum used to categorize the alignment types stored by LayoutAlignElem
 enum AlignTypeEnum {
   INTEGER_ALIGN = 'i',               ///< Integer type alignment
   VECTOR_ALIGN = 'v',                ///< Vector type alignment
@@ -45,33 +45,33 @@
   STACK_ALIGN = 's'                  ///< Stack objects alignment
 };
 
-/// Target alignment element.
+/// Layout alignment element.
 ///
 /// Stores the alignment data associated with a given alignment type (pointer,
 /// integer, 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 {
+struct LayoutAlignElem {
   unsigned AlignType    : 8;  ///< Alignment type (AlignTypeEnum)
   unsigned TypeBitWidth : 24; ///< Type bit width
   unsigned ABIAlign     : 16; ///< ABI alignment for this type/bitw
   unsigned PrefAlign    : 16; ///< Pref. alignment for this type/bitw
 
   /// Initializer
-  static TargetAlignElem get(AlignTypeEnum align_type, unsigned abi_align,
+  static LayoutAlignElem get(AlignTypeEnum align_type, unsigned abi_align,
                              unsigned pref_align, uint32_t bit_width);
   /// Equality predicate
-  bool operator==(const TargetAlignElem &rhs) const;
+  bool operator==(const LayoutAlignElem &rhs) const;
 };
 
-/// TargetData - This class holds a parsed version of the target data layout
+/// DataLayout - This class holds a parsed version of the target data layout
 /// string in a module and provides methods for querying it.  The target data
 /// layout string is specified *by the target* - a frontend generating LLVM IR
 /// is required to generate the right target data for the target being 
codegen'd
 /// to.  If some measure of portability is desired, an empty string may be
 /// specified in the module.
-class TargetData : public ImmutablePass {
+class DataLayout : public ImmutablePass {
 private:
   bool          LittleEndian;          ///< Defaults to false
   unsigned      PointerMemSize;        ///< Pointer size in bytes
@@ -85,13 +85,13 @@
   ///
   /// @sa init().
   /// @note Could support multiple size pointer alignments, e.g., 32-bit
-  /// pointers vs. 64-bit pointers by extending TargetAlignment, but for now,
+  /// pointers vs. 64-bit pointers by extending LayoutAlignment, but for now,
   /// we don't.
-  SmallVector<TargetAlignElem, 16> Alignments;
+  SmallVector<LayoutAlignElem, 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;
+  static const LayoutAlignElem InvalidAlignmentElem;
 
   // The StructType -> StructLayout map.
   mutable void *LayoutMap;
@@ -106,13 +106,13 @@
 
   /// Valid alignment predicate.
   ///
-  /// Predicate that tests a TargetAlignElem reference returned by get() 
against
+  /// Predicate that tests a LayoutAlignElem reference returned by get() 
against
   /// InvalidAlignmentElem.
-  bool validAlignment(const TargetAlignElem &align) const {
+  bool validAlignment(const LayoutAlignElem &align) const {
     return &align != &InvalidAlignmentElem;
   }
 
-  /// Initialise a TargetData object with default values, ensure that the
+  /// Initialise a DataLayout object with default values, ensure that the
   /// target data pass is registered.
   void init();
 
@@ -121,25 +121,26 @@
   ///
   /// @note This has to exist, because this is a pass, but it should never be
   /// used.
-  TargetData();
+  DataLayout();
 
-  /// Constructs a TargetData from a specification string. See init().
-  explicit TargetData(StringRef TargetDescription)
+  /// Constructs a DataLayout from a specification string. See init().
+  explicit DataLayout(StringRef LayoutDescription)
     : ImmutablePass(ID) {
-    std::string errMsg = parseSpecifier(TargetDescription, this);
+    std::string errMsg = parseSpecifier(LayoutDescription, this);
     assert(errMsg == "" && "Invalid target data layout string.");
     (void)errMsg;
   }
 
   /// 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);
+  /// initialises a DataLayout object if passed a non-null pointer.
+  static std::string parseSpecifier(StringRef LayoutDescription,
+                                    DataLayout* td = 0);
 
   /// Initialize target data from properties stored in the module.
-  explicit TargetData(const Module *M);
+  explicit DataLayout(const Module *M);
 
-  TargetData(const TargetData &TD) :
+  DataLayout(const DataLayout &TD) :
     ImmutablePass(ID),
     LittleEndian(TD.isLittleEndian()),
     PointerMemSize(TD.PointerMemSize),
@@ -150,14 +151,14 @@
     LayoutMap(0)
   { }
 
-  ~TargetData();  // Not virtual, do not subclass this class
+  ~DataLayout();  // Not virtual, do not subclass this class
 
-  /// Target endianness...
+  /// Layout endianness...
   bool isLittleEndian() const { return LittleEndian; }
   bool isBigEndian() const { return !LittleEndian; }
 
   /// getStringRepresentation - Return the string representation of the
-  /// TargetData.  This representation is in the same format accepted by the
+  /// DataLayout.  This representation is in the same format accepted by the
   /// string constructor above.
   std::string getStringRepresentation() const;
 
@@ -195,13 +196,13 @@
     return false;
   }
 
-  /// Target pointer alignment
+  /// Layout pointer alignment
   unsigned getPointerABIAlignment() const { return PointerABIAlign; }
-  /// Return target's alignment for stack-based pointers
+  /// Return layout's alignment for stack-based pointers
   unsigned getPointerPrefAlignment() const { return PointerPrefAlign; }
-  /// Target pointer size
+  /// Layout pointer size
   unsigned getPointerSize()         const { return PointerMemSize; }
-  /// Target pointer size, in bits
+  /// Layout pointer size, in bits
   unsigned getPointerSizeInBits()   const { return 8*PointerMemSize; }
 
   /// Size examples:
@@ -318,7 +319,7 @@
 };
 
 /// StructLayout - used to lazily calculate structure layout information for a
-/// target machine, based on the TargetData structure.
+/// target machine, based on the DataLayout structure.
 ///
 class StructLayout {
   uint64_t StructSize;
@@ -354,8 +355,8 @@
   }
 
 private:
-  friend class TargetData;   // Only TargetData can create this class
-  StructLayout(StructType *ST, const TargetData &TD);
+  friend class DataLayout;   // Only DataLayout can create this class
+  StructLayout(StructType *ST, const DataLayout &TD);
 };
 
 } // End llvm namespace
Index: include/llvm/InitializePasses.h
===================================================================
--- include/llvm/InitializePasses.h     (revision 165250)
+++ include/llvm/InitializePasses.h     (working copy)
@@ -247,6 +247,7 @@
 void initializeTailDuplicatePassPass(PassRegistry&);
 void initializeTargetPassConfigPass(PassRegistry&);
 void initializeTargetDataPass(PassRegistry&);
+void initializeDataLayoutPass(PassRegistry&);
 void initializeTargetLibraryInfoPass(PassRegistry&);
 void initializeTwoAddressInstructionPassPass(PassRegistry&);
 void initializeTypeBasedAliasAnalysisPass(PassRegistry&);
Index: lib/VMCore/DataLayout.cpp
===================================================================
--- lib/VMCore/DataLayout.cpp   (revision 165262)
+++ lib/VMCore/DataLayout.cpp   (working copy)
@@ -1,4 +1,4 @@
-//===-- TargetData.cpp - Data size & alignment routines 
--------------------==//
+//===-- DataLayout.cpp - Data size & alignment routines 
--------------------==//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +7,7 @@
 //
 
//===----------------------------------------------------------------------===//
 //
-// This file defines target properties related to datatype 
size/offset/alignment
+// This file defines layout properties related to datatype 
size/offset/alignment
 // information.
 //
 // This structure should be created once, filled in if the defaults are not
@@ -16,7 +16,7 @@
 //
 
//===----------------------------------------------------------------------===//
 
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
@@ -31,17 +31,17 @@
 #include <cstdlib>
 using namespace llvm;
 
-// Handle the Pass registration stuff necessary to use TargetData's.
+// Handle the Pass registration stuff necessary to use DataLayout's.
 
 // Register the default SparcV9 implementation...
-INITIALIZE_PASS(TargetData, "targetdata", "Target Data Layout", false, true)
-char TargetData::ID = 0;
+INITIALIZE_PASS(DataLayout, "datalayout", "Data Layout", false, true)
+char DataLayout::ID = 0;
 
 
//===----------------------------------------------------------------------===//
 // Support for StructLayout
 
//===----------------------------------------------------------------------===//
 
-StructLayout::StructLayout(StructType *ST, const TargetData &TD) {
+StructLayout::StructLayout(StructType *ST, const DataLayout &TD) {
   assert(!ST->isOpaque() && "Cannot get layout of opaque structs");
   StructAlignment = 0;
   StructSize = 0;
@@ -54,7 +54,7 @@
 
     // Add padding if necessary to align the data element properly.
     if ((StructSize & (TyAlign-1)) != 0)
-      StructSize = TargetData::RoundUpAlignment(StructSize, TyAlign);
+      StructSize = DataLayout::RoundUpAlignment(StructSize, TyAlign);
 
     // Keep track of maximum alignment constraint.
     StructAlignment = std::max(TyAlign, StructAlignment);
@@ -69,7 +69,7 @@
   // Add padding to the end of the struct so that it could be put in an array
   // and all array elements would be aligned correctly.
   if ((StructSize & (StructAlignment-1)) != 0)
-    StructSize = TargetData::RoundUpAlignment(StructSize, StructAlignment);
+    StructSize = DataLayout::RoundUpAlignment(StructSize, StructAlignment);
 }
 
 
@@ -94,14 +94,14 @@
 }
 
 
//===----------------------------------------------------------------------===//
-// TargetAlignElem, TargetAlign support
+// LayoutAlignElem, LayoutAlign support
 
//===----------------------------------------------------------------------===//
 
-TargetAlignElem
-TargetAlignElem::get(AlignTypeEnum align_type, unsigned abi_align,
+LayoutAlignElem
+LayoutAlignElem::get(AlignTypeEnum align_type, unsigned abi_align,
                      unsigned pref_align, uint32_t bit_width) {
   assert(abi_align <= pref_align && "Preferred alignment worse than ABI!");
-  TargetAlignElem retval;
+  LayoutAlignElem retval;
   retval.AlignType = align_type;
   retval.ABIAlign = abi_align;
   retval.PrefAlign = pref_align;
@@ -110,18 +110,18 @@
 }
 
 bool
-TargetAlignElem::operator==(const TargetAlignElem &rhs) const {
+LayoutAlignElem::operator==(const LayoutAlignElem &rhs) const {
   return (AlignType == rhs.AlignType
           && ABIAlign == rhs.ABIAlign
           && PrefAlign == rhs.PrefAlign
           && TypeBitWidth == rhs.TypeBitWidth);
 }
 
-const TargetAlignElem
-TargetData::InvalidAlignmentElem = { (AlignTypeEnum)0xFF, 0, 0, 0 };
+const LayoutAlignElem
+DataLayout::InvalidAlignmentElem = { (AlignTypeEnum)0xFF, 0, 0, 0 };
 
 
//===----------------------------------------------------------------------===//
-//                       TargetData Class Implementation
+//                       DataLayout Class Implementation
 
//===----------------------------------------------------------------------===//
 
 /// getInt - Get an integer ignoring errors.
@@ -131,8 +131,8 @@
   return Result;
 }
 
-void TargetData::init() {
-  initializeTargetDataPass(*PassRegistry::getPassRegistry());
+void DataLayout::init() {
+  initializeDataLayoutPass(*PassRegistry::getPassRegistry());
 
   LayoutMap = 0;
   LittleEndian = false;
@@ -156,7 +156,7 @@
   setAlignment(AGGREGATE_ALIGN, 0,  8,  0);  // struct
 }
 
-std::string TargetData::parseSpecifier(StringRef Desc, TargetData *td) {
+std::string DataLayout::parseSpecifier(StringRef Desc, DataLayout *td) {
 
   if (td)
     td->init();
@@ -256,7 +256,7 @@
       unsigned PrefAlign = PrefAlignBits / 8;
       if (PrefAlign == 0)
         PrefAlign = ABIAlign;
-      
+
       if (td)
         td->setAlignment(AlignType, ABIAlign, PrefAlign, Size);
       break;
@@ -266,8 +266,8 @@
       do {
         int Width = getInt(Specifier);
         if (Width <= 0) {
-          return std::string("invalid native integer size \'") + 
Specifier.str() +
-                 "\', must be a positive integer.";
+          return std::string("invalid native integer size \'") +
+            Specifier.str() + "\', must be a positive integer.";
         }
         if (td && Width != 0)
           td->LegalIntWidths.push_back(Width);
@@ -298,20 +298,20 @@
 ///
 /// @note This has to exist, because this is a pass, but it should never be
 /// used.
-TargetData::TargetData() : ImmutablePass(ID) {
-  report_fatal_error("Bad TargetData ctor used.  "
-                    "Tool did not specify a TargetData to use?");
+DataLayout::DataLayout() : ImmutablePass(ID) {
+  report_fatal_error("Bad DataLayout ctor used.  "
+                    "Tool did not specify a DataLayout to use?");
 }
 
-TargetData::TargetData(const Module *M)
+DataLayout::DataLayout(const Module *M)
   : ImmutablePass(ID) {
   std::string errMsg = parseSpecifier(M->getDataLayout(), this);
-  assert(errMsg == "" && "Module M has malformed target data layout string.");
+  assert(errMsg == "" && "Module M has malformed data layout string.");
   (void)errMsg;
 }
 
 void
-TargetData::setAlignment(AlignTypeEnum align_type, unsigned abi_align,
+DataLayout::setAlignment(AlignTypeEnum align_type, unsigned abi_align,
                          unsigned pref_align, uint32_t bit_width) {
   assert(abi_align <= pref_align && "Preferred alignment worse than ABI!");
   assert(pref_align < (1 << 16) && "Alignment doesn't fit in bitfield");
@@ -326,13 +326,13 @@
     }
   }
 
-  Alignments.push_back(TargetAlignElem::get(align_type, abi_align,
+  Alignments.push_back(LayoutAlignElem::get(align_type, abi_align,
                                             pref_align, bit_width));
 }
 
 /// getAlignmentInfo - Return the alignment (either ABI if ABIInfo = true or
-/// preferred if ABIInfo = false) the target wants for the specified datatype.
-unsigned TargetData::getAlignmentInfo(AlignTypeEnum AlignType,
+/// preferred if ABIInfo = false) the layout wants for the specified datatype.
+unsigned DataLayout::getAlignmentInfo(AlignTypeEnum AlignType,
                                       uint32_t BitWidth, bool ABIInfo,
                                       Type *Ty) const {
   // Check to see if we have an exact match and remember the best match we see.
@@ -412,11 +412,11 @@
 
 } // end anonymous namespace
 
-TargetData::~TargetData() {
+DataLayout::~DataLayout() {
   delete static_cast<StructLayoutMap*>(LayoutMap);
 }
 
-const StructLayout *TargetData::getStructLayout(StructType *Ty) const {
+const StructLayout *DataLayout::getStructLayout(StructType *Ty) const {
   if (!LayoutMap)
     LayoutMap = new StructLayoutMap();
 
@@ -439,7 +439,7 @@
   return L;
 }
 
-std::string TargetData::getStringRepresentation() const {
+std::string DataLayout::getStringRepresentation() const {
   std::string Result;
   raw_string_ostream OS(Result);
 
@@ -449,7 +449,7 @@
      << "-S" << StackNaturalAlign*8;
 
   for (unsigned i = 0, e = Alignments.size(); i != e; ++i) {
-    const TargetAlignElem &AI = Alignments[i];
+    const LayoutAlignElem &AI = Alignments[i];
     OS << '-' << (char)AI.AlignType << AI.TypeBitWidth << ':'
        << AI.ABIAlign*8 << ':' << AI.PrefAlign*8;
   }
@@ -464,7 +464,7 @@
 }
 
 
-uint64_t TargetData::getTypeSizeInBits(Type *Ty) const {
+uint64_t DataLayout::getTypeSizeInBits(Type *Ty) const {
   assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!");
   switch (Ty->getTypeID()) {
   case Type::LabelTyID:
@@ -498,7 +498,7 @@
   case Type::VectorTyID:
     return cast<VectorType>(Ty)->getBitWidth();
   default:
-    llvm_unreachable("TargetData::getTypeSizeInBits(): Unsupported type");
+    llvm_unreachable("DataLayout::getTypeSizeInBits(): Unsupported type");
   }
 }
 
@@ -510,7 +510,7 @@
   Get the ABI (\a abi_or_pref == true) or preferred alignment (\a abi_or_pref
   == false) for the requested type \a Ty.
  */
-unsigned TargetData::getAlignment(Type *Ty, bool abi_or_pref) const {
+unsigned DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const {
   int AlignType = -1;
 
   assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!");
@@ -560,18 +560,18 @@
                           abi_or_pref, Ty);
 }
 
-unsigned TargetData::getABITypeAlignment(Type *Ty) const {
+unsigned DataLayout::getABITypeAlignment(Type *Ty) const {
   return getAlignment(Ty, true);
 }
 
 /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for
 /// an integer type of the specified bitwidth.
-unsigned TargetData::getABIIntegerTypeAlignment(unsigned BitWidth) const {
+unsigned DataLayout::getABIIntegerTypeAlignment(unsigned BitWidth) const {
   return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, 0);
 }
 
 
-unsigned TargetData::getCallFrameTypeAlignment(Type *Ty) const {
+unsigned DataLayout::getCallFrameTypeAlignment(Type *Ty) const {
   for (unsigned i = 0, e = Alignments.size(); i != e; ++i)
     if (Alignments[i].AlignType == STACK_ALIGN)
       return Alignments[i].ABIAlign;
@@ -579,11 +579,11 @@
   return getABITypeAlignment(Ty);
 }
 
-unsigned TargetData::getPrefTypeAlignment(Type *Ty) const {
+unsigned DataLayout::getPrefTypeAlignment(Type *Ty) const {
   return getAlignment(Ty, false);
 }
 
-unsigned TargetData::getPreferredTypeAlignmentShift(Type *Ty) const {
+unsigned DataLayout::getPreferredTypeAlignmentShift(Type *Ty) const {
   unsigned Align = getPrefTypeAlignment(Ty);
   assert(!(Align & (Align-1)) && "Alignment is not a power of two!");
   return Log2_32(Align);
@@ -591,12 +591,12 @@
 
 /// getIntPtrType - Return an unsigned integer type that is the same size or
 /// greater to the host pointer size.
-IntegerType *TargetData::getIntPtrType(LLVMContext &C) const {
+IntegerType *DataLayout::getIntPtrType(LLVMContext &C) const {
   return IntegerType::get(C, getPointerSizeInBits());
 }
 
 
-uint64_t TargetData::getIndexedOffset(Type *ptrTy,
+uint64_t DataLayout::getIndexedOffset(Type *ptrTy,
                                       ArrayRef<Value *> Indices) const {
   Type *Ty = ptrTy;
   assert(Ty->isPointerTy() && "Illegal argument for getIndexedOffset()");
@@ -636,7 +636,7 @@
 /// getPreferredAlignment - Return the preferred alignment of the specified
 /// global.  This includes an explicitly requested alignment (if the global
 /// has one).
-unsigned TargetData::getPreferredAlignment(const GlobalVariable *GV) const {
+unsigned DataLayout::getPreferredAlignment(const GlobalVariable *GV) const {
   Type *ElemType = GV->getType()->getElementType();
   unsigned Alignment = getPrefTypeAlignment(ElemType);
   unsigned GVAlignment = GV->getAlignment();
@@ -660,6 +660,6 @@
 /// getPreferredAlignmentLog - Return the preferred alignment of the
 /// specified global, returned in log form.  This includes an explicitly
 /// requested alignment (if the global has one).
-unsigned TargetData::getPreferredAlignmentLog(const GlobalVariable *GV) const {
+unsigned DataLayout::getPreferredAlignmentLog(const GlobalVariable *GV) const {
   return Log2_32(getPreferredAlignment(GV));
 }
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to