#define LLVM_DERIVED_TYPES_H
#include "llvm/Type.h"
-#include "llvm/Support/DataTypes.h"
namespace llvm {
class PointerValType;
class PackedValType;
-class DerivedType : public Type, public AbstractTypeUser {
+class DerivedType : public Type {
friend class Type;
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;
static inline bool classof(const Type *T) {
return T->getTypeID() == StructTyID;
}
+
+ bool isPacked() const { return getSubclassData(); }
};
///
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);