From: Chris Lattner Date: Mon, 19 Jul 2004 00:59:10 +0000 (+0000) Subject: classof implementations are now inlined X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ab4c19ec3eeaf90fcd56dde6c018a0da677f4a8b;p=oota-llvm.git classof implementations are now inlined git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14987 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index ff944877a78..6d59b61d996 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -269,14 +269,14 @@ ConstantStruct::ConstantStruct(const StructType *T, } ConstantExpr::ConstantExpr(unsigned Opcode, Constant *C, const Type *Ty) - : Constant(Ty), iType(Opcode) { + : Constant(Ty, ConstantExprVal), iType(Opcode) { Operands.reserve(1); Operands.push_back(Use(C, this)); } // Select instruction creation ctor ConstantExpr::ConstantExpr(Constant *C, Constant *V1, Constant *V2) - : Constant(V1->getType()), iType(Instruction::Select) { + : Constant(V1->getType(), ConstantExprVal), iType(Instruction::Select) { Operands.reserve(3); Operands.push_back(Use(C, this)); Operands.push_back(Use(V1, this)); @@ -291,7 +291,8 @@ static bool isSetCC(unsigned Opcode) { } ConstantExpr::ConstantExpr(unsigned Opcode, Constant *C1, Constant *C2) - : Constant(isSetCC(Opcode) ? Type::BoolTy : C1->getType()), iType(Opcode) { + : Constant(isSetCC(Opcode) ? Type::BoolTy : C1->getType(), ConstantExprVal), + iType(Opcode) { Operands.reserve(2); Operands.push_back(Use(C1, this)); Operands.push_back(Use(C2, this)); @@ -299,7 +300,7 @@ ConstantExpr::ConstantExpr(unsigned Opcode, Constant *C1, Constant *C2) ConstantExpr::ConstantExpr(Constant *C, const std::vector &IdxList, const Type *DestTy) - : Constant(DestTy), iType(Instruction::GetElementPtr) { + : Constant(DestTy, ConstantExprVal), iType(Instruction::GetElementPtr) { Operands.reserve(1+IdxList.size()); Operands.push_back(Use(C, this)); for (unsigned i = 0, E = IdxList.size(); i != E; ++i) @@ -382,44 +383,6 @@ Constant *ConstantExpr::getSShr(Constant *C1, Constant *C2) { } -//===----------------------------------------------------------------------===// -// classof implementations - -bool ConstantIntegral::classof(const Constant *CPV) { - return CPV->getType()->isIntegral() && !isa(CPV); -} - -bool ConstantInt::classof(const Constant *CPV) { - return CPV->getType()->isInteger() && !isa(CPV); -} -bool ConstantSInt::classof(const Constant *CPV) { - return CPV->getType()->isSigned() && !isa(CPV); -} -bool ConstantUInt::classof(const Constant *CPV) { - return CPV->getType()->isUnsigned() && !isa(CPV); -} -bool ConstantFP::classof(const Constant *CPV) { - const Type *Ty = CPV->getType(); - return ((Ty == Type::FloatTy || Ty == Type::DoubleTy) && - !isa(CPV)); -} -bool ConstantAggregateZero::classof(const Constant *CPV) { - return (isa(CPV->getType()) || isa(CPV->getType())) && - CPV->isNullValue(); -} -bool ConstantArray::classof(const Constant *CPV) { - return isa(CPV->getType()) && !CPV->isNullValue(); -} -bool ConstantStruct::classof(const Constant *CPV) { - return isa(CPV->getType()) && !CPV->isNullValue(); -} - -bool ConstantPointerNull::classof(const Constant *CPV) { - return !isa(CPV) && isa(CPV->getType()) && !isa(CPV) && - CPV->getNumOperands() == 0; -} - - //===----------------------------------------------------------------------===// // isValueValidForType implementations