Be consistent with our naming
[oota-llvm.git] / include / llvm / Target / TargetData.h
index dc40efb1abd99a545d76ce6e3371ba5cdaf4f14e..9de9d7044a8ca3dc805c451344dcd2142352c3fb 100644 (file)
@@ -21,7 +21,7 @@
 #define LLVM_TARGET_TARGETDATA_H
 
 #include "llvm/Pass.h"
-#include "Support/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
 #include <vector>
 #include <string>
 
@@ -34,7 +34,8 @@ class StructLayout;
 
 class TargetData : public ImmutablePass {
   bool          LittleEndian;          // Defaults to false
-  unsigned char ByteAlignment;         // Defaults to 1 bytes
+  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
@@ -42,14 +43,31 @@ class TargetData : public ImmutablePass {
   unsigned char DoubleAlignment;       // Defaults to 8 bytes
   unsigned char PointerSize;           // Defaults to 8 bytes
   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 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);
+
+  // Copy constructor
+  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()) {
+  }
+    
   TargetData(const std::string &ToolName, const Module *M);
   ~TargetData();  // Not virtual, do not subclass this class
 
@@ -58,6 +76,7 @@ public:
   bool          isBigEndian()         const { return    !LittleEndian; }
 
   /// Target alignment constraints
+  unsigned char getBoolAlignment()    const { return    BoolAlignment; }
   unsigned char getByteAlignment()    const { return    ByteAlignment; }
   unsigned char getShortAlignment()   const { return   ShortAlignment; }
   unsigned char getIntAlignment()     const { return     IntAlignment; }
@@ -68,13 +87,17 @@ public:
   unsigned char getPointerSize()      const { return      PointerSize; }
 
   /// getTypeSize - Return the number of bytes necessary to hold the specified
-  /// type
+  /// type.
   uint64_t getTypeSize(const Type *Ty) const;
 
   /// getTypeAlignment - Return the minimum required alignment for the specified
-  /// type
+  /// type.
   unsigned char getTypeAlignment(const Type *Ty) const;
 
+  /// getTypeAlignmentShift - Return the minimum required alignment for the
+  /// specified type, returned as log2 of the value (a shift amount).
+  unsigned char getTypeAlignmentShift(const Type *Ty) const;
+
   /// getIntPtrType - Return an unsigned integer type that is the same size or
   /// greater to the host pointer size.
   const Type *getIntPtrType() const;