Try again at privatizing the layout info map, with a rewritten patch.
[oota-llvm.git] / include / llvm / Target / TargetData.h
index b0ea291249a324bf3aca44f5ad60344aad375cbd..f8ea64b4ea66b43b53544d01acb100c67770aa9d 100644 (file)
@@ -91,8 +91,8 @@ private:
    */
   static const TargetAlignElem InvalidAlignmentElem;
 
-  /// Opaque pointer for the StructType -> StructLayout map
-  void* LayoutMap;
+  // Opaque pointer for the StructType -> StructLayout map.
+  mutable void* LayoutMap;
 
   //! Set/initialize target alignments
   void setAlignment(AlignTypeEnum align_type, unsigned char abi_align,
@@ -110,9 +110,6 @@ private:
     return (&align != &InvalidAlignmentElem);
   }
 
-  // DO NOT IMPLEMENT
-  void operator=(const TargetData&);
-  
 public:
   /// Default ctor.
   ///
@@ -124,11 +121,23 @@ public:
   }
 
   /// Constructs a TargetData from a specification string. See init().
-  explicit TargetData(const std::string &TargetDescription);
+  explicit TargetData(const std::string &TargetDescription)
+    : ImmutablePass(&ID) {
+    init(TargetDescription);
+  }
 
   /// Initialize target data from properties stored in the module.
   explicit TargetData(const Module *M);
-  TargetData(const TargetData &TD);
+
+  TargetData(const TargetData &TD) :
+    ImmutablePass(&ID),
+    LittleEndian(TD.isLittleEndian()),
+    PointerMemSize(TD.PointerMemSize),
+    PointerABIAlign(TD.PointerABIAlign),
+    PointerPrefAlign(TD.PointerPrefAlign),
+    Alignments(TD.Alignments),
+    LayoutMap(0)
+  { }
 
   ~TargetData();  // Not virtual, do not subclass this class