/// has no AbstractTypeUsers, the type is deleted. This is only sensical for
/// derived types.
///
- mutable int32_t RefCount;
+ mutable sys::cas_flag RefCount;
const Type *getForwardedTypeInternal() const;
///
bool isIntOrIntVector() const;
- /// isFloatingPoint - Return true if this is one of the two floating point
+ /// isFloatingPoint - Return true if this is one of the five floating point
/// types
bool isFloatingPoint() const { return ID == FloatTyID || ID == DoubleTyID ||
ID == X86_FP80TyID || ID == FP128TyID || ID == PPC_FP128TyID; }
/// This will return zero if the type does not have a size or is not a
/// primitive type.
///
+ /// Note that this may not reflect the size of memory allocated for an
+ /// instance of the type or the number of bytes that are written when an
+ /// instance of the type is stored to memory. The TargetData class provides
+ /// additional query functions to provide this information.
+ ///
unsigned getPrimitiveSizeInBits() const;
/// getScalarSizeInBits - If this is a vector type, return the
void addRef() const {
assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
- sys::AtomicIncrement32(&RefCount);
+ sys::AtomicIncrement(&RefCount);
}
void dropRef() const {
// If this is the last PATypeHolder using this object, and there are no
// PATypeHandles using it, the type is dead, delete it now.
- int32_t Count = sys::AtomicDecrement32(&RefCount);
- if (Count == 0 && AbstractTypeUsers.empty())
+ sys::cas_flag OldCount = sys::AtomicDecrement(&RefCount);
+ if (OldCount == 0 && AbstractTypeUsers.empty())
this->destroy();
}