Doxgenate comments.
[oota-llvm.git] / include / llvm / DerivedTypes.h
index 179f44fbc07bd861e12218ad47692a6f406ab141..fafcea490372ea1a8d43910f1026941a1444fbca 100644 (file)
@@ -19,7 +19,6 @@
 #define LLVM_DERIVED_TYPES_H
 
 #include "llvm/Type.h"
-#include "llvm/Support/DataTypes.h"
 
 namespace llvm {
 
@@ -31,7 +30,7 @@ class StructValType;
 class PointerValType;
 class PackedValType;
 
-class DerivedType : public Type, public AbstractTypeUser {
+class DerivedType : public Type {
   friend class Type;
 
 protected:
@@ -164,13 +163,14 @@ protected:
   ///
   /// Private ctor - Only can be created by a static member...
   ///
-  StructType(const std::vector<const Type*> &Types);
+  StructType(const std::vector<const Type*> &Types, bool isPacked);
 
 public:
   /// StructType::get - This static method is the primary way to create a
   /// StructType.
   ///
-  static StructType *get(const std::vector<const Type*> &Params);
+  static StructType *get(const std::vector<const Type*> &Params, 
+                         bool isPacked=false);
 
   // Iterator access to the elements
   typedef std::vector<PATypeHandle>::const_iterator element_iterator;
@@ -199,6 +199,8 @@ public:
   static inline bool classof(const Type *T) {
     return T->getTypeID() == StructTyID;
   }
+
+  bool isPacked() const { return getSubclassData(); }
 };
 
 
@@ -300,8 +302,14 @@ public:
   ///
   static PackedType *get(const Type *ElementType, unsigned NumElements);
 
+  /// @brief Return the number of elements in the Packed type.
   inline unsigned getNumElements() const { return NumElements; }
 
+  /// @brief Return the number of bits in the Packed type.
+  inline unsigned getBitWidth() const { 
+    return NumElements *getElementType()->getPrimitiveSizeInBits();
+  }
+
   // Implement the AbstractTypeUser interface.
   virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
   virtual void typeBecameConcrete(const DerivedType *AbsTy);