diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index 58a08960279..f720562990f 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -35,7 +35,7 @@ class DerivedType : public Type, public AbstractTypeUser { mutable std::vector 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(V) && classof(cast(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(V) && classof(cast(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(V) && classof(cast(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(V) && classof(cast(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(V) && classof(cast(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(V) && classof(cast(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(V) && classof(cast(V)); diff --git a/include/llvm/Type.h b/include/llvm/Type.h index f35506b319d..e25bfe1e0ff 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 { }; template <> inline bool isa_impl(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 f88c3629436..a15f3743d83 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(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(SubType); const StructLayout &SL = *TD.getStructLayout(STy); diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h index bb248c34ed1..56852ab1f38 100644 --- a/lib/AsmParser/ParserInternals.h +++ b/lib/AsmParser/ParserInternals.h @@ -194,7 +194,7 @@ static inline ValID &getValIDFromPlaceHolder(const Value *Val) { isa(cast(Ty)->getElementType())) Ty = cast(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(cast(Ty)->getElementType())) Ty = cast(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 f06b5b02e94..042680ba16e 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 a784811f861..c79318a02c9 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 7856fc5447f..59023980b69 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 8691b26544b..72d8caed673 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 a784811f861..c79318a02c9 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 7856fc5447f..59023980b69 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 2f0879ba394..2ca8a99f4cd 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 9e0ffc2c363..36bf2f6f0e2 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 bb8d286899a..3234a35f588 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(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(CPV)->getValue()) output_vbr(1U, Out); diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp index 9e063510dfe..188136718d8 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(*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(*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 3408982c8d5..97d336e2db2 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) { - const Type *PrimTy = Type::getPrimitiveType((Type::PrimitiveID)i); + const Type *PrimTy = Type::getPrimitiveType((Type::TypeID)i); CompactionTable[Type::TypeTyID].push_back(PrimTy); CompactionNodeMap[PrimTy] = i; } @@ -754,7 +754,7 @@ int SlotCalculator::doInsertValue(const Value *D) { } Ty = (unsigned)ValSlot; } else { - Ty = Typ->getPrimitiveID(); + Ty = Typ->getTypeID(); } if (Table.size() <= Ty) // Make sure we have the type plane allocated... diff --git a/lib/Bytecode/Writer/SlotTable.cpp b/lib/Bytecode/Writer/SlotTable.cpp index 358a6ea21e0..42b0b5adb89 100644 --- a/lib/Bytecode/Writer/SlotTable.cpp +++ b/lib/Bytecode/Writer/SlotTable.cpp @@ -106,7 +106,7 @@ SlotTable::SlotNum SlotTable::remove( const Type* Typ ) { // and that their Primitive ID is equal to their slot # void SlotTable::insertPrimitives() { for (PlaneNum plane = 0; plane < Type::FirstDerivedTyID; ++plane) { - const Type* Ty = Type::getPrimitiveType((Type::PrimitiveID) plane); + const Type* Ty = Type::getPrimitiveType((Type::TypeID) plane); assert(Ty && "Couldn't get primitive type id"); SlotNum slot = this->insert(Ty); assert(slot == plane && "Type slot didn't match plane number"); diff --git a/lib/Bytecode/Writer/SlotTable.h b/lib/Bytecode/Writer/SlotTable.h index 1d10babfe62..60e0c1fbfd0 100644 --- a/lib/Bytecode/Writer/SlotTable.h +++ b/lib/Bytecode/Writer/SlotTable.h @@ -46,7 +46,7 @@ public: /// This type is used throughout the code to make it clear that an /// unsigned value refers to a type plane number and not something else. - /// @brief The type of a plane number (corresponds to Type::PrimitiveID). + /// @brief The type of a plane number (corresponds to Type::TypeID). typedef unsigned PlaneNum; /// @brief Some constants used as flags instead of actual slot numbers @@ -58,7 +58,7 @@ public: /// @brief A single plane of Values. Intended index is slot number. typedef std::vector ValuePlane; - /// @brief A table of Values. Intended index is Type::PrimitiveID. + /// @brief A table of Values. Intended index is Type::TypeID. typedef std::vector ValueTable; /// @brief A map of values to slot numbers. diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 76d7bb99463..7dac9b3773e 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -31,7 +31,7 @@ void SelectionDAG::dump() const { /// method works on all scalar LLVM types. /// MVT::ValueType SelectionDAG::getValueType(const Type *Ty) const { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::VoidTyID: assert(0 && "Void type object in getValueType!"); default: assert(0 && "Unknown type in DAGBuilder!\n"); case Type::BoolTyID: return MVT::i1; diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index a4383e02c8f..253e9540d1e 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -181,7 +181,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { GenericValue GV = getConstantValue(Op); // Handle cast of pointer to pointer... - if (Op->getType()->getPrimitiveID() == C->getType()->getPrimitiveID()) + if (Op->getType()->getTypeID() == C->getType()->getTypeID()) return GV; // Handle a cast of pointer to any integral type... @@ -190,7 +190,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { // Handle cast of integer to a pointer... if (isa(C->getType()) && Op->getType()->isIntegral()) - switch (Op->getType()->getPrimitiveID()) { + switch (Op->getType()->getTypeID()) { case Type::BoolTyID: return PTOGV((void*)(uintptr_t)GV.BoolVal); case Type::SByteTyID: return PTOGV((void*)( intptr_t)GV.SByteVal); case Type::UByteTyID: return PTOGV((void*)(uintptr_t)GV.UByteVal); @@ -221,7 +221,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { abort(); } - switch (C->getType()->getPrimitiveID()) { + switch (C->getType()->getTypeID()) { #define GET_CONST_VAL(TY, CLASS) \ case Type::TY##TyID: Result.TY##Val = cast(C)->getValue(); break GET_CONST_VAL(Bool , ConstantBool); @@ -263,7 +263,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, const Type *Ty) { if (getTargetData().isLittleEndian()) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: Ptr->Untyped[0] = Val.UByteVal; break; @@ -296,7 +296,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, std::cout << "Cannot store value of type " << Ty << "!\n"; } } else { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: Ptr->Untyped[0] = Val.UByteVal; break; @@ -337,7 +337,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr, const Type *Ty) { GenericValue Result; if (getTargetData().isLittleEndian()) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: Result.UByteVal = Ptr->Untyped[0]; break; @@ -371,7 +371,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr, abort(); } } else { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: Result.UByteVal = Ptr->Untyped[0]; break; @@ -422,7 +422,7 @@ void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { return; } - switch (Init->getType()->getPrimitiveID()) { + switch (Init->getType()->getTypeID()) { case Type::ArrayTyID: { const ConstantArray *CPA = cast(Init); const std::vector &Val = CPA->getValues(); diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index 769d0e6e96f..3348ab48826 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -182,7 +182,7 @@ void Interpreter::initializeExecutionEngine() { static GenericValue executeAddInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(+, UByte); IMPLEMENT_BINARY_OPERATOR(+, SByte); IMPLEMENT_BINARY_OPERATOR(+, UShort); @@ -203,7 +203,7 @@ static GenericValue executeAddInst(GenericValue Src1, GenericValue Src2, static GenericValue executeSubInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(-, UByte); IMPLEMENT_BINARY_OPERATOR(-, SByte); IMPLEMENT_BINARY_OPERATOR(-, UShort); @@ -224,7 +224,7 @@ static GenericValue executeSubInst(GenericValue Src1, GenericValue Src2, static GenericValue executeMulInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(*, UByte); IMPLEMENT_BINARY_OPERATOR(*, SByte); IMPLEMENT_BINARY_OPERATOR(*, UShort); @@ -245,7 +245,7 @@ static GenericValue executeMulInst(GenericValue Src1, GenericValue Src2, static GenericValue executeDivInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(/, UByte); IMPLEMENT_BINARY_OPERATOR(/, SByte); IMPLEMENT_BINARY_OPERATOR(/, UShort); @@ -266,7 +266,7 @@ static GenericValue executeDivInst(GenericValue Src1, GenericValue Src2, static GenericValue executeRemInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(%, UByte); IMPLEMENT_BINARY_OPERATOR(%, SByte); IMPLEMENT_BINARY_OPERATOR(%, UShort); @@ -291,7 +291,7 @@ static GenericValue executeRemInst(GenericValue Src1, GenericValue Src2, static GenericValue executeAndInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(&, Bool); IMPLEMENT_BINARY_OPERATOR(&, UByte); IMPLEMENT_BINARY_OPERATOR(&, SByte); @@ -311,7 +311,7 @@ static GenericValue executeAndInst(GenericValue Src1, GenericValue Src2, static GenericValue executeOrInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(|, Bool); IMPLEMENT_BINARY_OPERATOR(|, UByte); IMPLEMENT_BINARY_OPERATOR(|, SByte); @@ -331,7 +331,7 @@ static GenericValue executeOrInst(GenericValue Src1, GenericValue Src2, static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(^, Bool); IMPLEMENT_BINARY_OPERATOR(^, UByte); IMPLEMENT_BINARY_OPERATOR(^, SByte); @@ -363,7 +363,7 @@ static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2, static GenericValue executeSetEQInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_SETCC(==, UByte); IMPLEMENT_SETCC(==, SByte); IMPLEMENT_SETCC(==, UShort); @@ -385,7 +385,7 @@ static GenericValue executeSetEQInst(GenericValue Src1, GenericValue Src2, static GenericValue executeSetNEInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_SETCC(!=, UByte); IMPLEMENT_SETCC(!=, SByte); IMPLEMENT_SETCC(!=, UShort); @@ -408,7 +408,7 @@ static GenericValue executeSetNEInst(GenericValue Src1, GenericValue Src2, static GenericValue executeSetLEInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_SETCC(<=, UByte); IMPLEMENT_SETCC(<=, SByte); IMPLEMENT_SETCC(<=, UShort); @@ -430,7 +430,7 @@ static GenericValue executeSetLEInst(GenericValue Src1, GenericValue Src2, static GenericValue executeSetGEInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_SETCC(>=, UByte); IMPLEMENT_SETCC(>=, SByte); IMPLEMENT_SETCC(>=, UShort); @@ -452,7 +452,7 @@ static GenericValue executeSetGEInst(GenericValue Src1, GenericValue Src2, static GenericValue executeSetLTInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_SETCC(<, UByte); IMPLEMENT_SETCC(<, SByte); IMPLEMENT_SETCC(<, UShort); @@ -474,7 +474,7 @@ static GenericValue executeSetLTInst(GenericValue Src1, GenericValue Src2, static GenericValue executeSetGTInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_SETCC(>, UByte); IMPLEMENT_SETCC(>, SByte); IMPLEMENT_SETCC(>, UShort); @@ -739,7 +739,7 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I, GenericValue IdxGV = getOperandValue(I.getOperand(), SF); uint64_t Idx; - switch (I.getOperand()->getType()->getPrimitiveID()) { + switch (I.getOperand()->getType()->getTypeID()) { default: assert(0 && "Illegal getelementptr index for sequential type!"); case Type::SByteTyID: Idx = IdxGV.SByteVal; break; case Type::ShortTyID: Idx = IdxGV.ShortVal; break; @@ -865,7 +865,7 @@ void Interpreter::visitCallSite(CallSite CS) { static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_SHIFT(<<, UByte); IMPLEMENT_SHIFT(<<, SByte); IMPLEMENT_SHIFT(<<, UShort); @@ -883,7 +883,7 @@ static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2, static GenericValue executeShrInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_SHIFT(>>, UByte); IMPLEMENT_SHIFT(>>, SByte); IMPLEMENT_SHIFT(>>, UShort); @@ -924,7 +924,7 @@ void Interpreter::visitShr(ShiftInst &I) { #define IMPLEMENT_CAST_CASE_START(DESTTY, DESTCTY) \ case Type::DESTTY##TyID: \ - switch (SrcTy->getPrimitiveID()) { \ + switch (SrcTy->getTypeID()) { \ IMPLEMENT_CAST(DESTTY, DESTCTY, Bool); \ IMPLEMENT_CAST(DESTTY, DESTCTY, UByte); \ IMPLEMENT_CAST(DESTTY, DESTCTY, SByte); \ @@ -956,7 +956,7 @@ GenericValue Interpreter::executeCastOperation(Value *SrcVal, const Type *Ty, const Type *SrcTy = SrcVal->getType(); GenericValue Dest, Src = getOperandValue(SrcVal, SF); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_CAST_CASE(UByte , (unsigned char)); IMPLEMENT_CAST_CASE(SByte , ( signed char)); IMPLEMENT_CAST_CASE(UShort , (unsigned short)); @@ -1007,7 +1007,7 @@ void Interpreter::visitVAArgInst(VAArgInst &I) { GenericValue Src = ECStack[VAList.UIntPairVal.first] .VarArgs[VAList.UIntPairVal.second]; const Type *Ty = I.getType(); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { IMPLEMENT_VAARG(UByte); IMPLEMENT_VAARG(SByte); IMPLEMENT_VAARG(UShort); diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index 2299874f532..83da7551b0a 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -38,7 +38,7 @@ static std::map FuncNames; static Interpreter *TheInterpreter; static char getTypeID(const Type *Ty) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::VoidTyID: return 'V'; case Type::BoolTyID: return 'o'; case Type::UByteTyID: return 'B'; diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 6220140afe3..00906a46a26 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -97,10 +97,10 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy, // Two types cannot be resolved together if they are of different primitive // type. For example, we cannot resolve an int to a float. - if (DestTyT->getPrimitiveID() != SrcTyT->getPrimitiveID()) return true; + if (DestTyT->getTypeID() != SrcTyT->getTypeID()) return true; // Otherwise, resolve the used type used by this derived type... - switch (DestTyT->getPrimitiveID()) { + switch (DestTyT->getTypeID()) { case Type::FunctionTyID: { if (cast(DestTyT)->isVarArg() != cast(SrcTyT)->isVarArg() || diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index d993919f8b1..05be7706b33 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -255,7 +255,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, const std::string &NameSoFar, bool IgnoreName) { if (Ty->isPrimitiveType()) - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::VoidTyID: return Out << "void " << NameSoFar; case Type::BoolTyID: return Out << "bool " << NameSoFar; case Type::UByteTyID: return Out << "unsigned char " << NameSoFar; @@ -279,7 +279,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, if (I != TypeNames.end()) return Out << I->second << " " << NameSoFar; } - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::FunctionTyID: { const FunctionType *MTy = cast(Ty); std::stringstream FunctionInnards; @@ -518,7 +518,7 @@ void CWriter::printConstant(Constant *CPV) { } } - switch (CPV->getType()->getPrimitiveID()) { + switch (CPV->getType()->getTypeID()) { case Type::BoolTyID: Out << (CPV == ConstantBool::False ? "0" : "1"); break; case Type::SByteTyID: diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index d993919f8b1..05be7706b33 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -255,7 +255,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, const std::string &NameSoFar, bool IgnoreName) { if (Ty->isPrimitiveType()) - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::VoidTyID: return Out << "void " << NameSoFar; case Type::BoolTyID: return Out << "bool " << NameSoFar; case Type::UByteTyID: return Out << "unsigned char " << NameSoFar; @@ -279,7 +279,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, if (I != TypeNames.end()) return Out << I->second << " " << NameSoFar; } - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::FunctionTyID: { const FunctionType *MTy = cast(Ty); std::stringstream FunctionInnards; @@ -518,7 +518,7 @@ void CWriter::printConstant(Constant *CPV) { } } - switch (CPV->getType()->getPrimitiveID()) { + switch (CPV->getType()->getTypeID()) { case Type::BoolTyID: Out << (CPV == ConstantBool::False ? "0" : "1"); break; case Type::SByteTyID: diff --git a/lib/Target/Sparc/InstSelectSimple.cpp b/lib/Target/Sparc/InstSelectSimple.cpp index fac772b65cf..8d308edbd8c 100644 --- a/lib/Target/Sparc/InstSelectSimple.cpp +++ b/lib/Target/Sparc/InstSelectSimple.cpp @@ -168,7 +168,7 @@ enum TypeClass { }; static TypeClass getClass (const Type *T) { - switch (T->getPrimitiveID ()) { + switch (T->getTypeID()) { case Type::UByteTyID: case Type::SByteTyID: return cByte; case Type::UShortTyID: case Type::ShortTyID: return cShort; case Type::PointerTyID: diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp index 226f972b59d..342b72065b9 100644 --- a/lib/Target/Sparc/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/SparcAsmPrinter.cpp @@ -249,7 +249,7 @@ void V8Printer::emitGlobalConstant(const Constant *CV) { // FP Constants are printed as integer constants to avoid losing // precision... double Val = CFP->getValue(); - switch (CFP->getType()->getPrimitiveID()) { + switch (CFP->getType()->getTypeID()) { default: assert(0 && "Unknown floating point type!"); case Type::FloatTyID: { union FU { // Abide by C TBAA rules @@ -274,7 +274,7 @@ void V8Printer::emitGlobalConstant(const Constant *CV) { const Type *type = CV->getType(); O << "\t"; - switch (type->getPrimitiveID()) { + switch (type->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: O << ".byte"; break; diff --git a/lib/Target/Sparc/SparcRegisterInfo.cpp b/lib/Target/Sparc/SparcRegisterInfo.cpp index c5034d57ad6..83896f89a20 100644 --- a/lib/Target/Sparc/SparcRegisterInfo.cpp +++ b/lib/Target/Sparc/SparcRegisterInfo.cpp @@ -127,7 +127,7 @@ void SparcV8RegisterInfo::emitEpilogue(MachineFunction &MF, const TargetRegisterClass* SparcV8RegisterInfo::getRegClassForType(const Type* Ty) const { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::FloatTyID: return &FPRegsInstance; case Type::DoubleTyID: return &DFPRegsInstance; case Type::LongTyID: diff --git a/lib/Target/Sparc/SparcV8ISelSimple.cpp b/lib/Target/Sparc/SparcV8ISelSimple.cpp index fac772b65cf..8d308edbd8c 100644 --- a/lib/Target/Sparc/SparcV8ISelSimple.cpp +++ b/lib/Target/Sparc/SparcV8ISelSimple.cpp @@ -168,7 +168,7 @@ enum TypeClass { }; static TypeClass getClass (const Type *T) { - switch (T->getPrimitiveID ()) { + switch (T->getTypeID()) { case Type::UByteTyID: case Type::SByteTyID: return cByte; case Type::UShortTyID: case Type::ShortTyID: return cShort; case Type::PointerTyID: diff --git a/lib/Target/SparcV8/InstSelectSimple.cpp b/lib/Target/SparcV8/InstSelectSimple.cpp index fac772b65cf..8d308edbd8c 100644 --- a/lib/Target/SparcV8/InstSelectSimple.cpp +++ b/lib/Target/SparcV8/InstSelectSimple.cpp @@ -168,7 +168,7 @@ enum TypeClass { }; static TypeClass getClass (const Type *T) { - switch (T->getPrimitiveID ()) { + switch (T->getTypeID()) { case Type::UByteTyID: case Type::SByteTyID: return cByte; case Type::UShortTyID: case Type::ShortTyID: return cShort; case Type::PointerTyID: diff --git a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp index 226f972b59d..342b72065b9 100644 --- a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp +++ b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp @@ -249,7 +249,7 @@ void V8Printer::emitGlobalConstant(const Constant *CV) { // FP Constants are printed as integer constants to avoid losing // precision... double Val = CFP->getValue(); - switch (CFP->getType()->getPrimitiveID()) { + switch (CFP->getType()->getTypeID()) { default: assert(0 && "Unknown floating point type!"); case Type::FloatTyID: { union FU { // Abide by C TBAA rules @@ -274,7 +274,7 @@ void V8Printer::emitGlobalConstant(const Constant *CV) { const Type *type = CV->getType(); O << "\t"; - switch (type->getPrimitiveID()) { + switch (type->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: O << ".byte"; break; diff --git a/lib/Target/SparcV8/SparcV8ISelSimple.cpp b/lib/Target/SparcV8/SparcV8ISelSimple.cpp index fac772b65cf..8d308edbd8c 100644 --- a/lib/Target/SparcV8/SparcV8ISelSimple.cpp +++ b/lib/Target/SparcV8/SparcV8ISelSimple.cpp @@ -168,7 +168,7 @@ enum TypeClass { }; static TypeClass getClass (const Type *T) { - switch (T->getPrimitiveID ()) { + switch (T->getTypeID()) { case Type::UByteTyID: case Type::SByteTyID: return cByte; case Type::UShortTyID: case Type::ShortTyID: return cShort; case Type::PointerTyID: diff --git a/lib/Target/SparcV8/SparcV8RegisterInfo.cpp b/lib/Target/SparcV8/SparcV8RegisterInfo.cpp index c5034d57ad6..83896f89a20 100644 --- a/lib/Target/SparcV8/SparcV8RegisterInfo.cpp +++ b/lib/Target/SparcV8/SparcV8RegisterInfo.cpp @@ -127,7 +127,7 @@ void SparcV8RegisterInfo::emitEpilogue(MachineFunction &MF, const TargetRegisterClass* SparcV8RegisterInfo::getRegClassForType(const Type* Ty) const { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::FloatTyID: return &FPRegsInstance; case Type::DoubleTyID: return &DFPRegsInstance; case Type::LongTyID: diff --git a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp index d7409d896b3..ee172fdd0c8 100644 --- a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp +++ b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp @@ -79,7 +79,7 @@ InstructionNode::InstructionNode(Instruction* I) opLabel = opLabel + 100; // bitwise operator } else if (opLabel == Instruction::Cast) { const Type *ITy = I->getType(); - switch(ITy->getPrimitiveID()) + switch(ITy->getTypeID()) { case Type::BoolTyID: opLabel = ToBoolTy; break; case Type::UByteTyID: opLabel = ToUByteTy; break; diff --git a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp index 6898704191a..aa183452553 100644 --- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp +++ b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp @@ -85,8 +85,7 @@ namespace { inline const std::string TypeToDataDirective(const Type* type) { - switch(type->getPrimitiveID()) - { + switch(type->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: return ".byte"; case Type::UShortTyID: case Type::ShortTyID: diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp index dbe40acad33..f53f856feaf 100644 --- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp +++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp @@ -650,7 +650,7 @@ ChooseSubInstructionByType(const Type* resultType) if (resultType->isInteger() || isa(resultType)) { opCode = V9::SUBr; } else { - switch(resultType->getPrimitiveID()) + switch(resultType->getTypeID()) { case Type::FloatTyID: opCode = V9::FSUBS; break; case Type::DoubleTyID: opCode = V9::FSUBD; break; @@ -691,7 +691,7 @@ ChooseFcmpInstruction(const InstructionNode* instrNode) MachineOpCode opCode = V9::INVALID_OPCODE; Value* operand = ((InstrTreeNode*) instrNode->leftChild())->getValue(); - switch(operand->getType()->getPrimitiveID()) { + switch(operand->getType()->getTypeID()) { case Type::FloatTyID: opCode = V9::FCMPS; break; case Type::DoubleTyID: opCode = V9::FCMPD; break; default: assert(0 && "Invalid type for FCMP instruction"); break; @@ -727,7 +727,7 @@ ChooseMulInstructionByType(const Type* resultType) if (resultType->isInteger()) opCode = V9::MULXr; else - switch(resultType->getPrimitiveID()) + switch(resultType->getTypeID()) { case Type::FloatTyID: opCode = V9::FMULS; break; case Type::DoubleTyID: opCode = V9::FMULD; break; @@ -946,7 +946,7 @@ ChooseDivInstruction(TargetMachine &target, if (resultType->isInteger()) opCode = resultType->isSigned()? V9::SDIVXr : V9::UDIVXr; else - switch(resultType->getPrimitiveID()) + switch(resultType->getTypeID()) { case Type::FloatTyID: opCode = V9::FDIVS; break; case Type::DoubleTyID: opCode = V9::FDIVD; break; diff --git a/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h index a59045fe05d..bf5617a21a2 100644 --- a/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h +++ b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h @@ -23,7 +23,7 @@ namespace llvm { inline MachineOpCode ChooseLoadInstruction(const Type *DestTy) { - switch (DestTy->getPrimitiveID()) { + switch (DestTy->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: return V9::LDUBr; case Type::SByteTyID: return V9::LDSBr; @@ -46,7 +46,7 @@ ChooseLoadInstruction(const Type *DestTy) inline MachineOpCode ChooseStoreInstruction(const Type *DestTy) { - switch (DestTy->getPrimitiveID()) { + switch (DestTy->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: return V9::STBr; @@ -79,7 +79,7 @@ ChooseAddInstructionByType(const Type* resultType) opCode = V9::ADDr; } else - switch(resultType->getPrimitiveID()) + switch(resultType->getTypeID()) { case Type::FloatTyID: opCode = V9::FADDS; break; case Type::DoubleTyID: opCode = V9::FADDD; break; diff --git a/lib/Target/SparcV9/SparcV9RegInfo.cpp b/lib/Target/SparcV9/SparcV9RegInfo.cpp index 2483ca8c366..a7e1dbdcb91 100644 --- a/lib/Target/SparcV9/SparcV9RegInfo.cpp +++ b/lib/Target/SparcV9/SparcV9RegInfo.cpp @@ -272,7 +272,7 @@ int SparcV9RegInfo::getRegType(int unifiedRegNum) const // unsigned SparcV9RegInfo::getRegClassIDOfType(const Type *type, bool isCCReg) const { - Type::PrimitiveID ty = type->getPrimitiveID(); + Type::TypeID ty = type->getTypeID(); unsigned res; // FIXME: Comparing types like this isn't very safe... diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 4b69f103a83..caa66fe0915 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -150,7 +150,7 @@ const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { static inline void getTypeInfo(const Type *Ty, const TargetData *TD, uint64_t &Size, unsigned char &Alignment) { assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::VoidTyID: case Type::BoolTyID: case Type::UByteTyID: diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp index 9cf4b60bd52..0c8b0a45667 100644 --- a/lib/Target/X86/InstSelectSimple.cpp +++ b/lib/Target/X86/InstSelectSimple.cpp @@ -47,7 +47,7 @@ namespace { /// size of the type, and whether or not it is floating point. /// static inline TypeClass getClass(const Type *Ty) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::SByteTyID: case Type::UByteTyID: return cByte; // Byte operands are class #0 case Type::ShortTyID: @@ -3258,7 +3258,7 @@ void ISel::emitCastOperation(MachineBasicBlock *BB, const Type *PromoteType = 0; unsigned PromoteOpcode = 0; unsigned RealDestReg = DestReg; - switch (SrcTy->getPrimitiveID()) { + switch (SrcTy->getTypeID()) { case Type::BoolTyID: case Type::SByteTyID: // We don't have the facilities for directly loading byte sized data from @@ -3429,7 +3429,7 @@ void ISel::visitVANextInst(VANextInst &I) { unsigned DestReg = getReg(I); unsigned Size; - switch (I.getArgType()->getPrimitiveID()) { + switch (I.getArgType()->getTypeID()) { default: std::cerr << I; assert(0 && "Error: bad type for va_next instruction!"); @@ -3454,7 +3454,7 @@ void ISel::visitVAArgInst(VAArgInst &I) { unsigned VAList = getReg(I.getOperand(0)); unsigned DestReg = getReg(I); - switch (I.getType()->getPrimitiveID()) { + switch (I.getType()->getTypeID()) { default: std::cerr << I; assert(0 && "Error: bad type for va_next instruction!"); diff --git a/lib/Target/X86/Printer.cpp b/lib/Target/X86/Printer.cpp index cbc4aeacf56..2a9ba83b4ed 100644 --- a/lib/Target/X86/Printer.cpp +++ b/lib/Target/X86/Printer.cpp @@ -285,7 +285,7 @@ void Printer::emitGlobalConstant(const Constant *CV) { // FP Constants are printed as integer constants to avoid losing // precision... double Val = CFP->getValue(); - switch (CFP->getType()->getPrimitiveID()) { + switch (CFP->getType()->getTypeID()) { default: assert(0 && "Unknown floating point type!"); case Type::FloatTyID: { union FU { // Abide by C TBAA rules @@ -310,7 +310,7 @@ void Printer::emitGlobalConstant(const Constant *CV) { const Type *type = CV->getType(); O << "\t"; - switch (type->getPrimitiveID()) { + switch (type->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: O << ".byte"; break; diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index cbc4aeacf56..2a9ba83b4ed 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -285,7 +285,7 @@ void Printer::emitGlobalConstant(const Constant *CV) { // FP Constants are printed as integer constants to avoid losing // precision... double Val = CFP->getValue(); - switch (CFP->getType()->getPrimitiveID()) { + switch (CFP->getType()->getTypeID()) { default: assert(0 && "Unknown floating point type!"); case Type::FloatTyID: { union FU { // Abide by C TBAA rules @@ -310,7 +310,7 @@ void Printer::emitGlobalConstant(const Constant *CV) { const Type *type = CV->getType(); O << "\t"; - switch (type->getPrimitiveID()) { + switch (type->getTypeID()) { case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID: O << ".byte"; break; diff --git a/lib/Target/X86/X86ISelSimple.cpp b/lib/Target/X86/X86ISelSimple.cpp index 9cf4b60bd52..0c8b0a45667 100644 --- a/lib/Target/X86/X86ISelSimple.cpp +++ b/lib/Target/X86/X86ISelSimple.cpp @@ -47,7 +47,7 @@ namespace { /// size of the type, and whether or not it is floating point. /// static inline TypeClass getClass(const Type *Ty) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::SByteTyID: case Type::UByteTyID: return cByte; // Byte operands are class #0 case Type::ShortTyID: @@ -3258,7 +3258,7 @@ void ISel::emitCastOperation(MachineBasicBlock *BB, const Type *PromoteType = 0; unsigned PromoteOpcode = 0; unsigned RealDestReg = DestReg; - switch (SrcTy->getPrimitiveID()) { + switch (SrcTy->getTypeID()) { case Type::BoolTyID: case Type::SByteTyID: // We don't have the facilities for directly loading byte sized data from @@ -3429,7 +3429,7 @@ void ISel::visitVANextInst(VANextInst &I) { unsigned DestReg = getReg(I); unsigned Size; - switch (I.getArgType()->getPrimitiveID()) { + switch (I.getArgType()->getTypeID()) { default: std::cerr << I; assert(0 && "Error: bad type for va_next instruction!"); @@ -3454,7 +3454,7 @@ void ISel::visitVAArgInst(VAArgInst &I) { unsigned VAList = getReg(I.getOperand(0)); unsigned DestReg = getReg(I); - switch (I.getType()->getPrimitiveID()) { + switch (I.getType()->getTypeID()) { default: std::cerr << I; assert(0 && "Error: bad type for va_next instruction!"); diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index 02d9fc5d17f..03fe5505aed 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -503,7 +503,7 @@ void X86RegisterInfo::emitEpilogue(MachineFunction &MF, const TargetRegisterClass* X86RegisterInfo::getRegClassForType(const Type* Ty) const { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::LongTyID: case Type::ULongTyID: assert(0 && "Long values can't fit in registers!"); default: assert(0 && "Invalid type to getClass!"); diff --git a/lib/Target/X86/X86SimpInstrSelector.cpp b/lib/Target/X86/X86SimpInstrSelector.cpp index 3c02acb4044..7a6115e3ec7 100644 --- a/lib/Target/X86/X86SimpInstrSelector.cpp +++ b/lib/Target/X86/X86SimpInstrSelector.cpp @@ -347,7 +347,7 @@ enum Subclasses { /// size of the type, and whether or not it is floating point. /// static inline TypeClass getClass(const Type *Ty) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::SByteTyID: case Type::UByteTyID: return cByte; // Byte operands are class #0 case Type::ShortTyID: @@ -2246,7 +2246,7 @@ void ISel::emitCastOperation(MachineBasicBlock *BB, const Type *PromoteType = 0; unsigned PromoteOpcode; unsigned RealDestReg = DestReg; - switch (SrcTy->getPrimitiveID()) { + switch (SrcTy->getTypeID()) { case Type::BoolTyID: case Type::SByteTyID: // We don't have the facilities for directly loading byte sized data from @@ -2418,7 +2418,7 @@ void ISel::visitVANextInst(VANextInst &I) { unsigned DestReg = getReg(I); unsigned Size; - switch (I.getArgType()->getPrimitiveID()) { + switch (I.getArgType()->getTypeID()) { default: std::cerr << I; assert(0 && "Error: bad type for va_next instruction!"); @@ -2443,7 +2443,7 @@ void ISel::visitVAArgInst(VAArgInst &I) { unsigned VAList = getReg(I.getOperand(0)); unsigned DestReg = getReg(I); - switch (I.getType()->getPrimitiveID()) { + switch (I.getType()->getTypeID()) { default: std::cerr << I; assert(0 && "Error: bad type for va_next instruction!"); diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp index d0179809b98..528c8acce18 100644 --- a/lib/Transforms/IPO/FunctionResolution.cpp +++ b/lib/Transforms/IPO/FunctionResolution.cpp @@ -79,8 +79,8 @@ static bool ResolveFunctions(Module &M, std::vector &Globals, if (!Old->use_empty() && !Concrete->use_empty()) for (unsigned i = 0; i < NumArguments; ++i) if (OldMT->getParamType(i) != ConcreteMT->getParamType(i)) - if (OldMT->getParamType(i)->getPrimitiveID() != - ConcreteMT->getParamType(i)->getPrimitiveID()) { + if (OldMT->getParamType(i)->getTypeID() != + ConcreteMT->getParamType(i)->getTypeID()) { std::cerr << "WARNING: Function [" << Old->getName() << "]: Parameter types conflict for: '"; WriteTypeSymbolic(std::cerr, OldMT, &M); diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp index 38f9445218c..d6896731291 100644 --- a/lib/Transforms/IPO/MutateStructTypes.cpp +++ b/lib/Transforms/IPO/MutateStructTypes.cpp @@ -54,7 +54,7 @@ const Type *MutateStructTypes::ConvertType(const Type *Ty) { PATypeHolder PlaceHolder = OpaqueType::get(); TypeMap.insert(std::make_pair(Ty, PlaceHolder.get())); - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::FunctionTyID: { const FunctionType *FT = cast(Ty); const Type *RetTy = ConvertType(FT->getReturnType()); diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp index 6220140afe3..00906a46a26 100644 --- a/lib/Transforms/Utils/Linker.cpp +++ b/lib/Transforms/Utils/Linker.cpp @@ -97,10 +97,10 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy, // Two types cannot be resolved together if they are of different primitive // type. For example, we cannot resolve an int to a float. - if (DestTyT->getPrimitiveID() != SrcTyT->getPrimitiveID()) return true; + if (DestTyT->getTypeID() != SrcTyT->getTypeID()) return true; // Otherwise, resolve the used type used by this derived type... - switch (DestTyT->getPrimitiveID()) { + switch (DestTyT->getTypeID()) { case Type::FunctionTyID: { if (cast(DestTyT)->isVarArg() != cast(SrcTyT)->isVarArg() || diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 570d5b3d4f3..976cdd5b7fd 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -262,7 +262,7 @@ static void calcTypeName(const Type *Ty, TypeStack.push_back(Ty); // Recursive case: Add us to the stack.. - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::FunctionTyID: { const FunctionType *FTy = cast(Ty); calcTypeName(FTy->getReturnType(), TypeStack, TypeNames, Result); diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 70984cd0a63..a57606669d3 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -489,7 +489,7 @@ ConstRules &ConstRules::get(const Constant *V1, const Constant *V2) { isa(V1) || isa(V2)) return EmptyR; - switch (V1->getType()->getPrimitiveID()) { + switch (V1->getType()->getTypeID()) { default: assert(0 && "Unknown value type for constant folding!"); case Type::BoolTyID: return BoolR; case Type::PointerTyID: return NullPointerR; @@ -564,7 +564,7 @@ Constant *llvm::ConstantFoldCastInstruction(const Constant *V, ConstRules &Rules = ConstRules::get(V, V); - switch (DestTy->getPrimitiveID()) { + switch (DestTy->getTypeID()) { case Type::BoolTyID: return Rules.castToBool(V); case Type::UByteTyID: return Rules.castToUByte(V); case Type::SByteTyID: return Rules.castToSByte(V); diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 3e5cd78d442..e18f9b2e543 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -66,7 +66,7 @@ void Constant::destroyConstantImpl() { // Static constructor to create a '0' constant of arbitrary type... Constant *Constant::getNullValue(const Type *Ty) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: { static Constant *NullBool = ConstantBool::get(false); return NullBool; @@ -128,7 +128,7 @@ Constant *Constant::getNullValue(const Type *Ty) { // Static constructor to create the maximum constant of an integral type... ConstantIntegral *ConstantIntegral::getMaxValue(const Type *Ty) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: return ConstantBool::True; case Type::SByteTyID: case Type::ShortTyID: @@ -152,7 +152,7 @@ ConstantIntegral *ConstantIntegral::getMaxValue(const Type *Ty) { // Static constructor to create the minimum constant for an integral type... ConstantIntegral *ConstantIntegral::getMinValue(const Type *Ty) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: return ConstantBool::False; case Type::SByteTyID: case Type::ShortTyID: @@ -176,7 +176,7 @@ ConstantIntegral *ConstantIntegral::getMinValue(const Type *Ty) { // Static constructor to create an integral constant with all bits set ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::BoolTyID: return ConstantBool::True; case Type::SByteTyID: case Type::ShortTyID: @@ -243,8 +243,7 @@ ConstantArray::ConstantArray(const ArrayType *T, for (unsigned i = 0, e = V.size(); i != e; ++i) { assert(V[i]->getType() == T->getElementType() || (T->isAbstract() && - V[i]->getType()->getPrimitiveID() == - T->getElementType()->getPrimitiveID())); + V[i]->getType()->getTypeID() == T->getElementType()->getTypeID())); Operands.push_back(Use(V[i], this)); } } @@ -258,8 +257,7 @@ ConstantStruct::ConstantStruct(const StructType *T, assert((V[i]->getType() == T->getElementType(i) || ((T->getElementType(i)->isAbstract() || V[i]->getType()->isAbstract()) && - T->getElementType(i)->getPrimitiveID() == - V[i]->getType()->getPrimitiveID())) && + T->getElementType(i)->getTypeID() == V[i]->getType()->getTypeID())) && "Initializer for struct element doesn't match struct element type!"); Operands.push_back(Use(V[i], this)); } @@ -433,7 +431,7 @@ bool ConstantPointerRef::classof(const Constant *CPV) { // isValueValidForType implementations bool ConstantSInt::isValueValidForType(const Type *Ty, int64_t Val) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { default: return false; // These can't be represented as integers!!! // Signed types... @@ -449,7 +447,7 @@ bool ConstantSInt::isValueValidForType(const Type *Ty, int64_t Val) { } bool ConstantUInt::isValueValidForType(const Type *Ty, uint64_t Val) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { default: return false; // These can't be represented as integers!!! @@ -466,7 +464,7 @@ bool ConstantUInt::isValueValidForType(const Type *Ty, uint64_t Val) { } bool ConstantFP::isValueValidForType(const Type *Ty, double Val) { - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { default: return false; // These can't be represented as floating point! diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp index 6220140afe3..00906a46a26 100644 --- a/lib/VMCore/Linker.cpp +++ b/lib/VMCore/Linker.cpp @@ -97,10 +97,10 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy, // Two types cannot be resolved together if they are of different primitive // type. For example, we cannot resolve an int to a float. - if (DestTyT->getPrimitiveID() != SrcTyT->getPrimitiveID()) return true; + if (DestTyT->getTypeID() != SrcTyT->getTypeID()) return true; // Otherwise, resolve the used type used by this derived type... - switch (DestTyT->getPrimitiveID()) { + switch (DestTyT->getTypeID()) { case Type::FunctionTyID: { if (cast(DestTyT)->isVarArg() != cast(SrcTyT)->isVarArg() || diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 9d98bd9f1ac..77984892424 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -42,7 +42,7 @@ static std::vector UIDMappings; static std::map ConcreteTypeDescriptions; static std::map AbstractTypeDescriptions; -Type::Type(const std::string &name, PrimitiveID id) +Type::Type(const std::string &name, TypeID id) : Value(Type::TypeTy, Value::TypeVal), RefCount(0), ForwardType(0) { if (!name.empty()) ConcreteTypeDescriptions[this] = name; @@ -64,7 +64,7 @@ const Type *Type::getUniqueIDType(unsigned UID) { return UIDMappings[UID]; } -const Type *Type::getPrimitiveType(PrimitiveID IDNumber) { +const Type *Type::getPrimitiveType(TypeID IDNumber) { switch (IDNumber) { case VoidTyID : return VoidTy; case BoolTyID : return BoolTy; @@ -93,11 +93,11 @@ bool Type::isLosslesslyConvertibleTo(const Type *Ty) const { if ((!isPrimitiveType() && !isa(this)) || (!isa(Ty) && !Ty->isPrimitiveType())) return false; - if (getPrimitiveID() == Ty->getPrimitiveID()) + if (getTypeID() == Ty->getTypeID()) return true; // Handles identity cast, and cast of differing pointer types // Now we know that they are two differing primitive or pointer types - switch (getPrimitiveID()) { + switch (getTypeID()) { case Type::UByteTyID: return Ty == Type::SByteTy; case Type::SByteTyID: return Ty == Type::UByteTy; case Type::UShortTyID: return Ty == Type::ShortTy; @@ -115,7 +115,7 @@ bool Type::isLosslesslyConvertibleTo(const Type *Ty) const { /// getUnsignedVersion - If this is an integer type, return the unsigned /// variant of this type. For example int -> uint. const Type *Type::getUnsignedVersion() const { - switch (getPrimitiveID()) { + switch (getTypeID()) { default: assert(isInteger()&&"Type::getUnsignedVersion is only valid for integers!"); case Type::UByteTyID: @@ -132,7 +132,7 @@ const Type *Type::getUnsignedVersion() const { /// getSignedVersion - If this is an integer type, return the signed variant /// of this type. For example uint -> int. const Type *Type::getSignedVersion() const { - switch (getPrimitiveID()) { + switch (getTypeID()) { default: assert(isInteger() && "Type::getSignedVersion is only valid for integers!"); case Type::UByteTyID: @@ -152,7 +152,7 @@ const Type *Type::getSignedVersion() const { // return zero if the type does not have a size or is not a primitive type. // unsigned Type::getPrimitiveSize() const { - switch (getPrimitiveID()) { + switch (getTypeID()) { #define HANDLE_PRIM_TYPE(TY,SIZE) case TY##TyID: return SIZE; #include "llvm/Type.def" default: return 0; @@ -220,7 +220,7 @@ static std::string getTypeDescription(const Type *Ty, std::string Result; TypeStack.push_back(Ty); // Add us to the stack.. - switch (Ty->getPrimitiveID()) { + switch (Ty->getTypeID()) { case Type::FunctionTyID: { const FunctionType *FTy = cast(Ty); Result = getTypeDescription(FTy->getReturnType(), TypeStack) + " ("; @@ -318,7 +318,7 @@ const Type *StructType::getTypeAtIndex(const Value *V) const { // type. // struct SignedIntType : public Type { - SignedIntType(const std::string &Name, PrimitiveID id) : Type(Name, id) {} + SignedIntType(const std::string &Name, TypeID id) : Type(Name, id) {} // isSigned - Return whether a numeric type is signed. virtual bool isSigned() const { return 1; } @@ -330,7 +330,7 @@ struct SignedIntType : public Type { }; struct UnsignedIntType : public Type { - UnsignedIntType(const std::string &N, PrimitiveID id) : Type(N, id) {} + UnsignedIntType(const std::string &N, TypeID id) : Type(N, id) {} // isUnsigned - Return whether a numeric type is signed. virtual bool isUnsigned() const { return 1; } @@ -342,7 +342,7 @@ struct UnsignedIntType : public Type { }; struct OtherType : public Type { - OtherType(const std::string &N, PrimitiveID id) : Type(N, id) {} + OtherType(const std::string &N, TypeID id) : Type(N, id) {} }; static struct TypeType : public Type { @@ -503,7 +503,7 @@ bool Type::isTypeAbstract() { static bool TypesEqual(const Type *Ty, const Type *Ty2, std::map &EqTypes) { if (Ty == Ty2) return true; - if (Ty->getPrimitiveID() != Ty2->getPrimitiveID()) return false; + if (Ty->getTypeID() != Ty2->getTypeID()) return false; if (isa(Ty)) return false; // Two unequal opaque types are never equal