[llvm-commits] [llvm] r165249 - in /llvm/trunk: include/llvm/DataLayout.h lib/VMCore/CMakeLists.txt lib/VMCore/DataLayout.cpp

Micah Villmow villmow at gmail.com
Thu Oct 4 13:44:22 PDT 2012


Author: villmow
Date: Thu Oct  4 15:44:22 2012
New Revision: 165249

URL: http://llvm.org/viewvc/llvm-project?rev=165249&view=rev
Log:
Create the DataLayout class, as a direct copy of TargetData.

Added:
    llvm/trunk/include/llvm/DataLayout.h
      - copied, changed from r165243, llvm/trunk/include/llvm/DataLayout.h
    llvm/trunk/lib/VMCore/DataLayout.cpp
      - copied unchanged from r165243, llvm/trunk/lib/VMCore/DataLayout.cpp
Modified:
    llvm/trunk/lib/VMCore/CMakeLists.txt

Copied: llvm/trunk/include/llvm/DataLayout.h (from r165243, llvm/trunk/include/llvm/DataLayout.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DataLayout.h?p2=llvm/trunk/include/llvm/DataLayout.h&p1=llvm/trunk/include/llvm/DataLayout.h&r1=165243&r2=165249&rev=165249&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DataLayout.h (original)
+++ llvm/trunk/include/llvm/DataLayout.h Thu Oct  4 15:44:22 2012
@@ -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
 //
@@ -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"
@@ -65,13 +65,13 @@
   bool operator==(const TargetAlignElem &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
@@ -112,7 +112,7 @@
     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,10 +121,10 @@
   ///
   /// @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 TargetDescription)
     : ImmutablePass(ID) {
     std::string errMsg = parseSpecifier(TargetDescription, this);
     assert(errMsg == "" && "Invalid target data layout string.");
@@ -133,13 +133,13 @@
 
   /// 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 TargetDescription, 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 +150,14 @@
     LayoutMap(0)
   { }
 
-  ~TargetData();  // Not virtual, do not subclass this class
+  ~DataLayout();  // Not virtual, do not subclass this class
 
   /// Target 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;
 
@@ -318,7 +318,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 +354,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

Modified: llvm/trunk/lib/VMCore/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/CMakeLists.txt?rev=165249&r1=165248&r2=165249&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/CMakeLists.txt (original)
+++ llvm/trunk/lib/VMCore/CMakeLists.txt Thu Oct  4 15:44:22 2012
@@ -8,6 +8,7 @@
   ConstantFold.cpp
   Constants.cpp
   Core.cpp
+  DataLayout.cpp
   DebugInfo.cpp
   DebugLoc.cpp
   DIBuilder.cpp





More information about the llvm-commits mailing list