Changes in directory llvm/lib/VMCore:
AsmWriter.cpp updated: 1.260 -> 1.261 ConstantFolding.cpp updated: 1.135 -> 1.136 Constants.cpp updated: 1.209 -> 1.210 Instructions.cpp updated: 1.75 -> 1.76 Type.cpp updated: 1.171 -> 1.172 ValueTypes.cpp updated: 1.13 -> 1.14 Verifier.cpp updated: 1.195 -> 1.196 --- Log message: For PR1195: http://llvm.org/PR1195 : Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and PackedTyID -> VectorTyID. No functional changes. --- Diffs of the changes: (+153 -153) AsmWriter.cpp | 8 ++--- ConstantFolding.cpp | 66 ++++++++++++++++++++++---------------------- Constants.cpp | 78 ++++++++++++++++++++++++++-------------------------- Instructions.cpp | 62 ++++++++++++++++++++--------------------- Type.cpp | 62 ++++++++++++++++++++--------------------- ValueTypes.cpp | 18 ++++++------ Verifier.cpp | 12 ++++---- 7 files changed, 153 insertions(+), 153 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.260 llvm/lib/VMCore/AsmWriter.cpp:1.261 --- llvm/lib/VMCore/AsmWriter.cpp:1.260 Mon Feb 5 14:47:20 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Wed Feb 14 20:26:10 2007 @@ -342,8 +342,8 @@ Result += "]"; break; } - case Type::PackedTyID: { - const PackedType *PTy = cast<PackedType>(Ty); + case Type::VectorTyID: { + const VectorType *PTy = cast<VectorType>(Ty); Result += "<" + utostr(PTy->getNumElements()) + " x "; calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result); Result += ">"; @@ -548,7 +548,7 @@ Out << " }"; if (CS->getType()->isPacked()) Out << '>'; - } else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(CV)) { + } else if (const ConstantVector *CP = dyn_cast<ConstantVector>(CV)) { const Type *ETy = CP->getType()->getElementType(); assert(CP->getNumOperands() > 0 && "Number of operands for a PackedConst must be > 0"); @@ -772,7 +772,7 @@ } else if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) { Out << '[' << ATy->getNumElements() << " x "; printType(ATy->getElementType()) << ']'; - } else if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) { + } else if (const VectorType *PTy = dyn_cast<VectorType>(Ty)) { Out << '<' << PTy->getNumElements() << " x "; printType(PTy->getElementType()) << '>'; } Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.135 llvm/lib/VMCore/ConstantFolding.cpp:1.136 --- llvm/lib/VMCore/ConstantFolding.cpp:1.135 Mon Feb 5 20:22:56 2007 +++ llvm/lib/VMCore/ConstantFolding.cpp Wed Feb 14 20:26:10 2007 @@ -35,11 +35,11 @@ // ConstantFold*Instruction Implementations //===----------------------------------------------------------------------===// -/// CastConstantPacked - Convert the specified ConstantPacked node to the +/// CastConstantVector - Convert the specified ConstantVector node to the /// specified packed type. At this point, we know that the elements of the /// input packed constant are all simple integer or FP values. -static Constant *CastConstantPacked(ConstantPacked *CP, - const PackedType *DstTy) { +static Constant *CastConstantVector(ConstantVector *CP, + const VectorType *DstTy) { unsigned SrcNumElts = CP->getType()->getNumElements(); unsigned DstNumElts = DstTy->getNumElements(); const Type *SrcEltTy = CP->getType()->getElementType(); @@ -57,7 +57,7 @@ for (unsigned i = 0; i != SrcNumElts; ++i) Result.push_back( ConstantExpr::getBitCast(CP->getOperand(i), DstEltTy)); - return ConstantPacked::get(Result); + return ConstantVector::get(Result); } // If this is an int-to-fp cast .. @@ -70,7 +70,7 @@ BitsToDouble(cast<ConstantInt>(CP->getOperand(i))->getZExtValue()); Result.push_back(ConstantFP::get(Type::DoubleTy, V)); } - return ConstantPacked::get(Result); + return ConstantVector::get(Result); } assert(DstEltTy == Type::FloatTy && "Unknown fp type!"); for (unsigned i = 0; i != SrcNumElts; ++i) { @@ -78,7 +78,7 @@ BitsToFloat(cast<ConstantInt>(CP->getOperand(i))->getZExtValue()); Result.push_back(ConstantFP::get(Type::FloatTy, V)); } - return ConstantPacked::get(Result); + return ConstantVector::get(Result); } // Otherwise, this is an fp-to-int cast. @@ -91,7 +91,7 @@ Constant *C = ConstantInt::get(Type::Int64Ty, V); Result.push_back(ConstantExpr::getBitCast(C, DstEltTy )); } - return ConstantPacked::get(Result); + return ConstantVector::get(Result); } assert(SrcEltTy->getTypeID() == Type::FloatTyID); @@ -100,7 +100,7 @@ Constant *C = ConstantInt::get(Type::Int32Ty, V); Result.push_back(ConstantExpr::getBitCast(C, DstEltTy)); } - return ConstantPacked::get(Result); + return ConstantVector::get(Result); } // Otherwise, this is a cast that changes element count and size. Handle @@ -242,8 +242,8 @@ // Handle casts from one packed constant to another. We know that the src // and dest type have the same size (otherwise its an illegal cast). - if (const PackedType *DestPTy = dyn_cast<PackedType>(DestTy)) { - if (const PackedType *SrcTy = dyn_cast<PackedType>(V->getType())) { + if (const VectorType *DestPTy = dyn_cast<VectorType>(DestTy)) { + if (const VectorType *SrcTy = dyn_cast<VectorType>(V->getType())) { assert(DestPTy->getBitWidth() == SrcTy->getBitWidth() && "Not cast between same sized vectors!"); // First, check for null and undef @@ -252,9 +252,9 @@ if (isa<UndefValue>(V)) return UndefValue::get(DestTy); - if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(V)) { - // This is a cast from a ConstantPacked of one type to a - // ConstantPacked of another type. Check to see if all elements of + if (const ConstantVector *CP = dyn_cast<ConstantVector>(V)) { + // This is a cast from a ConstantVector of one type to a + // ConstantVector of another type. Check to see if all elements of // the input are simple. bool AllSimpleConstants = true; for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) { @@ -267,7 +267,7 @@ // If all of the elements are simple constants, we can fold this. if (AllSimpleConstants) - return CastConstantPacked(const_cast<ConstantPacked*>(CP), DestPTy); + return CastConstantVector(const_cast<ConstantVector*>(CP), DestPTy); } } } @@ -329,12 +329,12 @@ Constant *llvm::ConstantFoldExtractElementInstruction(const Constant *Val, const Constant *Idx) { if (isa<UndefValue>(Val)) // ee(undef, x) -> undef - return UndefValue::get(cast<PackedType>(Val->getType())->getElementType()); + return UndefValue::get(cast<VectorType>(Val->getType())->getElementType()); if (Val->isNullValue()) // ee(zero, x) -> zero return Constant::getNullValue( - cast<PackedType>(Val->getType())->getElementType()); + cast<VectorType>(Val->getType())->getElementType()); - if (const ConstantPacked *CVal = dyn_cast<ConstantPacked>(Val)) { + if (const ConstantVector *CVal = dyn_cast<ConstantVector>(Val)) { if (const ConstantInt *CIdx = dyn_cast<ConstantInt>(Idx)) { return const_cast<Constant*>(CVal->getOperand(CIdx->getZExtValue())); } else if (isa<UndefValue>(Idx)) { @@ -359,7 +359,7 @@ // Otherwise break the aggregate undef into multiple undefs and do // the insertion unsigned numOps = - cast<PackedType>(Val->getType())->getNumElements(); + cast<VectorType>(Val->getType())->getNumElements(); std::vector<Constant*> Ops; Ops.reserve(numOps); for (unsigned i = 0; i < numOps; ++i) { @@ -367,7 +367,7 @@ (i == idxVal) ? Elt : UndefValue::get(Elt->getType()); Ops.push_back(const_cast<Constant*>(Op)); } - return ConstantPacked::get(Ops); + return ConstantVector::get(Ops); } if (isa<ConstantAggregateZero>(Val)) { // Insertion of scalar constant into packed aggregate zero @@ -377,7 +377,7 @@ // Otherwise break the aggregate zero into multiple zeros and do // the insertion unsigned numOps = - cast<PackedType>(Val->getType())->getNumElements(); + cast<VectorType>(Val->getType())->getNumElements(); std::vector<Constant*> Ops; Ops.reserve(numOps); for (unsigned i = 0; i < numOps; ++i) { @@ -385,9 +385,9 @@ (i == idxVal) ? Elt : Constant::getNullValue(Elt->getType()); Ops.push_back(const_cast<Constant*>(Op)); } - return ConstantPacked::get(Ops); + return ConstantVector::get(Ops); } - if (const ConstantPacked *CVal = dyn_cast<ConstantPacked>(Val)) { + if (const ConstantVector *CVal = dyn_cast<ConstantVector>(Val)) { // Insertion of scalar constant into packed constant std::vector<Constant*> Ops; Ops.reserve(CVal->getNumOperands()); @@ -396,7 +396,7 @@ (i == idxVal) ? Elt : cast<Constant>(CVal->getOperand(i)); Ops.push_back(const_cast<Constant*>(Op)); } - return ConstantPacked::get(Ops); + return ConstantVector::get(Ops); } return 0; } @@ -409,16 +409,16 @@ } /// EvalVectorOp - Given two packed constants and a function pointer, apply the -/// function pointer to each element pair, producing a new ConstantPacked +/// function pointer to each element pair, producing a new ConstantVector /// constant. -static Constant *EvalVectorOp(const ConstantPacked *V1, - const ConstantPacked *V2, +static Constant *EvalVectorOp(const ConstantVector *V1, + const ConstantVector *V2, Constant *(*FP)(Constant*, Constant*)) { std::vector<Constant*> Res; for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i) Res.push_back(FP(const_cast<Constant*>(V1->getOperand(i)), const_cast<Constant*>(V2->getOperand(i)))); - return ConstantPacked::get(Res); + return ConstantVector::get(Res); } Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, @@ -444,8 +444,8 @@ return Constant::getNullValue(C1->getType()); return const_cast<Constant*>(C2); // X / undef -> undef case Instruction::Or: // X | undef -> -1 - if (const PackedType *PTy = dyn_cast<PackedType>(C1->getType())) - return ConstantPacked::getAllOnesValue(PTy); + if (const VectorType *PTy = dyn_cast<VectorType>(C1->getType())) + return ConstantVector::getAllOnesValue(PTy); return ConstantInt::getAllOnesValue(C1->getType()); case Instruction::LShr: if (isa<UndefValue>(C2) && isa<UndefValue>(C1)) @@ -632,8 +632,8 @@ return ConstantFP::get(CFP1->getType(), std::fmod(C1Val, C2Val)); } } - } else if (const ConstantPacked *CP1 = dyn_cast<ConstantPacked>(C1)) { - if (const ConstantPacked *CP2 = dyn_cast<ConstantPacked>(C2)) { + } else if (const ConstantVector *CP1 = dyn_cast<ConstantVector>(C1)) { + if (const ConstantVector *CP2 = dyn_cast<ConstantVector>(C2)) { switch (Opcode) { default: break; @@ -1115,8 +1115,8 @@ case FCmpInst::FCMP_OGE: return ConstantInt::get(Type::Int1Ty, C1Val >= C2Val); } - } else if (const ConstantPacked *CP1 = dyn_cast<ConstantPacked>(C1)) { - if (const ConstantPacked *CP2 = dyn_cast<ConstantPacked>(C2)) { + } else if (const ConstantVector *CP1 = dyn_cast<ConstantVector>(C1)) { + if (const ConstantVector *CP2 = dyn_cast<ConstantVector>(C2)) { if (pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ) { for (unsigned i = 0, e = CP1->getNumOperands(); i != e; ++i) { Constant *C= ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.209 llvm/lib/VMCore/Constants.cpp:1.210 --- llvm/lib/VMCore/Constants.cpp:1.209 Mon Feb 5 17:47:56 2007 +++ llvm/lib/VMCore/Constants.cpp Wed Feb 14 20:26:10 2007 @@ -131,7 +131,7 @@ return ConstantPointerNull::get(cast<PointerType>(Ty)); case Type::StructTyID: case Type::ArrayTyID: - case Type::PackedTyID: + case Type::VectorTyID: return ConstantAggregateZero::get(Ty); default: // Function, Label, or Opaque type? @@ -154,12 +154,12 @@ /// @returns the value for an packed integer constant of the given type that /// has all its bits set to true. /// @brief Get the all ones value -ConstantPacked *ConstantPacked::getAllOnesValue(const PackedType *Ty) { +ConstantVector *ConstantVector::getAllOnesValue(const VectorType *Ty) { std::vector<Constant*> Elts; Elts.resize(Ty->getNumElements(), ConstantInt::getAllOnesValue(Ty->getElementType())); assert(Elts[0] && "Not a packed integer type!"); - return cast<ConstantPacked>(ConstantPacked::get(Elts)); + return cast<ConstantVector>(ConstantVector::get(Elts)); } @@ -229,9 +229,9 @@ } -ConstantPacked::ConstantPacked(const PackedType *T, +ConstantVector::ConstantVector(const VectorType *T, const std::vector<Constant*> &V) - : Constant(T, ConstantPackedVal, new Use[V.size()], V.size()) { + : Constant(T, ConstantVectorVal, new Use[V.size()], V.size()) { Use *OL = OperandList; for (std::vector<Constant*>::const_iterator I = V.begin(), E = V.end(); I != E; ++I, ++OL) { @@ -244,7 +244,7 @@ } } -ConstantPacked::~ConstantPacked() { +ConstantVector::~ConstantVector() { delete [] OperandList; } @@ -293,7 +293,7 @@ Use Ops[2]; public: ExtractElementConstantExpr(Constant *C1, Constant *C2) - : ConstantExpr(cast<PackedType>(C1->getType())->getElementType(), + : ConstantExpr(cast<VectorType>(C1->getType())->getElementType(), Instruction::ExtractElement, Ops, 2) { Ops[0].init(C1, this); Ops[1].init(C2, this); @@ -919,7 +919,7 @@ static char getValType(ConstantAggregateZero *CPZ) { return 0; } Constant *ConstantAggregateZero::get(const Type *Ty) { - assert((isa<StructType>(Ty) || isa<ArrayType>(Ty) || isa<PackedType>(Ty)) && + assert((isa<StructType>(Ty) || isa<ArrayType>(Ty) || isa<VectorType>(Ty)) && "Cannot create an aggregate zero of non-aggregate type!"); return AggZeroConstants->getOrCreate(Ty, 0); } @@ -1108,17 +1108,17 @@ destroyConstantImpl(); } -//---- ConstantPacked::get() implementation... +//---- ConstantVector::get() implementation... // namespace llvm { template<> - struct ConvertConstantType<ConstantPacked, PackedType> { - static void convert(ConstantPacked *OldC, const PackedType *NewTy) { + struct ConvertConstantType<ConstantVector, VectorType> { + static void convert(ConstantVector *OldC, const VectorType *NewTy) { // Make everyone now use a constant of the new type... std::vector<Constant*> C; for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) C.push_back(cast<Constant>(OldC->getOperand(i))); - Constant *New = ConstantPacked::get(NewTy, C); + Constant *New = ConstantVector::get(NewTy, C); assert(New != OldC && "Didn't replace constant??"); OldC->uncheckedReplaceAllUsesWith(New); OldC->destroyConstant(); // This constant is now dead, destroy it. @@ -1126,7 +1126,7 @@ }; } -static std::vector<Constant*> getValType(ConstantPacked *CP) { +static std::vector<Constant*> getValType(ConstantVector *CP) { std::vector<Constant*> Elements; Elements.reserve(CP->getNumOperands()); for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) @@ -1134,10 +1134,10 @@ return Elements; } -static ManagedStatic<ValueMap<std::vector<Constant*>, PackedType, - ConstantPacked> > PackedConstants; +static ManagedStatic<ValueMap<std::vector<Constant*>, VectorType, + ConstantVector> > PackedConstants; -Constant *ConstantPacked::get(const PackedType *Ty, +Constant *ConstantVector::get(const VectorType *Ty, const std::vector<Constant*> &V) { // If this is an all-zero packed, return a ConstantAggregateZero object if (!V.empty()) { @@ -1151,14 +1151,14 @@ return ConstantAggregateZero::get(Ty); } -Constant *ConstantPacked::get(const std::vector<Constant*> &V) { +Constant *ConstantVector::get(const std::vector<Constant*> &V) { assert(!V.empty() && "Cannot infer type if V is empty"); - return get(PackedType::get(V.front()->getType(),V.size()), V); + return get(VectorType::get(V.front()->getType(),V.size()), V); } // destroyConstant - Remove the constant from the constant table... // -void ConstantPacked::destroyConstant() { +void ConstantVector::destroyConstant() { PackedConstants->remove(this); destroyConstantImpl(); } @@ -1167,7 +1167,7 @@ /// is set to all ones. /// @returns true iff this constant's emements are all set to all ones. /// @brief Determine if the value is all ones. -bool ConstantPacked::isAllOnesValue() const { +bool ConstantVector::isAllOnesValue() const { // Check out first element. const Constant *Elt = getOperand(0); const ConstantInt *CI = dyn_cast<ConstantInt>(Elt); @@ -1635,40 +1635,40 @@ case Instruction::Mul: assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert((C1->getType()->isInteger() || C1->getType()->isFloatingPoint() || - isa<PackedType>(C1->getType())) && + isa<VectorType>(C1->getType())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; case Instruction::UDiv: case Instruction::SDiv: assert(C1->getType() == C2->getType() && "Op types should be identical!"); - assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) && - cast<PackedType>(C1->getType())->getElementType()->isInteger())) && + assert((C1->getType()->isInteger() || (isa<VectorType>(C1->getType()) && + cast<VectorType>(C1->getType())->getElementType()->isInteger())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; case Instruction::FDiv: assert(C1->getType() == C2->getType() && "Op types should be identical!"); - assert((C1->getType()->isFloatingPoint() || (isa<PackedType>(C1->getType()) - && cast<PackedType>(C1->getType())->getElementType()->isFloatingPoint())) + assert((C1->getType()->isFloatingPoint() || (isa<VectorType>(C1->getType()) + && cast<VectorType>(C1->getType())->getElementType()->isFloatingPoint())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; case Instruction::URem: case Instruction::SRem: assert(C1->getType() == C2->getType() && "Op types should be identical!"); - assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) && - cast<PackedType>(C1->getType())->getElementType()->isInteger())) && + assert((C1->getType()->isInteger() || (isa<VectorType>(C1->getType()) && + cast<VectorType>(C1->getType())->getElementType()->isInteger())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; case Instruction::FRem: assert(C1->getType() == C2->getType() && "Op types should be identical!"); - assert((C1->getType()->isFloatingPoint() || (isa<PackedType>(C1->getType()) - && cast<PackedType>(C1->getType())->getElementType()->isFloatingPoint())) + assert((C1->getType()->isFloatingPoint() || (isa<VectorType>(C1->getType()) + && cast<VectorType>(C1->getType())->getElementType()->isFloatingPoint())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; case Instruction::And: case Instruction::Or: case Instruction::Xor: assert(C1->getType() == C2->getType() && "Op types should be identical!"); - assert((C1->getType()->isInteger() || isa<PackedType>(C1->getType())) && + assert((C1->getType()->isInteger() || isa<VectorType>(C1->getType())) && "Tried to create a logical operation on a non-integral type!"); break; case Instruction::Shl: @@ -1792,11 +1792,11 @@ } Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) { - assert(isa<PackedType>(Val->getType()) && + assert(isa<VectorType>(Val->getType()) && "Tried to create extractelement operation on non-packed type!"); assert(Idx->getType() == Type::Int32Ty && "Extractelement index must be i32 type!"); - return getExtractElementTy(cast<PackedType>(Val->getType())->getElementType(), + return getExtractElementTy(cast<VectorType>(Val->getType())->getElementType(), Val, Idx); } @@ -1814,13 +1814,13 @@ Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt, Constant *Idx) { - assert(isa<PackedType>(Val->getType()) && + assert(isa<VectorType>(Val->getType()) && "Tried to create insertelement operation on non-packed type!"); - assert(Elt->getType() == cast<PackedType>(Val->getType())->getElementType() + assert(Elt->getType() == cast<VectorType>(Val->getType())->getElementType() && "Insertelement types must match!"); assert(Idx->getType() == Type::Int32Ty && "Insertelement index must be i32 type!"); - return getInsertElementTy(cast<PackedType>(Val->getType())->getElementType(), + return getInsertElementTy(cast<VectorType>(Val->getType())->getElementType(), Val, Elt, Idx); } @@ -1844,11 +1844,11 @@ } Constant *ConstantExpr::getZeroValueForNegationExpr(const Type *Ty) { - if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) + if (const VectorType *PTy = dyn_cast<VectorType>(Ty)) if (PTy->getElementType()->isFloatingPoint()) { std::vector<Constant*> zeros(PTy->getNumElements(), ConstantFP::get(PTy->getElementType(),-0.0)); - return ConstantPacked::get(PTy, zeros); + return ConstantVector::get(PTy, zeros); } if (Ty->isFloatingPoint()) @@ -2000,7 +2000,7 @@ destroyConstant(); } -void ConstantPacked::replaceUsesOfWithOnConstant(Value *From, Value *To, +void ConstantVector::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); @@ -2012,7 +2012,7 @@ Values.push_back(Val); } - Constant *Replacement = ConstantPacked::get(getType(), Values); + Constant *Replacement = ConstantVector::get(getType(), Values); assert(Replacement != this && "I didn't contain From!"); // Everyone using this now uses the replacement. Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.75 llvm/lib/VMCore/Instructions.cpp:1.76 --- llvm/lib/VMCore/Instructions.cpp:1.75 Tue Feb 13 01:54:42 2007 +++ llvm/lib/VMCore/Instructions.cpp Wed Feb 14 20:26:10 2007 @@ -884,7 +884,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index, const std::string &Name, Instruction *InsertBef) - : Instruction(cast<PackedType>(Val->getType())->getElementType(), + : Instruction(cast<VectorType>(Val->getType())->getElementType(), ExtractElement, Ops, 2, Name, InsertBef) { assert(isValidOperands(Val, Index) && "Invalid extractelement instruction operands!"); @@ -895,7 +895,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV, const std::string &Name, Instruction *InsertBef) - : Instruction(cast<PackedType>(Val->getType())->getElementType(), + : Instruction(cast<VectorType>(Val->getType())->getElementType(), ExtractElement, Ops, 2, Name, InsertBef) { Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV); assert(isValidOperands(Val, Index) && @@ -908,7 +908,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index, const std::string &Name, BasicBlock *InsertAE) - : Instruction(cast<PackedType>(Val->getType())->getElementType(), + : Instruction(cast<VectorType>(Val->getType())->getElementType(), ExtractElement, Ops, 2, Name, InsertAE) { assert(isValidOperands(Val, Index) && "Invalid extractelement instruction operands!"); @@ -920,7 +920,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV, const std::string &Name, BasicBlock *InsertAE) - : Instruction(cast<PackedType>(Val->getType())->getElementType(), + : Instruction(cast<VectorType>(Val->getType())->getElementType(), ExtractElement, Ops, 2, Name, InsertAE) { Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV); assert(isValidOperands(Val, Index) && @@ -932,7 +932,7 @@ bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) { - if (!isa<PackedType>(Val->getType()) || Index->getType() != Type::Int32Ty) + if (!isa<VectorType>(Val->getType()) || Index->getType() != Type::Int32Ty) return false; return true; } @@ -999,10 +999,10 @@ bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt, const Value *Index) { - if (!isa<PackedType>(Vec->getType())) + if (!isa<VectorType>(Vec->getType())) return false; // First operand of insertelement must be packed type. - if (Elt->getType() != cast<PackedType>(Vec->getType())->getElementType()) + if (Elt->getType() != cast<VectorType>(Vec->getType())->getElementType()) return false;// Second operand of insertelement must be packed element type. if (Index->getType() != Type::Int32Ty) @@ -1047,12 +1047,12 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, const Value *Mask) { - if (!isa<PackedType>(V1->getType())) return false; + if (!isa<VectorType>(V1->getType())) return false; if (V1->getType() != V2->getType()) return false; - if (!isa<PackedType>(Mask->getType()) || - cast<PackedType>(Mask->getType())->getElementType() != Type::Int32Ty || - cast<PackedType>(Mask->getType())->getNumElements() != - cast<PackedType>(V1->getType())->getNumElements()) + if (!isa<VectorType>(Mask->getType()) || + cast<VectorType>(Mask->getType())->getElementType() != Type::Int32Ty || + cast<VectorType>(Mask->getType())->getNumElements() != + cast<VectorType>(V1->getType())->getNumElements()) return false; return true; } @@ -1075,37 +1075,37 @@ assert(getType() == LHS->getType() && "Arithmetic operation should return same type as operands!"); assert((getType()->isInteger() || getType()->isFloatingPoint() || - isa<PackedType>(getType())) && + isa<VectorType>(getType())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; case UDiv: case SDiv: assert(getType() == LHS->getType() && "Arithmetic operation should return same type as operands!"); - assert((getType()->isInteger() || (isa<PackedType>(getType()) && - cast<PackedType>(getType())->getElementType()->isInteger())) && + assert((getType()->isInteger() || (isa<VectorType>(getType()) && + cast<VectorType>(getType())->getElementType()->isInteger())) && "Incorrect operand type (not integer) for S/UDIV"); break; case FDiv: assert(getType() == LHS->getType() && "Arithmetic operation should return same type as operands!"); - assert((getType()->isFloatingPoint() || (isa<PackedType>(getType()) && - cast<PackedType>(getType())->getElementType()->isFloatingPoint())) + assert((getType()->isFloatingPoint() || (isa<VectorType>(getType()) && + cast<VectorType>(getType())->getElementType()->isFloatingPoint())) && "Incorrect operand type (not floating point) for FDIV"); break; case URem: case SRem: assert(getType() == LHS->getType() && "Arithmetic operation should return same type as operands!"); - assert((getType()->isInteger() || (isa<PackedType>(getType()) && - cast<PackedType>(getType())->getElementType()->isInteger())) && + assert((getType()->isInteger() || (isa<VectorType>(getType()) && + cast<VectorType>(getType())->getElementType()->isInteger())) && "Incorrect operand type (not integer) for S/UREM"); break; case FRem: assert(getType() == LHS->getType() && "Arithmetic operation should return same type as operands!"); - assert((getType()->isFloatingPoint() || (isa<PackedType>(getType()) && - cast<PackedType>(getType())->getElementType()->isFloatingPoint())) + assert((getType()->isFloatingPoint() || (isa<VectorType>(getType()) && + cast<VectorType>(getType())->getElementType()->isFloatingPoint())) && "Incorrect operand type (not floating point) for FREM"); break; case Shl: @@ -1121,8 +1121,8 @@ assert(getType() == LHS->getType() && "Logical operation should return same type as operands!"); assert((getType()->isInteger() || - (isa<PackedType>(getType()) && - cast<PackedType>(getType())->getElementType()->isInteger())) && + (isa<VectorType>(getType()) && + cast<VectorType>(getType())->getElementType()->isInteger())) && "Tried to create a logical operation on a non-integral type!"); break; default: @@ -1166,9 +1166,9 @@ BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name, Instruction *InsertBefore) { Constant *C; - if (const PackedType *PTy = dyn_cast<PackedType>(Op->getType())) { + if (const VectorType *PTy = dyn_cast<VectorType>(Op->getType())) { C = ConstantInt::getAllOnesValue(PTy->getElementType()); - C = ConstantPacked::get(std::vector<Constant*>(PTy->getNumElements(), C)); + C = ConstantVector::get(std::vector<Constant*>(PTy->getNumElements(), C)); } else { C = ConstantInt::getAllOnesValue(Op->getType()); } @@ -1180,11 +1180,11 @@ BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name, BasicBlock *InsertAtEnd) { Constant *AllOnes; - if (const PackedType *PTy = dyn_cast<PackedType>(Op->getType())) { + if (const VectorType *PTy = dyn_cast<VectorType>(Op->getType())) { // Create a vector of all ones values. Constant *Elt = ConstantInt::getAllOnesValue(PTy->getElementType()); AllOnes = - ConstantPacked::get(std::vector<Constant*>(PTy->getNumElements(), Elt)); + ConstantVector::get(std::vector<Constant*>(PTy->getNumElements(), Elt)); } else { AllOnes = ConstantInt::getAllOnesValue(Op->getType()); } @@ -1680,7 +1680,7 @@ return FPToSI; // FP -> sint else return FPToUI; // FP -> uint - } else if (const PackedType *PTy = dyn_cast<PackedType>(SrcTy)) { + } else if (const VectorType *PTy = dyn_cast<VectorType>(SrcTy)) { assert(DestBits == PTy->getBitWidth() && "Casting packed to integer of different width"); return BitCast; // Same size, no-op cast @@ -1703,15 +1703,15 @@ } else { return BitCast; // same size, no-op cast } - } else if (const PackedType *PTy = dyn_cast<PackedType>(SrcTy)) { + } else if (const VectorType *PTy = dyn_cast<VectorType>(SrcTy)) { assert(DestBits == PTy->getBitWidth() && "Casting packed to floating point of different width"); return BitCast; // same size, no-op cast } else { assert(0 && "Casting pointer or non-first class to float"); } - } else if (const PackedType *DestPTy = dyn_cast<PackedType>(DestTy)) { - if (const PackedType *SrcPTy = dyn_cast<PackedType>(SrcTy)) { + } else if (const VectorType *DestPTy = dyn_cast<VectorType>(DestTy)) { + if (const VectorType *SrcPTy = dyn_cast<VectorType>(SrcTy)) { assert(DestPTy->getBitWidth() == SrcPTy->getBitWidth() && "Casting packed to packed of different widths"); return BitCast; // packed -> packed Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.171 llvm/lib/VMCore/Type.cpp:1.172 --- llvm/lib/VMCore/Type.cpp:1.171 Sat Feb 10 16:02:45 2007 +++ llvm/lib/VMCore/Type.cpp Wed Feb 14 20:26:10 2007 @@ -93,9 +93,9 @@ /// bool Type::isFPOrFPVector() const { if (ID == Type::FloatTyID || ID == Type::DoubleTyID) return true; - if (ID != Type::PackedTyID) return false; + if (ID != Type::VectorTyID) return false; - return cast<PackedType>(this)->getElementType()->isFloatingPoint(); + return cast<VectorType>(this)->getElementType()->isFloatingPoint(); } // canLosslesllyBitCastTo - Return true if this type can be converted to @@ -112,8 +112,8 @@ // Packed -> Packed conversions are always lossless if the two packed types // have the same size, otherwise not. - if (const PackedType *thisPTy = dyn_cast<PackedType>(this)) - if (const PackedType *thatPTy = dyn_cast<PackedType>(Ty)) + if (const VectorType *thisPTy = dyn_cast<VectorType>(this)) + if (const VectorType *thatPTy = dyn_cast<VectorType>(Ty)) return thisPTy->getBitWidth() == thatPTy->getBitWidth(); // At this point we have only various mismatches of the first class types @@ -129,7 +129,7 @@ case Type::FloatTyID: return 32; case Type::DoubleTyID: return 64; case Type::IntegerTyID: return cast<IntegerType>(this)->getBitWidth(); - case Type::PackedTyID: return cast<PackedType>(this)->getBitWidth(); + case Type::VectorTyID: return cast<VectorType>(this)->getBitWidth(); default: return 0; } } @@ -144,7 +144,7 @@ if (const ArrayType *ATy = dyn_cast<ArrayType>(this)) return ATy->getElementType()->isSized(); - if (const PackedType *PTy = dyn_cast<PackedType>(this)) + if (const VectorType *PTy = dyn_cast<VectorType>(this)) return PTy->getElementType()->isSized(); if (!isa<StructType>(this)) @@ -287,8 +287,8 @@ Result += getTypeDescription(ATy->getElementType(), TypeStack) + "]"; break; } - case Type::PackedTyID: { - const PackedType *PTy = cast<PackedType>(Ty); + case Type::VectorTyID: { + const VectorType *PTy = cast<VectorType>(Ty); unsigned NumElements = PTy->getNumElements(); Result = "<"; Result += utostr(NumElements) + " x "; @@ -421,14 +421,14 @@ setAbstract(ElType->isAbstract()); } -PackedType::PackedType(const Type *ElType, unsigned NumEl) - : SequentialType(PackedTyID, ElType) { +VectorType::VectorType(const Type *ElType, unsigned NumEl) + : SequentialType(VectorTyID, ElType) { NumElements = NumEl; setAbstract(ElType->isAbstract()); - assert(NumEl > 0 && "NumEl of a PackedType must be greater than 0"); + assert(NumEl > 0 && "NumEl of a VectorType must be greater than 0"); assert((ElType->isInteger() || ElType->isFloatingPoint() || isa<OpaqueType>(ElType)) && - "Elements of a PackedType must be a primitive type"); + "Elements of a VectorType must be a primitive type"); } @@ -589,8 +589,8 @@ const ArrayType *ATy2 = cast<ArrayType>(Ty2); return ATy->getNumElements() == ATy2->getNumElements() && TypesEqual(ATy->getElementType(), ATy2->getElementType(), EqTypes); - } else if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) { - const PackedType *PTy2 = cast<PackedType>(Ty2); + } else if (const VectorType *PTy = dyn_cast<VectorType>(Ty)) { + const VectorType *PTy2 = cast<VectorType>(Ty2); return PTy->getNumElements() == PTy2->getNumElements() && TypesEqual(PTy->getElementType(), PTy2->getElementType(), EqTypes); } else if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) { @@ -695,8 +695,8 @@ case Type::ArrayTyID: HashVal ^= cast<ArrayType>(SubTy)->getNumElements(); break; - case Type::PackedTyID: - HashVal ^= cast<PackedType>(SubTy)->getNumElements(); + case Type::VectorTyID: + HashVal ^= cast<VectorType>(SubTy)->getNumElements(); break; case Type::StructTyID: HashVal ^= cast<StructType>(SubTy)->getNumElements(); @@ -1132,39 +1132,39 @@ // Packed Type Factory... // namespace llvm { -class PackedValType { +class VectorValType { const Type *ValTy; unsigned Size; public: - PackedValType(const Type *val, int sz) : ValTy(val), Size(sz) {} + VectorValType(const Type *val, int sz) : ValTy(val), Size(sz) {} - static PackedValType get(const PackedType *PT) { - return PackedValType(PT->getElementType(), PT->getNumElements()); + static VectorValType get(const VectorType *PT) { + return VectorValType(PT->getElementType(), PT->getNumElements()); } - static unsigned hashTypeStructure(const PackedType *PT) { + static unsigned hashTypeStructure(const VectorType *PT) { return PT->getNumElements(); } - inline bool operator<(const PackedValType &MTV) const { + inline bool operator<(const VectorValType &MTV) const { if (Size < MTV.Size) return true; return Size == MTV.Size && ValTy < MTV.ValTy; } }; } -static ManagedStatic<TypeMap<PackedValType, PackedType> > PackedTypes; +static ManagedStatic<TypeMap<VectorValType, VectorType> > VectorTypes; -PackedType *PackedType::get(const Type *ElementType, unsigned NumElements) { +VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) { assert(ElementType && "Can't get packed of null types!"); assert(isPowerOf2_32(NumElements) && "Vector length should be a power of 2!"); - PackedValType PVT(ElementType, NumElements); - PackedType *PT = PackedTypes->get(PVT); + VectorValType PVT(ElementType, NumElements); + VectorType *PT = VectorTypes->get(PVT); if (PT) return PT; // Found a match, return it! // Value not found. Derive a new type! - PackedTypes->add(PVT, PT = new PackedType(ElementType, NumElements)); + VectorTypes->add(PVT, PT = new VectorType(ElementType, NumElements)); #ifdef DEBUG_MERGE_TYPES DOUT << "Derived new type: " << *PT << "\n"; @@ -1429,13 +1429,13 @@ // concrete - this could potentially change us from an abstract type to a // concrete type. // -void PackedType::refineAbstractType(const DerivedType *OldType, +void VectorType::refineAbstractType(const DerivedType *OldType, const Type *NewType) { - PackedTypes->RefineAbstractType(this, OldType, NewType); + VectorTypes->RefineAbstractType(this, OldType, NewType); } -void PackedType::typeBecameConcrete(const DerivedType *AbsTy) { - PackedTypes->TypeBecameConcrete(this, AbsTy); +void VectorType::typeBecameConcrete(const DerivedType *AbsTy) { + VectorTypes->TypeBecameConcrete(this, AbsTy); } // refineAbstractType - Called when a contained type is found to be more Index: llvm/lib/VMCore/ValueTypes.cpp diff -u llvm/lib/VMCore/ValueTypes.cpp:1.13 llvm/lib/VMCore/ValueTypes.cpp:1.14 --- llvm/lib/VMCore/ValueTypes.cpp:1.13 Tue Feb 13 17:57:55 2007 +++ llvm/lib/VMCore/ValueTypes.cpp Wed Feb 14 20:26:10 2007 @@ -96,14 +96,14 @@ case MVT::i128: return IntegerType::get(128); case MVT::f32: return Type::FloatTy; case MVT::f64: return Type::DoubleTy; - case MVT::v8i8: return PackedType::get(Type::Int8Ty, 8); - case MVT::v4i16: return PackedType::get(Type::Int16Ty, 4); - case MVT::v2i32: return PackedType::get(Type::Int32Ty, 2); - case MVT::v16i8: return PackedType::get(Type::Int8Ty, 16); - case MVT::v8i16: return PackedType::get(Type::Int16Ty, 8); - case MVT::v4i32: return PackedType::get(Type::Int32Ty, 4); - case MVT::v2i64: return PackedType::get(Type::Int64Ty, 2); - case MVT::v4f32: return PackedType::get(Type::FloatTy, 4); - case MVT::v2f64: return PackedType::get(Type::DoubleTy, 2); + case MVT::v8i8: return VectorType::get(Type::Int8Ty, 8); + case MVT::v4i16: return VectorType::get(Type::Int16Ty, 4); + case MVT::v2i32: return VectorType::get(Type::Int32Ty, 2); + case MVT::v16i8: return VectorType::get(Type::Int8Ty, 16); + case MVT::v8i16: return VectorType::get(Type::Int16Ty, 8); + case MVT::v4i32: return VectorType::get(Type::Int32Ty, 4); + case MVT::v2i64: return VectorType::get(Type::Int64Ty, 2); + case MVT::v4f32: return VectorType::get(Type::FloatTy, 4); + case MVT::v2f64: return VectorType::get(Type::DoubleTy, 2); } } Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.195 llvm/lib/VMCore/Verifier.cpp:1.196 --- llvm/lib/VMCore/Verifier.cpp:1.195 Sun Feb 11 23:18:08 2007 +++ llvm/lib/VMCore/Verifier.cpp Wed Feb 14 20:26:10 2007 @@ -698,8 +698,8 @@ case Instruction::Or: case Instruction::Xor: Assert1(B.getType()->isInteger() || - (isa<PackedType>(B.getType()) && - cast<PackedType>(B.getType())->getElementType()->isInteger()), + (isa<VectorType>(B.getType()) && + cast<VectorType>(B.getType())->getElementType()->isInteger()), "Logical operators only work with integral types!", &B); Assert1(B.getType() == B.getOperand(0)->getType(), "Logical operators must have same type for operands and result!", @@ -719,7 +719,7 @@ "Arithmetic operators must have same type for operands and result!", &B); Assert1(B.getType()->isInteger() || B.getType()->isFloatingPoint() || - isa<PackedType>(B.getType()), + isa<VectorType>(B.getType()), "Arithmetic operators must have integer, fp, or packed type!", &B); break; } @@ -774,7 +774,7 @@ "Result of shufflevector must match first operand type!", &SV); // Check to see if Mask is valid. - if (const ConstantPacked *MV = dyn_cast<ConstantPacked>(SV.getOperand(2))) { + if (const ConstantVector *MV = dyn_cast<ConstantVector>(SV.getOperand(2))) { for (unsigned i = 0, e = MV->getNumOperands(); i != e; ++i) { Assert1(isa<ConstantInt>(MV->getOperand(i)) || isa<UndefValue>(MV->getOperand(i)), @@ -1014,9 +1014,9 @@ "incorrect integer width!" + bitmsg, F); break; } - } else if (TypeID == Type::PackedTyID) { + } else if (TypeID == Type::VectorTyID) { // If this is a packed argument, verify the number and type of elements. - const PackedType *PTy = cast<PackedType>(Ty); + const VectorType *PTy = cast<VectorType>(Ty); int ElemTy = va_arg(VA, int); if (ElemTy != PTy->getElementType()->getTypeID()) { CheckFailed("Intrinsic prototype has incorrect vector element type!", _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits