Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14201 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-06-17 18:19:28 +00:00
parent 5dd04027c7
commit f70c22b019
52 changed files with 170 additions and 173 deletions

View File

@ -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));

View File

@ -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

View File

@ -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);

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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())

View File

@ -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.");

View File

@ -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)

View File

@ -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())

View File

@ -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...

View File

@ -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())

View File

@ -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);

View File

@ -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;

View File

@ -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...

View File

@ -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");

View File

@ -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<const Value*> ValuePlane;
/// @brief A table of Values. Intended index is Type::PrimitiveID.
/// @brief A table of Values. Intended index is Type::TypeID.
typedef std::vector<ValuePlane> ValueTable;
/// @brief A map of values to slot numbers.

View File

@ -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;

View File

@ -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<PointerType>(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<CLASS>(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<ConstantArray>(Init);
const std::vector<Use> &Val = CPA->getValues();

View File

@ -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);

View File

@ -38,7 +38,7 @@ static std::map<std::string, ExFunc> 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';

View File

@ -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<FunctionType>(DestTyT)->isVarArg() !=
cast<FunctionType>(SrcTyT)->isVarArg() ||

View File

@ -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<FunctionType>(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:

View File

@ -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<FunctionType>(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:

View File

@ -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:

View File

@ -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;

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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;

View File

@ -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:

View File

@ -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:

View File

@ -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;

View File

@ -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:

View File

@ -650,7 +650,7 @@ ChooseSubInstructionByType(const Type* resultType)
if (resultType->isInteger() || isa<PointerType>(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;

View File

@ -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;

View File

@ -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...

View File

@ -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:

View File

@ -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!");

View File

@ -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;

View File

@ -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;

View File

@ -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!");

View File

@ -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!");

View File

@ -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!");

View File

@ -79,8 +79,8 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &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);

View File

@ -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<FunctionType>(Ty);
const Type *RetTy = ConvertType(FT->getReturnType());

View File

@ -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<FunctionType>(DestTyT)->isVarArg() !=
cast<FunctionType>(SrcTyT)->isVarArg() ||

View File

@ -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<FunctionType>(Ty);
calcTypeName(FTy->getReturnType(), TypeStack, TypeNames, Result);

View File

@ -489,7 +489,7 @@ ConstRules &ConstRules::get(const Constant *V1, const Constant *V2) {
isa<ConstantPointerRef>(V1) || isa<ConstantPointerRef>(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);

View File

@ -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!

View File

@ -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<FunctionType>(DestTyT)->isVarArg() !=
cast<FunctionType>(SrcTyT)->isVarArg() ||

View File

@ -42,7 +42,7 @@ static std::vector<const Type *> UIDMappings;
static std::map<const Type*, std::string> ConcreteTypeDescriptions;
static std::map<const Type*, std::string> 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<PointerType>(this)) ||
(!isa<PointerType>(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<FunctionType>(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<const Type *, const Type *> &EqTypes) {
if (Ty == Ty2) return true;
if (Ty->getPrimitiveID() != Ty2->getPrimitiveID()) return false;
if (Ty->getTypeID() != Ty2->getTypeID()) return false;
if (isa<OpaqueType>(Ty))
return false; // Two unequal opaque types are never equal