aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-28 04:09:24 +0000
committerChris Lattner <sabre@nondot.org>2010-08-28 04:09:24 +0000
commit61c70e98ac3c7504d31dd9bc81c4e9cb998e9984 (patch)
tree05263a360b43d09ed99dacdf6d402ce50deb32d7 /include
parent5f88af537637831451ff9ffa08c597e05e7dc9fb (diff)
downloadexternal_llvm-61c70e98ac3c7504d31dd9bc81c4e9cb998e9984.zip
external_llvm-61c70e98ac3c7504d31dd9bc81c4e9cb998e9984.tar.gz
external_llvm-61c70e98ac3c7504d31dd9bc81c4e9cb998e9984.tar.bz2
remove unions from LLVM IR. They are severely buggy and not
being actively maintained, improved, or extended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112356 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/Core.h11
-rw-r--r--include/llvm/Bitcode/LLVMBitCodes.h3
-rw-r--r--include/llvm/Constants.h44
-rw-r--r--include/llvm/DerivedTypes.h62
-rw-r--r--include/llvm/Type.h18
-rw-r--r--include/llvm/Value.h1
6 files changed, 9 insertions, 130 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index 20c6383..75cee7d 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -204,8 +204,7 @@ typedef enum {
LLVMPointerTypeKind, /**< Pointers */
LLVMOpaqueTypeKind, /**< Opaque: type with unknown structure */
LLVMVectorTypeKind, /**< SIMD 'packed' format, or other vector type */
- LLVMMetadataTypeKind, /**< Metadata */
- LLVMUnionTypeKind /**< Unions */
+ LLVMMetadataTypeKind /**< Metadata */
} LLVMTypeKind;
typedef enum {
@@ -395,13 +394,6 @@ unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy);
-/* Operations on union types */
-LLVMTypeRef LLVMUnionTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
- unsigned ElementCount);
-LLVMTypeRef LLVMUnionType(LLVMTypeRef *ElementTypes, unsigned ElementCount);
-unsigned LLVMCountUnionElementTypes(LLVMTypeRef UnionTy);
-void LLVMGetUnionElementTypes(LLVMTypeRef UnionTy, LLVMTypeRef *Dest);
-
/* Operations on array, pointer, and vector types (sequence types) */
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
@@ -574,7 +566,6 @@ LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
LLVMBool Packed);
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
-LLVMValueRef LLVMConstUnion(LLVMTypeRef Ty, LLVMValueRef Val);
/* Constant expressions */
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal);
diff --git a/include/llvm/Bitcode/LLVMBitCodes.h b/include/llvm/Bitcode/LLVMBitCodes.h
index de9b64d..942c032 100644
--- a/include/llvm/Bitcode/LLVMBitCodes.h
+++ b/include/llvm/Bitcode/LLVMBitCodes.h
@@ -94,8 +94,7 @@ namespace bitc {
TYPE_CODE_FP128 = 14, // LONG DOUBLE (112 bit mantissa)
TYPE_CODE_PPC_FP128= 15, // PPC LONG DOUBLE (2 doubles)
- TYPE_CODE_METADATA = 16, // METADATA
- TYPE_CODE_UNION = 17 // UNION: [eltty x N]
+ TYPE_CODE_METADATA = 16 // METADATA
};
// The type symbol table only has one code (TST_ENTRY_CODE).
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 9ca845e..a7deae0 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -33,7 +33,6 @@ namespace llvm {
class ArrayType;
class IntegerType;
class StructType;
-class UnionType;
class PointerType;
class VectorType;
@@ -459,49 +458,6 @@ struct OperandTraits<ConstantStruct> : public VariadicOperandTraits<> {
DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantStruct, Constant)
-//===----------------------------------------------------------------------===//
-// ConstantUnion - Constant Union Declarations
-//
-class ConstantUnion : public Constant {
- friend struct ConstantCreator<ConstantUnion, UnionType, Constant*>;
- ConstantUnion(const ConstantUnion &); // DO NOT IMPLEMENT
-protected:
- ConstantUnion(const UnionType *T, Constant* Val);
-public:
- // ConstantUnion accessors
- static Constant *get(const UnionType *T, Constant* V);
-
- /// Transparently provide more efficient getOperand methods.
- DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
-
- /// getType() specialization - Reduce amount of casting...
- ///
- inline const UnionType *getType() const {
- return reinterpret_cast<const UnionType*>(Value::getType());
- }
-
- /// isNullValue - Return true if this is the value that would be returned by
- /// getNullValue. This always returns false because zero structs are always
- /// created as ConstantAggregateZero objects.
- virtual bool isNullValue() const {
- return false;
- }
-
- virtual void destroyConstant();
- virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
-
- /// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ConstantUnion *) { return true; }
- static bool classof(const Value *V) {
- return V->getValueID() == ConstantUnionVal;
- }
-};
-
-template <>
-struct OperandTraits<ConstantUnion> : public FixedNumOperandTraits<1> {
-};
-
-DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(ConstantUnion, Constant)
//===----------------------------------------------------------------------===//
/// ConstantVector - Constant Vector Declarations
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index 8af4ea0..9b6b19f 100644
--- a/include/llvm/DerivedTypes.h
+++ b/include/llvm/DerivedTypes.h
@@ -27,7 +27,6 @@ template<class ValType, class TypeClass> class TypeMap;
class FunctionValType;
class ArrayValType;
class StructValType;
-class UnionValType;
class PointerValType;
class VectorValType;
class IntegerValType;
@@ -226,8 +225,7 @@ public:
return T->getTypeID() == ArrayTyID ||
T->getTypeID() == StructTyID ||
T->getTypeID() == PointerTyID ||
- T->getTypeID() == VectorTyID ||
- T->getTypeID() == UnionTyID;
+ T->getTypeID() == VectorTyID;
}
};
@@ -298,64 +296,6 @@ public:
bool isPacked() const { return (0 != getSubclassData()) ? true : false; }
};
-
-/// UnionType - Class to represent union types. A union type is similar to
-/// a structure, except that all member fields begin at offset 0.
-///
-class UnionType : public CompositeType {
- friend class TypeMap<UnionValType, UnionType>;
- UnionType(const UnionType &); // Do not implement
- const UnionType &operator=(const UnionType &); // Do not implement
- UnionType(LLVMContext &C, const Type* const* Types, unsigned NumTypes);
-public:
- /// UnionType::get - This static method is the primary way to create a
- /// UnionType.
- static UnionType *get(const Type* const* Types, unsigned NumTypes);
-
- /// UnionType::get - This static method is a convenience method for
- /// creating union types by specifying the elements as arguments.
- static UnionType *get(const Type *type, ...) END_WITH_NULL;
-
- /// isValidElementType - Return true if the specified type is valid as a
- /// element type.
- static bool isValidElementType(const Type *ElemTy);
-
- /// Given an element type, return the member index of that type, or -1
- /// if there is no such member type.
- int getElementTypeIndex(const Type *ElemTy) const;
-
- // Iterator access to the elements
- typedef Type::subtype_iterator element_iterator;
- element_iterator element_begin() const { return ContainedTys; }
- element_iterator element_end() const { return &ContainedTys[NumContainedTys];}
-
- // Random access to the elements
- unsigned getNumElements() const { return NumContainedTys; }
- const Type *getElementType(unsigned N) const {
- assert(N < NumContainedTys && "Element number out of range!");
- return ContainedTys[N];
- }
-
- /// getTypeAtIndex - Given an index value into the type, return the type of
- /// the element. For a union type, this must be a constant value...
- ///
- virtual const Type *getTypeAtIndex(const Value *V) const;
- virtual const Type *getTypeAtIndex(unsigned Idx) const;
- virtual bool indexValid(const Value *V) const;
- virtual bool indexValid(unsigned Idx) const;
-
- // Implement the AbstractTypeUser interface.
- virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
- virtual void typeBecameConcrete(const DerivedType *AbsTy);
-
- // Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const UnionType *) { return true; }
- static inline bool classof(const Type *T) {
- return T->getTypeID() == UnionTyID;
- }
-};
-
-
/// SequentialType - This is the superclass of the array, pointer and vector
/// type classes. All of these represent "arrays" in memory. The array type
/// represents a specifically sized array, pointer types are unsized/unknown
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index 617ef69..f7d6fd5 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -82,11 +82,10 @@ public:
IntegerTyID, ///< 8: Arbitrary bit width integers
FunctionTyID, ///< 9: Functions
StructTyID, ///< 10: Structures
- UnionTyID, ///< 11: Unions
- ArrayTyID, ///< 12: Arrays
- PointerTyID, ///< 13: Pointers
- OpaqueTyID, ///< 14: Opaque: type with unknown structure
- VectorTyID, ///< 15: SIMD 'packed' format, or other vector type
+ ArrayTyID, ///< 11: Arrays
+ PointerTyID, ///< 12: Pointers
+ OpaqueTyID, ///< 13: Opaque: type with unknown structure
+ VectorTyID, ///< 14: SIMD 'packed' format, or other vector type
NumTypeIDs, // Must remain as last defined ID
LastPrimitiveTyID = MetadataTyID,
@@ -243,10 +242,6 @@ public:
///
bool isStructTy() const { return ID == StructTyID; }
- /// isUnionTy - True if this is an instance of UnionType.
- ///
- bool isUnionTy() const { return ID == UnionTyID; }
-
/// isArrayTy - True if this is an instance of ArrayType.
///
bool isArrayTy() const { return ID == ArrayTyID; }
@@ -306,7 +301,7 @@ public:
/// does not include vector types.
///
inline bool isAggregateType() const {
- return ID == StructTyID || ID == ArrayTyID || ID == UnionTyID;
+ return ID == StructTyID || ID == ArrayTyID;
}
/// isSized - Return true if it makes sense to take the size of this type. To
@@ -319,8 +314,7 @@ public:
return true;
// If it is not something that can have a size (e.g. a function or label),
// it doesn't have a size.
- if (ID != StructTyID && ID != ArrayTyID && ID != VectorTyID &&
- ID != UnionTyID)
+ if (ID != StructTyID && ID != ArrayTyID && ID != VectorTyID)
return false;
// If it is something that can have a size and it's concrete, it definitely
// has a size, otherwise we have to try harder to decide.
diff --git a/include/llvm/Value.h b/include/llvm/Value.h
index 6330635..8740f35 100644
--- a/include/llvm/Value.h
+++ b/include/llvm/Value.h
@@ -215,7 +215,6 @@ public:
ConstantFPVal, // This is an instance of ConstantFP
ConstantArrayVal, // This is an instance of ConstantArray
ConstantStructVal, // This is an instance of ConstantStruct
- ConstantUnionVal, // This is an instance of ConstantUnion
ConstantVectorVal, // This is an instance of ConstantVector
ConstantPointerNullVal, // This is an instance of ConstantPointerNull
MDNodeVal, // This is an instance of MDNode