diff options
52 files changed, 170 insertions, 173 deletions
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index 58a0896027..f720562990 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -35,7 +35,7 @@ class DerivedType : public Type, public AbstractTypeUser { mutable std::vector<AbstractTypeUser *> AbstractTypeUsers; protected: - DerivedType(PrimitiveID id) : Type("", id) {} + DerivedType(TypeID id) : Type("", id) {} ~DerivedType() { assert(AbstractTypeUsers.empty()); } @@ -149,7 +149,7 @@ public: // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const FunctionType *T) { return true; } static inline bool classof(const Type *T) { - return T->getPrimitiveID() == FunctionTyID; + return T->getTypeID() == FunctionTyID; } static inline bool classof(const Value *V) { return isa<Type>(V) && classof(cast<Type>(V)); @@ -161,7 +161,7 @@ public: /// class CompositeType : public DerivedType { protected: - inline CompositeType(PrimitiveID id) : DerivedType(id) { } + inline CompositeType(TypeID id) : DerivedType(id) { } public: /// getTypeAtIndex - Given an index value into the type, return the type of @@ -173,9 +173,9 @@ public: // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const CompositeType *T) { return true; } static inline bool classof(const Type *T) { - return T->getPrimitiveID() == ArrayTyID || - T->getPrimitiveID() == StructTyID || - T->getPrimitiveID() == PointerTyID; + return T->getTypeID() == ArrayTyID || + T->getTypeID() == StructTyID || + T->getTypeID() == PointerTyID; } static inline bool classof(const Value *V) { return isa<Type>(V) && classof(cast<Type>(V)); @@ -230,7 +230,7 @@ public: // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const StructType *T) { return true; } static inline bool classof(const Type *T) { - return T->getPrimitiveID() == StructTyID; + return T->getTypeID() == StructTyID; } static inline bool classof(const Value *V) { return isa<Type>(V) && classof(cast<Type>(V)); @@ -248,7 +248,7 @@ class SequentialType : public CompositeType { SequentialType(const SequentialType &); // Do not implement! const SequentialType &operator=(const SequentialType &); // Do not implement! protected: - SequentialType(PrimitiveID TID, const Type *ElType) : CompositeType(TID) { + SequentialType(TypeID TID, const Type *ElType) : CompositeType(TID) { ContainedTys.reserve(1); ContainedTys.push_back(PATypeHandle(ElType, this)); } @@ -264,7 +264,7 @@ public: } virtual bool indexValid(const Value *V) const { const Type *Ty = V->getType(); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::IntTyID: case Type::UIntTyID: case Type::LongTyID: @@ -278,8 +278,8 @@ public: // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SequentialType *T) { return true; } static inline bool classof(const Type *T) { - return T->getPrimitiveID() == ArrayTyID || - T->getPrimitiveID() == PointerTyID; + return T->getTypeID() == ArrayTyID || + T->getTypeID() == PointerTyID; } static inline bool classof(const Value *V) { return isa<Type>(V) && classof(cast<Type>(V)); @@ -319,7 +319,7 @@ public: // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const ArrayType *T) { return true; } static inline bool classof(const Type *T) { - return T->getPrimitiveID() == ArrayTyID; + return T->getTypeID() == ArrayTyID; } static inline bool classof(const Value *V) { return isa<Type>(V) && classof(cast<Type>(V)); @@ -352,7 +352,7 @@ public: // Implement support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const PointerType *T) { return true; } static inline bool classof(const Type *T) { - return T->getPrimitiveID() == PointerTyID; + return T->getTypeID() == PointerTyID; } static inline bool classof(const Value *V) { return isa<Type>(V) && classof(cast<Type>(V)); @@ -391,7 +391,7 @@ public: // Implement support for type inquiry through isa, cast, and dyn_cast: static inline bool classof(const OpaqueType *T) { return true; } static inline bool classof(const Type *T) { - return T->getPrimitiveID() == OpaqueTyID; + return T->getTypeID() == OpaqueTyID; } static inline bool classof(const Value *V) { return isa<Type>(V) && classof(cast<Type>(V)); diff --git a/include/llvm/Type.h b/include/llvm/Type.h index f35506b319..e25bfe1e0f 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -54,7 +54,7 @@ struct Type : public Value { /// Note: If you add an element to this, you need to add an element to the /// Type::getPrimitiveType function, or else things will break! /// - enum PrimitiveID { + enum TypeID { VoidTyID = 0 , BoolTyID, // 0, 1: Basics... UByteTyID , SByteTyID, // 2, 3: 8 bit types... UShortTyID , ShortTyID, // 4, 5: 16 bit types... @@ -74,14 +74,14 @@ struct Type : public Value { //PackedTyID , // SIMD 'packed' format... TODO //... - NumPrimitiveIDs, // Must remain as last defined ID + NumTypeIDs, // Must remain as last defined ID FirstDerivedTyID = FunctionTyID, }; private: - PrimitiveID ID; // The current base type of this type... - unsigned UID; // The unique ID number for this class - bool Abstract; // True if type contains an OpaqueType + TypeID ID; // The current base type of this type... + unsigned UID; // The unique ID number for this class + bool Abstract; // True if type contains an OpaqueType /// RefCount - This counts the number of PATypeHolders that are pointing to /// this type. When this number falls to zero, if the type is abstract and @@ -93,7 +93,7 @@ private: const Type *getForwardedTypeInternal() const; protected: /// ctor is protected, so only subclasses can create Type objects... - Type(const std::string &Name, PrimitiveID id); + Type(const std::string &Name, TypeID id); virtual ~Type() {} @@ -137,10 +137,10 @@ public: // are defined in private classes defined in Type.cpp for primitive types. // - /// getPrimitiveID - Return the base type of the type. This will return one - /// of the PrimitiveID enum elements defined above. + /// getTypeID - Return the type id for the type. This will return one + /// of the TypeID enum elements defined above. /// - inline PrimitiveID getPrimitiveID() const { return ID; } + inline TypeID getTypeID() const { return ID; } /// getUniqueID - Returns the UID of the type. This can be thought of as a /// small integer version of the pointer to the type class. Two types that @@ -259,7 +259,7 @@ public: // /// getPrimitiveType/getUniqueIDType - Return a type based on an identifier. - static const Type *getPrimitiveType(PrimitiveID IDNumber); + static const Type *getPrimitiveType(TypeID IDNumber); static const Type *getUniqueIDType(unsigned UID); //===--------------------------------------------------------------------===// @@ -394,7 +394,7 @@ template <> struct GraphTraits<const Type*> { }; template <> inline bool isa_impl<PointerType, Type>(const Type &Ty) { - return Ty.getPrimitiveID() == Type::PointerTyID; + return Ty.getTypeID() == Type::PointerTyID; } } // End llvm namespace diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index f88c362943..a15f3743d8 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -432,7 +432,7 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset, while (O < Offset) { assert(Offset-O < TD.getTypeSize(SubType) && "Offset out of range!"); - switch (SubType->getPrimitiveID()) { + switch (SubType->getTypeID()) { case Type::StructTyID: { const StructType *STy = cast<StructType>(SubType); const StructLayout &SL = *TD.getStructLayout(STy); @@ -488,7 +488,7 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset, const Type *NextSubType = 0; unsigned NextSubTypeSize = 0; unsigned NextPadSize = 0; - switch (SubType->getPrimitiveID()) { + switch (SubType->getTypeID()) { case Type::StructTyID: { const StructType *STy = cast<StructType>(SubType); const StructLayout &SL = *TD.getStructLayout(STy); diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h index bb248c34ed..56852ab1f3 100644 --- a/lib/AsmParser/ParserInternals.h +++ b/lib/AsmParser/ParserInternals.h @@ -194,7 +194,7 @@ static inline ValID &getValIDFromPlaceHolder(const Value *Val) { isa<FunctionType>(cast<PointerType>(Ty)->getElementType())) Ty = cast<PointerType>(Ty)->getElementType(); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::LabelTyID: return ((BBPlaceHolder*)Val)->getDef(); default: return ((ValuePlaceHolder*)Val)->getDef(); } @@ -206,7 +206,7 @@ static inline int getLineNumFromPlaceHolder(const Value *Val) { isa<FunctionType>(cast<PointerType>(Ty)->getElementType())) Ty = cast<PointerType>(Ty)->getElementType(); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::LabelTyID: return ((BBPlaceHolder*)Val)->getLineNum(); default: return ((ValuePlaceHolder*)Val)->getLineNum(); } diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index f06b5b02e9..042680ba16 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -387,7 +387,7 @@ static Value *getVal(const Type *Ty, const ValID &D) { // forward, so just create an entry to be resolved later and get to it... // Value *d = 0; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::LabelTyID: d = new BBPlaceHolder(Ty, D); break; default: d = new ValuePlaceHolder(Ty, D); break; } diff --git a/lib/Bytecode/Analyzer/Parser.cpp b/lib/Bytecode/Analyzer/Parser.cpp index a784811f86..c79318a02c 100644 --- a/lib/Bytecode/Analyzer/Parser.cpp +++ b/lib/Bytecode/Analyzer/Parser.cpp @@ -145,7 +145,7 @@ const Type *AbstractBytecodeParser::getType(unsigned ID) { //cerr << "Looking up Type ID: " << ID << "\n"; if (ID < Type::FirstDerivedTyID) - if (const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID)) + if (const Type *T = Type::getPrimitiveType((Type::TypeID)ID)) return T; // Asked for a primitive type... // Otherwise, derived types need offset... @@ -467,7 +467,7 @@ const Type *AbstractBytecodeParser::ParseTypeConstant() { unsigned PrimType = read_vbr_uint(); const Type *Val = 0; - if ((Val = Type::getPrimitiveType((Type::PrimitiveID)PrimType))) + if ((Val = Type::getPrimitiveType((Type::TypeID)PrimType))) return Val; switch (PrimType) { @@ -615,7 +615,7 @@ void AbstractBytecodeParser::ParseConstantValue(unsigned TypeID) { // Ok, not an ConstantExpr. We now know how to read the given type... const Type *Ty = getType(TypeID); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: { unsigned Val = read_vbr_uint(); if (Val != 0 && Val != 1) diff --git a/lib/Bytecode/Analyzer/Parser.h b/lib/Bytecode/Analyzer/Parser.h index 7856fc5447..59023980b6 100644 --- a/lib/Bytecode/Analyzer/Parser.h +++ b/lib/Bytecode/Analyzer/Parser.h @@ -264,7 +264,7 @@ private: /// fancy features are supported. const Type *getGlobalTableType(unsigned Slot) { if (Slot < Type::FirstDerivedTyID) { - const Type *Ty = Type::getPrimitiveType((Type::PrimitiveID)Slot); + const Type *Ty = Type::getPrimitiveType((Type::TypeID)Slot); assert(Ty && "Not a primitive type ID?"); return Ty; } @@ -276,7 +276,7 @@ private: unsigned getGlobalTableTypeSlot(const Type *Ty) { if (Ty->isPrimitiveType()) - return Ty->getPrimitiveID(); + return Ty->getTypeID(); TypeListTy::iterator I = find(ModuleTypes.begin(), ModuleTypes.end(), Ty); if (I == ModuleTypes.end()) diff --git a/lib/Bytecode/Reader/ConstantReader.cpp b/lib/Bytecode/Reader/ConstantReader.cpp index 8691b26544..72d8caed67 100644 --- a/lib/Bytecode/Reader/ConstantReader.cpp +++ b/lib/Bytecode/Reader/ConstantReader.cpp @@ -24,7 +24,7 @@ const Type *BytecodeParser::parseTypeConstant(const unsigned char *&Buf, unsigned PrimType = read_vbr_uint(Buf, EndBuf); const Type *Val = 0; - if ((Val = Type::getPrimitiveType((Type::PrimitiveID)PrimType))) + if ((Val = Type::getPrimitiveType((Type::TypeID)PrimType))) return Val; switch (PrimType) { @@ -190,7 +190,7 @@ Constant *BytecodeParser::parseConstantValue(const unsigned char *&Buf, // Ok, not an ConstantExpr. We now know how to read the given type... const Type *Ty = getType(TypeID); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: { unsigned Val = read_vbr_uint(Buf, EndBuf); if (Val != 0 && Val != 1) throw std::string("Invalid boolean value read."); diff --git a/lib/Bytecode/Reader/Parser.cpp b/lib/Bytecode/Reader/Parser.cpp index a784811f86..c79318a02c 100644 --- a/lib/Bytecode/Reader/Parser.cpp +++ b/lib/Bytecode/Reader/Parser.cpp @@ -145,7 +145,7 @@ const Type *AbstractBytecodeParser::getType(unsigned ID) { //cerr << "Looking up Type ID: " << ID << "\n"; if (ID < Type::FirstDerivedTyID) - if (const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID)) + if (const Type *T = Type::getPrimitiveType((Type::TypeID)ID)) return T; // Asked for a primitive type... // Otherwise, derived types need offset... @@ -467,7 +467,7 @@ const Type *AbstractBytecodeParser::ParseTypeConstant() { unsigned PrimType = read_vbr_uint(); const Type *Val = 0; - if ((Val = Type::getPrimitiveType((Type::PrimitiveID)PrimType))) + if ((Val = Type::getPrimitiveType((Type::TypeID)PrimType))) return Val; switch (PrimType) { @@ -615,7 +615,7 @@ void AbstractBytecodeParser::ParseConstantValue(unsigned TypeID) { // Ok, not an ConstantExpr. We now know how to read the given type... const Type *Ty = getType(TypeID); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: { unsigned Val = read_vbr_uint(); if (Val != 0 && Val != 1) diff --git a/lib/Bytecode/Reader/Parser.h b/lib/Bytecode/Reader/Parser.h index 7856fc5447..59023980b6 100644 --- a/lib/Bytecode/Reader/Parser.h +++ b/lib/Bytecode/Reader/Parser.h @@ -264,7 +264,7 @@ private: /// fancy features are supported. const Type *getGlobalTableType(unsigned Slot) { if (Slot < Type::FirstDerivedTyID) { - const Type *Ty = Type::getPrimitiveType((Type::PrimitiveID)Slot); + const Type *Ty = Type::getPrimitiveType((Type::TypeID)Slot); assert(Ty && "Not a primitive type ID?"); return Ty; } @@ -276,7 +276,7 @@ private: unsigned getGlobalTableTypeSlot(const Type *Ty) { if (Ty->isPrimitiveType()) - return Ty->getPrimitiveID(); + return Ty->getTypeID(); TypeListTy::iterator I = find(ModuleTypes.begin(), ModuleTypes.end(), Ty); if (I == ModuleTypes.end()) diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 2f0879ba39..2ca8a99f4c 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -25,7 +25,7 @@ using namespace llvm; unsigned BytecodeParser::getTypeSlot(const Type *Ty) { if (Ty->isPrimitiveType()) - return Ty->getPrimitiveID(); + return Ty->getTypeID(); // Scan the compaction table for the type if needed. if (CompactionTable.size() > Type::TypeTyID) { @@ -56,7 +56,7 @@ const Type *BytecodeParser::getType(unsigned ID) { //cerr << "Looking up Type ID: " << ID << "\n"; if (ID < Type::FirstDerivedTyID) - if (const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID)) + if (const Type *T = Type::getPrimitiveType((Type::TypeID)ID)) return T; // Asked for a primitive type... // Otherwise, derived types need offset... diff --git a/lib/Bytecode/Reader/ReaderInternals.h b/lib/Bytecode/Reader/ReaderInternals.h index 9e0ffc2c36..36bf2f6f0e 100644 --- a/lib/Bytecode/Reader/ReaderInternals.h +++ b/lib/Bytecode/Reader/ReaderInternals.h @@ -173,7 +173,7 @@ private: /// fancy features are supported. const Type *getGlobalTableType(unsigned Slot) { if (Slot < Type::FirstDerivedTyID) { - const Type *Ty = Type::getPrimitiveType((Type::PrimitiveID)Slot); + const Type *Ty = Type::getPrimitiveType((Type::TypeID)Slot); assert(Ty && "Not a primitive type ID?"); return Ty; } @@ -185,7 +185,7 @@ private: unsigned getGlobalTableTypeSlot(const Type *Ty) { if (Ty->isPrimitiveType()) - return Ty->getPrimitiveID(); + return Ty->getTypeID(); TypeValuesListTy::iterator I = find(ModuleTypeValues.begin(), ModuleTypeValues.end(), Ty); if (I == ModuleTypeValues.end()) diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp index bb8d286899..3234a35f58 100644 --- a/lib/Bytecode/Writer/ConstantWriter.cpp +++ b/lib/Bytecode/Writer/ConstantWriter.cpp @@ -20,14 +20,14 @@ using namespace llvm; void BytecodeWriter::outputType(const Type *T) { - output_vbr((unsigned)T->getPrimitiveID(), Out); + output_vbr((unsigned)T->getTypeID(), Out); // That's all there is to handling primitive types... if (T->isPrimitiveType()) { return; // We might do this if we alias a prim type: %x = type int } - switch (T->getPrimitiveID()) { // Handle derived types now. + switch (T->getTypeID()) { // Handle derived types now. case Type::FunctionTyID: { const FunctionType *MT = cast<FunctionType>(T); int Slot = Table.getSlot(MT->getReturnType()); @@ -47,7 +47,7 @@ void BytecodeWriter::outputType(const Type *T) { // Terminate list with VoidTy if we are a varargs function... if (MT->isVarArg()) - output_vbr((unsigned)Type::VoidTy->getPrimitiveID(), Out); + output_vbr((unsigned)Type::VoidTyID, Out); break; } @@ -74,7 +74,7 @@ void BytecodeWriter::outputType(const Type *T) { } // Terminate list with VoidTy - output_vbr((unsigned)Type::VoidTy->getPrimitiveID(), Out); + output_vbr((unsigned)Type::VoidTyID, Out); break; } @@ -124,7 +124,7 @@ void BytecodeWriter::outputConstant(const Constant *CPV) { output_vbr(0U, Out); // flag as not a ConstantExpr } - switch (CPV->getType()->getPrimitiveID()) { + switch (CPV->getType()->getTypeID()) { case Type::BoolTyID: // Boolean Types if (cast<ConstantBool>(CPV)->getValue()) output_vbr(1U, Out); diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp index 9e063510df..188136718d 100644 --- a/lib/Bytecode/Writer/InstructionWriter.cpp +++ b/lib/Bytecode/Writer/InstructionWriter.cpp @@ -70,7 +70,7 @@ static void outputInstructionFormat0(const Instruction *I, unsigned Opcode, if (isa<SequentialType>(*TI)) { unsigned IdxId; - switch (I->getOperand(Idx)->getType()->getPrimitiveID()) { + switch (I->getOperand(Idx)->getType()->getTypeID()) { default: assert(0 && "Unknown index type!"); case Type::UIntTyID: IdxId = 0; break; case Type::IntTyID: IdxId = 1; break; @@ -298,7 +298,7 @@ void BytecodeWriter::outputInstruction(const Instruction &I) { I != E; ++I, ++Idx) if (isa<SequentialType>(*I)) { unsigned IdxId; - switch (GEP->getOperand(Idx)->getType()->getPrimitiveID()) { + switch (GEP->getOperand(Idx)->getType()->getTypeID()) { default: assert(0 && "Unknown index type!"); case Type::UIntTyID: IdxId = 0; break; case Type::IntTyID: IdxId = 1; break; diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index 3408982c8d..97d336e2db 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -41,8 +41,8 @@ SlotCalculator::SlotCalculator(const Module *M ) { // SC_DEBUG("Inserting primitive types:\n"); for (unsigned i = 0; i < Type::FirstDerivedTyID; ++i) { - assert(Type::getPrimitiveType((Type::PrimitiveID)i)); - insertValue(Type::getPrimitiveType((Type::PrimitiveID)i), true); + assert(Type::getPrimitiveType((Type::TypeID)i)); + insertValue(Type::getPrimitiveType((Type::TypeID)i), true); } if (M == 0) return; // Empty table... @@ -58,8 +58,8 @@ SlotCalculator::SlotCalculator(const Function *M ) { // SC_DEBUG("Inserting primitive types:\n"); for (unsigned i = 0; i < Type::FirstDerivedTyID; ++i) { - assert(Type::getPrimitiveType((Type::PrimitiveID)i)); - insertValue(Type::getPrimitiveType((Type::PrimitiveID)i), true); + assert(Type::getPrimitiveType((Type::TypeID)i)); + insertValue(Type::getPrimitiveType((Type::TypeID)i), true); } if (TheModule == 0) return; // Empty table... @@ -408,7 +408,7 @@ unsigned SlotCalculator::getOrCreateCompactionTableSlot(const Value *V) { // Make sure to insert the null entry if the thing we are inserting is not a // null constant. - if (TyPlane.empty() && hasNullValue(V->getType()->getPrimitiveID())) { + if (TyPlane.empty() && hasNullValue(V->getType()->getTypeID())) { Value *ZeroInitializer = Constant::getNullValue(V->getType()); if (V != ZeroInitializer) { TyPlane.push_back(ZeroInitializer); @@ -435,7 +435,7 @@ void SlotCalculator::buildCompactionTable(const Function *F) { // First step, insert the primitive types. CompactionTable.resize(Type::TypeTyID+1); for (unsigned i = 0; i != Type::FirstDerivedTyID; ++i) { - con |