From reid at x10sys.com Mon Dec 18 01:58:16 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 01:58:16 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp Message-ID: <200612180758.kBI7wGCl018067@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.24 -> 1.25 --- Log message: Remove a call to Type::isSigned(). --- Diffs of the changes: (+1 -3) CppWriter.cpp | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.24 llvm/tools/llvm2cpp/CppWriter.cpp:1.25 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.24 Mon Dec 11 19:31:37 2006 +++ llvm/tools/llvm2cpp/CppWriter.cpp Mon Dec 18 01:58:01 2006 @@ -680,9 +680,7 @@ << (CB->getValue() ? "true" : "false") << ");"; } else if (const ConstantInt *CI = dyn_cast(CV)) { Out << "ConstantInt* " << constName << " = ConstantInt::get(" - << typeName << ", " - << (CV->getType()->isSigned() ? CI->getSExtValue() : CI->getZExtValue()) - << ");"; + << typeName << ", " << CI->getZExtValue() << ");"; } else if (isa(CV)) { Out << "ConstantAggregateZero* " << constName << " = ConstantAggregateZero::get(" << typeName << ");"; From reid at x10sys.com Mon Dec 18 02:16:44 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 02:16:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp Message-ID: <200612180816.kBI8GiCu025177@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.115 -> 1.116 --- Log message: Convert the last use of two-argument ConstantExpr::getCast into another form so we can remove that method from ConstantExpr. --- Diffs of the changes: (+3 -1) ExprTypeConvert.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.115 llvm/lib/Transforms/ExprTypeConvert.cpp:1.116 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.115 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Mon Dec 18 02:16:27 2006 @@ -210,7 +210,9 @@ Constant *CPV = cast(V); // Constants are converted by constant folding the cast that is required. // We assume here that all casts are implemented for constant prop. - Value *Result = ConstantExpr::getCast(CPV, Ty); + Instruction::CastOps opcode = CastInst::getCastOpcode(CPV, + CPV->getType()->isSigned(), Ty, Ty->isSigned()); + Value *Result = ConstantExpr::getCast(opcode, CPV, Ty); // Add the instruction to the expression map //VMC.ExprMap[V] = Result; return Result; From reid at x10sys.com Mon Dec 18 02:19:05 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 02:19:05 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200612180819.kBI8J5Cu026899@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.108 -> 1.109 --- Log message: Remove the two-argument (inferred cast) form of ConstantExpr::getCast now that its last uses have been removed. --- Diffs of the changes: (+0 -2) Constants.h | 2 -- 1 files changed, 2 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.108 llvm/include/llvm/Constants.h:1.109 --- llvm/include/llvm/Constants.h:1.108 Sun Dec 17 00:07:30 2006 +++ llvm/include/llvm/Constants.h Mon Dec 18 02:18:46 2006 @@ -572,8 +572,6 @@ const Type *Ty ///< The integer type to cast to ); - static Constant *getCast(Constant *C, const Type *Ty); - /// @brief Return true if this is a convert constant expression bool isCast() const; From reid at x10sys.com Mon Dec 18 02:19:05 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 02:19:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200612180819.kBI8J5Ws026893@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.188 -> 1.189 --- Log message: Remove the two-argument (inferred cast) form of ConstantExpr::getCast now that its last uses have been removed. --- Diffs of the changes: (+0 -7) Constants.cpp | 7 ------- 1 files changed, 7 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.188 llvm/lib/VMCore/Constants.cpp:1.189 --- llvm/lib/VMCore/Constants.cpp:1.188 Fri Dec 15 15:47:01 2006 +++ llvm/lib/VMCore/Constants.cpp Mon Dec 18 02:18:46 2006 @@ -1480,13 +1480,6 @@ return 0; } -Constant *ConstantExpr::getCast(Constant *C, const Type *Ty) { - // Note: we can't inline this because it requires the Instructions.h header - return getCast(CastInst::getCastOpcode( - C, C->getType()->isSigned(), Ty, Ty->isSigned()), C, Ty); -} - - Constant *ConstantExpr::getZExtOrBitCast(Constant *C, const Type *Ty) { if (C->getType()->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits()) return getCast(Instruction::BitCast, C, Ty); From reid at x10sys.com Mon Dec 18 02:47:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 02:47:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp Message-ID: <200612180847.kBI8laEf027410@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.51 -> 1.52 --- Log message: Convert the last uses of CastInst::createInferredCast to a normal cast creation. These changes are still temporary but at least this pushes knowledge of signedness out closer to where it can be determined properly and allows signedness to be removed from VMCore. --- Diffs of the changes: (+13 -5) IntrinsicLowering.cpp | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.51 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.52 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.51 Mon Dec 11 23:19:46 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Dec 18 02:47:13 2006 @@ -66,9 +66,13 @@ if (castOpcodes[ArgNo]) Arg = CastInst::create(Instruction::CastOps(castOpcodes[ArgNo]), Arg, FT->getParamType(ArgNo), Arg->getName(), CI); - else - Arg = CastInst::createInferredCast(Arg, FT->getParamType(ArgNo), - Arg->getName(), CI); + else { + Instruction::CastOps opcode = CastInst::getCastOpcode(Arg, + Arg->getType()->isSigned(), FT->getParamType(ArgNo), + FT->getParamType(ArgNo)->isSigned()); + Arg = CastInst::create(opcode, Arg, FT->getParamType(ArgNo), + Arg->getName(), CI); + } Operands.push_back(Arg); } // Pass nulls into any additional arguments... @@ -80,8 +84,12 @@ CallInst *NewCI = new CallInst(FCache, Operands, Name, CI); if (!CI->use_empty()) { Value *V = NewCI; - if (CI->getType() != NewCI->getType()) - V = CastInst::createInferredCast(NewCI, CI->getType(), Name, CI); + if (CI->getType() != NewCI->getType()) { + Instruction::CastOps opcode = CastInst::getCastOpcode(NewCI, + NewCI->getType()->isSigned(), CI->getType(), + CI->getType()->isSigned()); + V = CastInst::create(opcode, NewCI, CI->getType(), Name, CI); + } CI->replaceAllUsesWith(V); } return NewCI; From reid at x10sys.com Mon Dec 18 02:47:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 02:47:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp Message-ID: <200612180847.kBI8laJH027411@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: ProfilingUtils.cpp updated: 1.10 -> 1.11 --- Log message: Convert the last uses of CastInst::createInferredCast to a normal cast creation. These changes are still temporary but at least this pushes knowledge of signedness out closer to where it can be determined properly and allows signedness to be removed from VMCore. --- Diffs of the changes: (+13 -4) ProfilingUtils.cpp | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.10 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.11 --- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.10 Tue Dec 12 18:50:17 2006 +++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp Mon Dec 18 02:47:13 2006 @@ -62,8 +62,10 @@ case 2: AI = MainFn->arg_begin(); ++AI; if (AI->getType() != ArgVTy) { + Instruction::CastOps opcode = CastInst::getCastOpcode(AI, + AI->getType()->isSigned(), ArgVTy, ArgVTy->isSigned()); InitCall->setOperand(2, - CastInst::createInferredCast(AI, ArgVTy, "argv.cast", InitCall)); + CastInst::create(opcode, AI, ArgVTy, "argv.cast", InitCall)); } else { InitCall->setOperand(2, AI); } @@ -74,11 +76,18 @@ // If the program looked at argc, have it look at the return value of the // init call instead. if (AI->getType() != Type::IntTy) { - if (!AI->use_empty()) + Instruction::CastOps opcode; + if (!AI->use_empty()) { + opcode = CastInst::getCastOpcode(InitCall, + InitCall->getType()->isSigned(), AI->getType(), + AI->getType()->isSigned()); AI->replaceAllUsesWith( - CastInst::createInferredCast(InitCall, AI->getType(), "", InsertPos)); + CastInst::create(opcode, InitCall, AI->getType(), "", InsertPos)); + } + opcode = CastInst::getCastOpcode(AI, AI->getType()->isSigned(), + Type::IntTy, true); InitCall->setOperand(1, - CastInst::createInferredCast(AI, Type::IntTy, "argc.cast", InitCall)); + CastInst::create(opcode, AI, Type::IntTy, "argc.cast", InitCall)); } else { AI->replaceAllUsesWith(InitCall); InitCall->setOperand(1, AI); From reid at x10sys.com Mon Dec 18 02:47:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 02:47:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612180847.kBI8la1B027409@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.570 -> 1.571 --- Log message: Convert the last uses of CastInst::createInferredCast to a normal cast creation. These changes are still temporary but at least this pushes knowledge of signedness out closer to where it can be determined properly and allows signedness to be removed from VMCore. --- Diffs of the changes: (+10 -3) InstructionCombining.cpp | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.570 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.571 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.570 Wed Dec 13 12:21:21 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Dec 18 02:47:13 2006 @@ -7009,7 +7009,9 @@ if ((*AI)->getType() == ParamTy) { Args.push_back(*AI); } else { - CastInst *NewCast = CastInst::createInferredCast(*AI, ParamTy, "tmp"); + Instruction::CastOps opcode = CastInst::getCastOpcode(*AI, + (*AI)->getType()->isSigned(), ParamTy, ParamTy->isSigned()); + CastInst *NewCast = CastInst::create(opcode, *AI, ParamTy, "tmp"); Args.push_back(InsertNewInstBefore(NewCast, *Caller)); } } @@ -7030,7 +7032,9 @@ const Type *PTy = getPromotedType((*AI)->getType()); if (PTy != (*AI)->getType()) { // Must promote to pass through va_arg area! - Instruction *Cast = CastInst::createInferredCast(*AI, PTy, "tmp"); + Instruction::CastOps opcode = CastInst::getCastOpcode( + *AI, (*AI)->getType()->isSigned(), PTy, PTy->isSigned()); + Instruction *Cast = CastInst::create(opcode, *AI, PTy, "tmp"); InsertNewInstBefore(Cast, *Caller); Args.push_back(Cast); } else { @@ -7058,7 +7062,10 @@ Value *NV = NC; if (Caller->getType() != NV->getType() && !Caller->use_empty()) { if (NV->getType() != Type::VoidTy) { - NV = NC = CastInst::createInferredCast(NC, Caller->getType(), "tmp"); + const Type *CallerTy = Caller->getType(); + Instruction::CastOps opcode = CastInst::getCastOpcode( + NC, NC->getType()->isSigned(), CallerTy, CallerTy->isSigned()); + NV = NC = CastInst::create(opcode, NC, CallerTy, "tmp"); // If this is an invoke instruction, we should insert it after the first // non-phi, instruction in the normal successor block. From reid at x10sys.com Mon Dec 18 02:47:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 02:47:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp Message-ID: <200612180847.kBI8labM027413@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.116 -> 1.117 --- Log message: Convert the last uses of CastInst::createInferredCast to a normal cast creation. These changes are still temporary but at least this pushes knowledge of signedness out closer to where it can be determined properly and allows signedness to be removed from VMCore. --- Diffs of the changes: (+10 -4) ExprTypeConvert.cpp | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.116 llvm/lib/Transforms/ExprTypeConvert.cpp:1.117 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.116 Mon Dec 18 02:16:27 2006 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Mon Dec 18 02:47:13 2006 @@ -228,11 +228,14 @@ Constant *Dummy = Constant::getNullValue(Ty); switch (I->getOpcode()) { - case Instruction::BitCast: + case Instruction::BitCast: { assert(VMC.NewCasts.count(ValueHandle(VMC, I)) == 0); - Res = CastInst::createInferredCast(I->getOperand(0), Ty, Name); + Instruction::CastOps opcode = CastInst::getCastOpcode(I->getOperand(0), + I->getOperand(0)->getType()->isSigned(), Ty, Ty->isSigned()); + Res = CastInst::create(opcode, I->getOperand(0), Ty, Name); VMC.NewCasts.insert(ValueHandle(VMC, Res)); break; + } case Instruction::Add: case Instruction::Sub: @@ -706,9 +709,12 @@ Constant::getNullValue(NewTy) : 0; switch (I->getOpcode()) { - case Instruction::BitCast: - Res = CastInst::createInferredCast(NewVal, I->getType(), Name); + case Instruction::BitCast: { + Instruction::CastOps opcode = CastInst::getCastOpcode(NewVal, + NewVal->getType()->isSigned(), I->getType(), I->getType()->isSigned()); + Res = CastInst::create(opcode, NewVal, I->getType(), Name); break; + } case Instruction::Add: case Instruction::Sub: From reid at x10sys.com Mon Dec 18 02:53:16 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 02:53:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp Message-ID: <200612180853.kBI8rGfA027523@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Instructions.cpp updated: 1.55 -> 1.56 --- Log message: Remove the createInferredCast methods now that their last uses have been removed. All casting is now explicit and not inferred by VMCore. --- Diffs of the changes: (+0 -14) Instructions.cpp | 14 -------------- 1 files changed, 14 deletions(-) Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.55 llvm/lib/VMCore/Instructions.cpp:1.56 --- llvm/lib/VMCore/Instructions.cpp:1.55 Mon Dec 11 18:49:44 2006 +++ llvm/lib/VMCore/Instructions.cpp Mon Dec 18 02:52:59 2006 @@ -1782,20 +1782,6 @@ } } -CastInst *CastInst::createInferredCast( - Value *S, const Type *Ty, const std::string &Name, Instruction *InsertBefore) -{ - return createInferredCast(S, S->getType()->isSigned(), Ty, Ty->isSigned(), - Name, InsertBefore); -} - -CastInst *CastInst::createInferredCast( - Value *S, const Type *Ty, const std::string &Name, BasicBlock *InsertAtEnd) -{ - return createInferredCast(S, S->getType()->isSigned(), Ty, Ty->isSigned(), - Name, InsertAtEnd); -} - TruncInst::TruncInst( Value *S, const Type *Ty, const std::string &Name, Instruction *InsertBefore ) : CastInst(Ty, Trunc, S, Name, InsertBefore) { From reid at x10sys.com Mon Dec 18 02:53:15 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 02:53:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/InstrTypes.h Message-ID: <200612180853.kBI8rFCs027518@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: InstrTypes.h updated: 1.54 -> 1.55 --- Log message: Remove the createInferredCast methods now that their last uses have been removed. All casting is now explicit and not inferred by VMCore. --- Diffs of the changes: (+2 -55) InstrTypes.h | 57 ++------------------------------------------------------- 1 files changed, 2 insertions(+), 55 deletions(-) Index: llvm/include/llvm/InstrTypes.h diff -u llvm/include/llvm/InstrTypes.h:1.54 llvm/include/llvm/InstrTypes.h:1.55 --- llvm/include/llvm/InstrTypes.h:1.54 Mon Dec 11 18:49:44 2006 +++ llvm/include/llvm/InstrTypes.h Mon Dec 18 02:52:59 2006 @@ -398,7 +398,8 @@ ); /// Returns the opcode necessary to cast Val into Ty using usual casting - /// rules. + /// rules. + /// @brief Infer the opcode for cast operand and type static Instruction::CastOps getCastOpcode( const Value *Val, ///< The value to cast bool SrcIsSigned, ///< Whether to treat the source as signed @@ -406,60 +407,6 @@ bool DstIsSigned ///< Whether to treate the dest. as signed ); - /// Joins the create method (with insert-before-instruction semantics) above - /// with the getCastOpcode method. getOpcode(S,Ty) is called first to - /// obtain the opcode for casting S to type Ty. Then the get(...) method is - /// called to create the CastInst and insert it. The instruction is - /// inserted before InsertBefore (if it is non-null). The cast created is - /// inferred, because only the types involved are used in determining which - /// cast opcode to use. For specific casts, use one of the create methods. - /// @brief Inline helper method to join create with getCastOpcode. - inline static CastInst *createInferredCast( - Value *S, ///< The value to be casted (operand 0) - bool SrcIsSigned, ///< Whether to treat the source as signed - const Type *Ty, ///< Type to which operand should be casted - bool DstIsSigned, ///< Whether to treate the dest. as signed - const std::string &Name = "", ///< Name for the instruction - Instruction *InsertBefore = 0 ///< Place to insert the CastInst - ) { - return create(getCastOpcode(S, SrcIsSigned, Ty, DstIsSigned), - S, Ty, Name, InsertBefore); - } - static CastInst *createInferredCast( - Value *S, ///< The value to be casted (operand 0) - const Type *Ty, ///< Type to which operand should be casted - const std::string &Name = "", ///< Name for the instruction - Instruction *InsertBefore = 0 ///< Place to insert the CastInst - ); - - /// Joins the get method (with insert-at-end-of-block semantics) method - /// above with the getCastOpcode method. getOpcode(S,Ty) is called first to - /// obtain the usual casting opcode for casting S to type Ty. Then the - /// get(...) method is called to create the CastInst and insert it. The - /// instruction is inserted at the end of InsertAtEnd (if it is non-null). - /// The created cast is inferred, because only the types involved are used - /// in determining which cast opcode to use. For specific casts, use one of - /// the create methods. - /// @brief Inline helper method to join create with getCastOpcode. - inline static CastInst *createInferredCast( - Value *S, ///< The value to be casted (operand 0) - bool SrcIsSigned, ///< Whether to treat the source as signed - const Type *Ty, ///< Type to which operand should be casted - bool DstIsSigned, ///< Whether to treate the dest. as signed - const std::string &Name, ///< Name for the instruction - BasicBlock *InsertAtEnd ///< The block to insert the instruction into - ) { - return create(getCastOpcode(S, SrcIsSigned, Ty, DstIsSigned), - S, Ty, Name, InsertAtEnd); - } - - static CastInst *createInferredCast( - Value *S, ///< The value to be casted (operand 0) - const Type *Ty, ///< Type to which operand should be casted - const std::string &Name, ///< Name for the instruction - BasicBlock *InsertAtEnd ///< The block to insert the instruction into - ); - /// There are several places where we need to know if a cast instruction /// only deals with integer source and destination types. To simplify that /// logic, this method is provided. From rafael.espindola at gmail.com Mon Dec 18 05:07:24 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 18 Dec 2006 05:07:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMRegisterInfo.cpp Message-ID: <200612181107.kBIB7OEc001154@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMRegisterInfo.cpp updated: 1.29 -> 1.30 --- Log message: macros -> Inline functions Lauros's patch --- Diffs of the changes: (+13 -9) ARMRegisterInfo.cpp | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.29 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.30 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.29 Thu Dec 14 07:31:27 2006 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Mon Dec 18 05:07:09 2006 @@ -35,9 +35,13 @@ return NoFramePointerElim || MFI->hasVarSizedObjects(); } -#define ROTATE32L(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) +static inline unsigned rotateL(unsigned x, unsigned n){ + return ((x << n) | (x >> (32 - n))); +} -#define ROTATE32R(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) +static inline unsigned rotateR(unsigned x, unsigned n){ + return ((x >> n) | (x << (32 - n))); +} // finds the end position of largest sequence of zeros in binary representation // of 'immediate'. @@ -50,19 +54,19 @@ int end_pos; while ((immediate & 0x3) == 0) { - immediate = ROTATE32R(immediate, 2); + immediate = rotateR(immediate, 2); pos+=2; } end_pos = pos+32; while (pos References: <200612180819.kBI8J5Cu026899@zion.cs.uiuc.edu> Message-ID: <5D453F3E-D68F-419C-B5FF-D33DEA5A2C3A@apple.com> Did I miss a patch for llvm-gcc? Cheers, -- Jim On 18-Dec-06, at 4:19 AM, Reid Spencer wrote: > > > Changes in directory llvm/include/llvm: > > Constants.h updated: 1.108 -> 1.109 > --- > Log message: > > Remove the two-argument (inferred cast) form of > ConstantExpr::getCast now > that its last uses have been removed. > > > --- > Diffs of the changes: (+0 -2) > > Constants.h | 2 -- > 1 files changed, 2 deletions(-) > > > Index: llvm/include/llvm/Constants.h > diff -u llvm/include/llvm/Constants.h:1.108 llvm/include/llvm/ > Constants.h:1.109 > --- llvm/include/llvm/Constants.h:1.108 Sun Dec 17 00:07:30 2006 > +++ llvm/include/llvm/Constants.h Mon Dec 18 02:18:46 2006 > @@ -572,8 +572,6 @@ > const Type *Ty ///< The integer type to cast to > ); > > - static Constant *getCast(Constant *C, const Type *Ty); > - > /// @brief Return true if this is a convert constant expression > bool isCast() const; > > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/10f25767/attachment.bin From clattner at apple.com Mon Dec 18 10:56:30 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Dec 2006 08:56:30 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp In-Reply-To: <200612180816.kBI8GiCu025177@zion.cs.uiuc.edu> References: <200612180816.kBI8GiCu025177@zion.cs.uiuc.edu> Message-ID: <787F658E-02D3-4057-9923-698FA7C21F08@apple.com> On Dec 18, 2006, at 12:16 AM, Reid Spencer wrote: > > Convert the last use of two-argument ConstantExpr::getCast into > another > form so we can remove that method from ConstantExpr. > --- > Diffs of the changes: (+3 -1) > > ExprTypeConvert.cpp | 4 +++- > 1 files changed, 3 insertions(+), 1 deletion(-) > > > Index: llvm/lib/Transforms/ExprTypeConvert.cpp > diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.115 llvm/lib/ > Transforms/ExprTypeConvert.cpp:1.116 > --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.115 Wed Dec 6 > 19:30:31 2006 > +++ llvm/lib/Transforms/ExprTypeConvert.cpp Mon Dec 18 02:16:27 2006 > @@ -210,7 +210,9 @@ > Constant *CPV = cast(V); > // Constants are converted by constant folding the cast that > is required. > // We assume here that all casts are implemented for constant > prop. > - Value *Result = ConstantExpr::getCast(CPV, Ty); > + Instruction::CastOps opcode = CastInst::getCastOpcode(CPV, > + CPV->getType()->isSigned(), Ty, Ty->isSigned()); > + Value *Result = ConstantExpr::getCast(opcode, CPV, Ty); > // Add the instruction to the expression map > //VMC.ExprMap[V] = Result; > return Result; How is this safe? Do you know that signedness can be trusted here? -Chris From clattner at apple.com Mon Dec 18 10:57:18 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Dec 2006 08:57:18 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp In-Reply-To: <200612180847.kBI8laEf027410@zion.cs.uiuc.edu> References: <200612180847.kBI8laEf027410@zion.cs.uiuc.edu> Message-ID: > > Convert the last uses of CastInst::createInferredCast to a normal cast > creation. These changes are still temporary but at least this pushes > knowledge of signedness out closer to where it can be determined > properly > and allows signedness to be removed from VMCore. Ah, ok, I get it now :) -Chris From rspencer at reidspencer.com Mon Dec 18 11:27:31 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Mon, 18 Dec 2006 09:27:31 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp In-Reply-To: <787F658E-02D3-4057-9923-698FA7C21F08@apple.com> References: <200612180816.kBI8GiCu025177@zion.cs.uiuc.edu> <787F658E-02D3-4057-9923-698FA7C21F08@apple.com> Message-ID: <1166462851.2850.1.camel@bashful.x10sys.com> On Mon, 2006-12-18 at 08:56 -0800, Chris Lattner wrote: > On Dec 18, 2006, at 12:16 AM, Reid Spencer wrote: > > > > > Convert the last use of two-argument ConstantExpr::getCast into > > another > > form so we can remove that method from ConstantExpr. > > --- > > Diffs of the changes: (+3 -1) > > > > ExprTypeConvert.cpp | 4 +++- > > 1 files changed, 3 insertions(+), 1 deletion(-) > > > > > > Index: llvm/lib/Transforms/ExprTypeConvert.cpp > > diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.115 llvm/lib/ > > Transforms/ExprTypeConvert.cpp:1.116 > > --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.115 Wed Dec 6 > > 19:30:31 2006 > > +++ llvm/lib/Transforms/ExprTypeConvert.cpp Mon Dec 18 02:16:27 2006 > > @@ -210,7 +210,9 @@ > > Constant *CPV = cast(V); > > // Constants are converted by constant folding the cast that > > is required. > > // We assume here that all casts are implemented for constant > > prop. > > - Value *Result = ConstantExpr::getCast(CPV, Ty); > > + Instruction::CastOps opcode = CastInst::getCastOpcode(CPV, > > + CPV->getType()->isSigned(), Ty, Ty->isSigned()); > > + Value *Result = ConstantExpr::getCast(opcode, CPV, Ty); > > // Add the instruction to the expression map > > //VMC.ExprMap[V] = Result; > > return Result; > > How is this safe? Do you know that signedness can be trusted here? I know it is safe because all I have done is replaced getCast call with its contents. There can't be any functional change as this is what it was doing before. What's different is that we've moved the calls to isSigned() out to this file instead of burying them into VMCore. I'll revisit this when it is time to remove isSigned(). > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Dec 18 12:09:37 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Dec 2006 10:09:37 -0800 Subject: [llvm-commits] better ada support for llvm-gcc Message-ID: <60D3C555-A097-4266-8F39-8D337490A128@apple.com> I applied this untested patch, it may improve ADA support, it certainly can't hurt: Index: llvm-convert.cpp =================================================================== --- llvm-convert.cpp (revision 121371) +++ llvm-convert.cpp (working copy) @@ -511,6 +511,7 @@ case RESULT_DECL: case INDIRECT_REF: case ARRAY_REF: + case ARRAY_RANGE_REF: case COMPONENT_REF: case BIT_FIELD_REF: case STRING_CST: @@ -639,6 +640,7 @@ case RESULT_DECL: return EmitLV_DECL(exp); case STRING_CST: return LValue (TreeConstantToLLVM::EmitLV_STRING_CST(exp)); case INDIRECT_REF: return EmitLV_INDIRECT_REF(exp); + case ARRAY_RANGE_REF: case ARRAY_REF: return EmitLV_ARRAY_REF(exp); case COMPONENT_REF: return EmitLV_COMPONENT_REF(exp); case BIT_FIELD_REF: return EmitLV_BIT_FIELD_REF(exp); @@ -4742,6 +4744,7 @@ case LABEL_DECL: return EmitLV_LABEL_DECL(exp); case STRING_CST: return EmitLV_STRING_CST(exp); case COMPONENT_REF: return EmitLV_COMPONENT_REF(exp); + case ARRAY_RANGE_REF: case ARRAY_REF: return EmitLV_ARRAY_REF(exp); } } -Chris From rspencer at reidspencer.com Mon Dec 18 13:25:22 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Mon, 18 Dec 2006 11:25:22 -0800 Subject: [llvm-commits] [llvm-gcc] Cast Fix Message-ID: <1166469922.2850.7.camel@bashful.x10sys.com> All, This patch is needed to update llvm-gcc to avoid inferred casts as LLVM no longer supports them. This patch is sufficient for getting llvm-gcc to compile/work for an X86 target. This cast does not include needed changes to gcc/config/rs6000/rs6000.h Those changes will be sent in a subsequent patch. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: CastFix.patch Type: text/x-patch Size: 36667 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/259d7e63/attachment.bin From rspencer at reidspencer.com Mon Dec 18 13:37:01 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Mon, 18 Dec 2006 11:37:01 -0800 Subject: [llvm-commits] [llvm-gcc] CastFix For PPC (untested) Message-ID: <1166470621.2850.11.camel@bashful.x10sys.com> Jim, Attached is the casting fix for gcc/config/rs6000/rs6000.h. As I don't have a Mac here, I can't even compile this. Could you please compile and test it, and submit a new version of the patch back to llvm-commits if there are any necessary adjustments? Thanks, Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: CastFix-PPC.patch Type: text/x-patch Size: 8895 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/af8a4feb/attachment.bin From jlaskey at apple.com Mon Dec 18 14:24:07 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 18 Dec 2006 16:24:07 -0400 Subject: [llvm-commits] [llvm-commit][llvm-gcc]Patches from Scott Michel to build on older system Message-ID: Index: gcc/config/darwin.h =================================================================== --- gcc/config/darwin.h (revision 121525) +++ gcc/config/darwin.h (working copy) @@ -433,8 +433,8 @@ %{Zinit*:-init %*} \ "/* APPLE LOCAL mainline 2005-09-01 3449986 */"\ %{mmacosx-version-min=*:-macosx_version_min %*} \ -"/* APPLE LOCAL mainline 2006-03-15 3992198 */"\ - %{!mmacosx-version-min=*:%{shared-libgcc:-macosx_version_min 10.3}} \ +"/* APPLE LOCAL mainline 2006-03-15 3992198 *//* "\ + %{!mmacosx-version-min=*:%{shared-libgcc:-macosx_version_min 10.3}} \ */"\ %{nomultidefs} \ %{Zmulti_module:-multi_module} %{Zsingle_module:-single_module} \ %{Zmultiply_defined*:-multiply_defined %*} \ Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 121525) +++ gcc/configure.ac (working copy) @@ -1323,6 +1323,7 @@ AC_CACHE_CHECK([whether mcontext_t fields have underscores], gcc_cv_mcontext_underscores, AC_COMPILE_IFELSE([ +#include #include int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; } ], -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/8115c0d1/attachment.bin From jlaskey at apple.com Mon Dec 18 14:39:48 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 18 Dec 2006 16:39:48 -0400 Subject: [llvm-commits] [llvm-commit][llvm-gcc]Merge of Reid's changes for cast changes. Message-ID: <91CD01E6-7D0F-4DDB-A0B2-335D6D69523A@apple.com> A non-text attachment was scrubbed... Name: Combined.patch Type: application/octet-stream Size: 50017 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/bbe0e70f/attachment.obj -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/bbe0e70f/attachment.bin From reid at x10sys.com Mon Dec 18 15:56:44 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 15:56:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200612182156.kBILui54012388@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.174 -> 1.175 --- Log message: For PR1042: http://llvm.org/PR1042 : Fix a thinko. We want to check the second case if the first cast *didn't* trigger. --- Diffs of the changes: (+1 -1) Verifier.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.174 llvm/lib/VMCore/Verifier.cpp:1.175 --- llvm/lib/VMCore/Verifier.cpp:1.174 Fri Dec 15 20:25:35 2006 +++ llvm/lib/VMCore/Verifier.cpp Mon Dec 18 15:56:29 2006 @@ -921,7 +921,7 @@ // If it is used by something non-phi, then the other case is that // 'OpBlock' dominates all of its predecessors other than the // invoke. In this case, the invoke value can still be used. - if (Bad) { + if (!Bad) { Bad = false; for (pred_iterator PI = pred_begin(OpBlock), E = pred_end(OpBlock); PI != E; ++PI) { From isanbard at gmail.com Mon Dec 18 15:59:15 2006 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 18 Dec 2006 15:59:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/BitSetVector.h Message-ID: <200612182159.kBILxFkY012486@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: BitSetVector.h updated: 1.19 -> 1.20 --- Log message: Removed llvm_ostream and used std::ostream instead. --- Diffs of the changes: (+1 -1) BitSetVector.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/ADT/BitSetVector.h diff -u llvm/include/llvm/ADT/BitSetVector.h:1.19 llvm/include/llvm/ADT/BitSetVector.h:1.20 --- llvm/include/llvm/ADT/BitSetVector.h:1.19 Sat Dec 16 23:15:12 2006 +++ llvm/include/llvm/ADT/BitSetVector.h Mon Dec 18 15:59:00 2006 @@ -244,7 +244,7 @@ }; -inline void BitSetVector::print(llvm_ostream& O) const +inline void BitSetVector::print(std::ostream& O) const { for (std::vector::const_iterator I=bitsetVec.begin(), E=bitsetVec.end(); I != E; ++I) From isanbard at gmail.com Mon Dec 18 16:14:51 2006 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 18 Dec 2006 14:14:51 -0800 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp In-Reply-To: <200612182156.kBILui54012388@zion.cs.uiuc.edu> References: <200612182156.kBILui54012388@zion.cs.uiuc.edu> Message-ID: <16e5fdf90612181414g7212c708ra280bbb54b6a4c5f@mail.gmail.com> On 12/18/06, Reid Spencer wrote: > > - if (Bad) { > + if (!Bad) { > Bad = false; Isn't the above statement not needed then? -bw > for (pred_iterator PI = pred_begin(OpBlock), > E = pred_end(OpBlock); PI != E; ++PI) { > From clattner at apple.com Mon Dec 18 16:50:51 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Dec 2006 14:50:51 -0800 Subject: [llvm-commits] [llvm-gcc] Cast Fix In-Reply-To: <1166469922.2850.7.camel@bashful.x10sys.com> References: <1166469922.2850.7.camel@bashful.x10sys.com> Message-ID: On Dec 18, 2006, at 11:25 AM, Reid Spencer wrote: > All, > > This patch is needed to update llvm-gcc to avoid inferred casts as > LLVM > no longer supports them. This patch is sufficient for getting llvm- > gcc > to compile/work for an X86 target. > > This cast does not include needed changes to gcc/config/rs6000/ > rs6000.h > Those changes will be sent in a subsequent patch. Jim already applied this (thx Jim!), so this is just an FYI: You're basing all of the checks here on whether or not the LLVM types are signed. I understand that this is the most expedient way to get stuff working in the short term, but this isn't going to work long term, as the ->isSigned() methods are not going to exist any more. You should eventually migrate these to using TREE_UNSIGNED and similar macros, checking properties from the GCC trees. Further, the casts in i386.h that call getCastOpcode, should be updated to use the appropriate cast. However, I'm not sure what they are, you can work with Evan to figure them out. -Chris From evan.cheng at apple.com Mon Dec 18 16:55:49 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 18 Dec 2006 16:55:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612182255.kBIMtnJ6013329@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.447 -> 1.448 --- Log message: LegalizeSetCCOperands() may end up inserting libcalls. They need to be properly serialized. Do not clear LastCallSEQ_END until that is done. --- Diffs of the changes: (+2 -3) LegalizeDAG.cpp | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.447 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.448 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.447 Fri Dec 15 20:20:50 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 18 16:55:34 2006 @@ -1360,14 +1360,13 @@ // Ensure that libcalls are emitted before a branch. Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END); Tmp1 = LegalizeOp(Tmp1); - LastCALLSEQ_END = DAG.getEntryNode(); - Tmp2 = Node->getOperand(2); // LHS Tmp3 = Node->getOperand(3); // RHS Tmp4 = Node->getOperand(1); // CC LegalizeSetCCOperands(Tmp2, Tmp3, Tmp4); - + LastCALLSEQ_END = DAG.getEntryNode(); + // If we didn't get both a LHS and RHS back from LegalizeSetCCOperands, // the LHS is a legal SETCC itself. In this case, we need to compare // the result against zero to select between true and false values. From rspencer at reidspencer.com Mon Dec 18 17:37:44 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Mon, 18 Dec 2006 15:37:44 -0800 Subject: [llvm-commits] [llvm-gcc] Cast Fix In-Reply-To: References: <1166469922.2850.7.camel@bashful.x10sys.com> Message-ID: <1166485064.2850.39.camel@bashful.x10sys.com> On Mon, 2006-12-18 at 14:50 -0800, Chris Lattner wrote: > On Dec 18, 2006, at 11:25 AM, Reid Spencer wrote: > > > All, > > > > This patch is needed to update llvm-gcc to avoid inferred casts as > > LLVM > > no longer supports them. This patch is sufficient for getting llvm- > > gcc > > to compile/work for an X86 target. > > > > This cast does not include needed changes to gcc/config/rs6000/ > > rs6000.h > > Those changes will be sent in a subsequent patch. > > Jim already applied this (thx Jim!), so this is just an FYI: > > You're basing all of the checks here on whether or not the LLVM types > are signed. I understand that this is the most expedient way to get > stuff working in the short term, but this isn't going to work long > term, as the ->isSigned() methods are not going to exist any more. > You should eventually migrate these to using TREE_UNSIGNED and > similar macros, checking properties from the GCC trees. Yes, I understand. I was solely working towards a) fixing the breakage and b) retaining current functionality. There were a lot of changes to make in a short time to get llvm-gcc compiling again. Many of these need some deep analysis and rather than delay the patch, I took this route. > > Further, the casts in i386.h that call getCastOpcode, should be > updated to use the appropriate cast. However, I'm not sure what they > are, you can work with Evan to figure them out. I tried a few of them as specific casts and it broke many things which is just an indication that I didn't fully analyze the set of types that can be passed in. The places were getCastOpcode will remain in use are those places where the type could be anything or close to anything (e.g. function arguments and returns). These also will be reviewed in more detail as I continue to remove signlessness. FYI: my strategy here is to work from the bottom up. With the last few patches VMCore contains only one isSigned() call (in AsmWriter). I'm currently working on a fix for that. Once VMCore is clean, I'll move on to other libraries and on up the chain, removing getCastOpcode, isSigned, isUnsigned, getSignedVersion, getUnsignedVersion, etc. This will take a while, many of the remaining cases require some significant modifications in order to figure out if the value is signed or not. Speaking of which, I was thinking of adding a method to Instruction, isSignedOperand(unsigned) which recursively figures out if the operand can be signed. Consider a bunch of arithmetic based on a ZExt or SExt, something like: bool %func(sbyte %a) { %b = zext sbyte %a to short %c = sext sbyte %a to ushort %d = add short %b, %b %e = add ushort %c, %c %f = bitcast short %d to ushort %ret = call bool %doit(ushort %f, short %d) ret bool %ret } In such a function the declared types are meaningless. %b is unsigned. % c is signed. When it comes time to check the parameters to %doit, I need to know that. About the only way I can think of is to write a function on Instruction that recursively calls itself following the use chain until it finds something that is concretely signed or not. Even this might not help. Suppose the zext and sext weren't in this function. I can't statically determine the signedness of sbyte %a which might be signed or not. Thoughts? > > -Chris From rspencer at reidspencer.com Mon Dec 18 17:39:57 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Mon, 18 Dec 2006 15:39:57 -0800 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp In-Reply-To: <16e5fdf90612181414g7212c708ra280bbb54b6a4c5f@mail.gmail.com> References: <200612182156.kBILui54012388@zion.cs.uiuc.edu> <16e5fdf90612181414g7212c708ra280bbb54b6a4c5f@mail.gmail.com> Message-ID: <1166485197.2850.41.camel@bashful.x10sys.com> On Mon, 2006-12-18 at 14:14 -0800, Bill Wendling wrote: > On 12/18/06, Reid Spencer wrote: > > > > - if (Bad) { > > + if (!Bad) { > > Bad = false; > > Isn't the above statement not needed then? Yup. I'll remove it. > > -bw > > > for (pred_iterator PI = pred_begin(OpBlock), > > E = pred_end(OpBlock); PI != E; ++PI) { > > From reid at x10sys.com Mon Dec 18 17:40:34 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 17:40:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200612182340.kBINeY96014069@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.175 -> 1.176 --- Log message: Remove a useless statement. --- Diffs of the changes: (+0 -1) Verifier.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.175 llvm/lib/VMCore/Verifier.cpp:1.176 --- llvm/lib/VMCore/Verifier.cpp:1.175 Mon Dec 18 15:56:29 2006 +++ llvm/lib/VMCore/Verifier.cpp Mon Dec 18 17:40:19 2006 @@ -922,7 +922,6 @@ // 'OpBlock' dominates all of its predecessors other than the // invoke. In this case, the invoke value can still be used. if (!Bad) { - Bad = false; for (pred_iterator PI = pred_begin(OpBlock), E = pred_end(OpBlock); PI != E; ++PI) { if (*PI != II->getParent() && !EF->dominates(OpBlock, *PI)) { From isanbard at gmail.com Mon Dec 18 17:49:06 2006 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 18 Dec 2006 15:49:06 -0800 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp In-Reply-To: <1166485197.2850.41.camel@bashful.x10sys.com> References: <200612182156.kBILui54012388@zion.cs.uiuc.edu> <16e5fdf90612181414g7212c708ra280bbb54b6a4c5f@mail.gmail.com> <1166485197.2850.41.camel@bashful.x10sys.com> Message-ID: <16e5fdf90612181549k419eed3fn54805259578585ff@mail.gmail.com> On 12/18/06, Reid Spencer wrote: > On Mon, 2006-12-18 at 14:14 -0800, Bill Wendling wrote: > > On 12/18/06, Reid Spencer wrote: > > > > > > - if (Bad) { > > > + if (!Bad) { > > > Bad = false; > > > > Isn't the above statement not needed then? > > Yup. I'll remove it. > Thanks :-) -bw From sabre at nondot.org Mon Dec 18 19:11:47 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Dec 2006 19:11:47 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/MathExtras.h Message-ID: <200612190111.kBJ1BlPT015673@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: MathExtras.h updated: 1.36 -> 1.37 --- Log message: Doxgenate comments. Add GreatestCommonDivisor64 --- Diffs of the changes: (+85 -75) MathExtras.h | 160 +++++++++++++++++++++++++++++++---------------------------- 1 files changed, 85 insertions(+), 75 deletions(-) Index: llvm/include/llvm/Support/MathExtras.h diff -u llvm/include/llvm/Support/MathExtras.h:1.36 llvm/include/llvm/Support/MathExtras.h:1.37 --- llvm/include/llvm/Support/MathExtras.h:1.36 Wed Dec 6 16:47:14 2006 +++ llvm/include/llvm/Support/MathExtras.h Mon Dec 18 19:11:32 2006 @@ -15,7 +15,6 @@ #define LLVM_SUPPORT_MATHEXTRAS_H #include "llvm/Support/DataTypes.h" -#include "llvm/System/IncludeFile.h" namespace llvm { @@ -23,28 +22,27 @@ // type overloading so that signed and unsigned integers can be used without // ambiguity. - -// Hi_32 - This function returns the high 32 bits of a 64 bit value. +/// Hi_32 - This function returns the high 32 bits of a 64 bit value. inline unsigned Hi_32(uint64_t Value) { return static_cast(Value >> 32); } -// Lo_32 - This function returns the low 32 bits of a 64 bit value. +/// Lo_32 - This function returns the low 32 bits of a 64 bit value. inline unsigned Lo_32(uint64_t Value) { return static_cast(Value); } -// is?Type - these functions produce optimal testing for integer data types. -inline bool isInt8 (int64_t Value) { +/// is?Type - these functions produce optimal testing for integer data types. +inline bool isInt8 (int64_t Value) { return static_cast(Value) == Value; } -inline bool isUInt8 (int64_t Value) { +inline bool isUInt8 (int64_t Value) { return static_cast(Value) == Value; } -inline bool isInt16 (int64_t Value) { +inline bool isInt16 (int64_t Value) { return static_cast(Value) == Value; } -inline bool isUInt16(int64_t Value) { +inline bool isUInt16(int64_t Value) { return static_cast(Value) == Value; } inline bool isInt32 (int64_t Value) { @@ -54,54 +52,55 @@ return static_cast(Value) == Value; } -// isMask_32 - This function returns true if the argument is a sequence of ones -// starting at the least significant bit with the remainder zero (32 bit version.) -// Ex. isMask_32(0x0000FFFFU) == true. +/// isMask_32 - This function returns true if the argument is a sequence of ones +/// starting at the least significant bit with the remainder zero (32 bit +/// version). Ex. isMask_32(0x0000FFFFU) == true. inline const bool isMask_32(unsigned Value) { return Value && ((Value + 1) & Value) == 0; } -// isMask_64 - This function returns true if the argument is a sequence of ones -// starting at the least significant bit with the remainder zero (64 bit version.) +/// isMask_64 - This function returns true if the argument is a sequence of ones +/// starting at the least significant bit with the remainder zero (64 bit +/// version). inline const bool isMask_64(uint64_t Value) { return Value && ((Value + 1) & Value) == 0; } -// isShiftedMask_32 - This function returns true if the argument contains a -// sequence of ones with the remainder zero (32 bit version.) -// Ex. isShiftedMask_32(0x0000FF00U) == true. +/// isShiftedMask_32 - This function returns true if the argument contains a +/// sequence of ones with the remainder zero (32 bit version.) +/// Ex. isShiftedMask_32(0x0000FF00U) == true. inline const bool isShiftedMask_32(unsigned Value) { return isMask_32((Value - 1) | Value); } -// isShiftedMask_64 - This function returns true if the argument contains a -// sequence of ones with the remainder zero (64 bit version.) +/// isShiftedMask_64 - This function returns true if the argument contains a +/// sequence of ones with the remainder zero (64 bit version.) inline const bool isShiftedMask_64(uint64_t Value) { return isMask_64((Value - 1) | Value); } -// isPowerOf2_32 - This function returns true if the argument is a power of -// two > 0. Ex. isPowerOf2_32(0x00100000U) == true (32 bit edition.) +/// isPowerOf2_32 - This function returns true if the argument is a power of +/// two > 0. Ex. isPowerOf2_32(0x00100000U) == true (32 bit edition.) inline bool isPowerOf2_32(unsigned Value) { return Value && !(Value & (Value - 1)); } -// isPowerOf2_64 - This function returns true if the argument is a power of two -// > 0 (64 bit edition.) +/// isPowerOf2_64 - This function returns true if the argument is a power of two +/// > 0 (64 bit edition.) inline bool isPowerOf2_64(uint64_t Value) { return Value && !(Value & (Value - int64_t(1L))); } -// ByteSwap_16 - This function returns a byte-swapped representation of the -// 16-bit argument, Value. +/// ByteSwap_16 - This function returns a byte-swapped representation of the +/// 16-bit argument, Value. inline unsigned short ByteSwap_16(unsigned short Value) { unsigned short Hi = Value << 8; unsigned short Lo = Value >> 8; return Hi | Lo; } -// ByteSwap_32 - This function returns a byte-swapped representation of the -// 32-bit argument, Value. +/// ByteSwap_32 - This function returns a byte-swapped representation of the +/// 32-bit argument, Value. inline unsigned ByteSwap_32(unsigned Value) { unsigned Byte0 = Value & 0x000000FF; unsigned Byte1 = Value & 0x0000FF00; @@ -110,18 +109,18 @@ return (Byte0 << 24) | (Byte1 << 8) | (Byte2 >> 8) | (Byte3 >> 24); } -// ByteSwap_64 - This function returns a byte-swapped representation of the -// 64-bit argument, Value. +/// ByteSwap_64 - This function returns a byte-swapped representation of the +/// 64-bit argument, Value. inline uint64_t ByteSwap_64(uint64_t Value) { uint64_t Hi = ByteSwap_32(unsigned(Value)); uint64_t Lo = ByteSwap_32(unsigned(Value >> 32)); return (Hi << 32) | Lo; } -// CountLeadingZeros_32 - this function performs the platform optimal form of -// counting the number of zeros from the most significant bit to the first one -// bit. Ex. CountLeadingZeros_32(0x00F000FF) == 8. -// Returns 32 if the word is zero. +/// CountLeadingZeros_32 - this function performs the platform optimal form of +/// counting the number of zeros from the most significant bit to the first one +/// bit. Ex. CountLeadingZeros_32(0x00F000FF) == 8. +/// Returns 32 if the word is zero. inline unsigned CountLeadingZeros_32(unsigned Value) { unsigned Count; // result #if __GNUC__ >= 4 @@ -146,10 +145,10 @@ return Count; } -// CountLeadingZeros_64 - This function performs the platform optimal form -// of counting the number of zeros from the most significant bit to the first -// one bit (64 bit edition.) -// Returns 64 if the word is zero. +/// CountLeadingZeros_64 - This function performs the platform optimal form +/// of counting the number of zeros from the most significant bit to the first +/// one bit (64 bit edition.) +/// Returns 64 if the word is zero. inline unsigned CountLeadingZeros_64(uint64_t Value) { unsigned Count; // result #if __GNUC__ >= 4 @@ -190,25 +189,25 @@ return Count; } -// CountTrailingZeros_32 - this function performs the platform optimal form of -// counting the number of zeros from the least significant bit to the first one -// bit. Ex. CountTrailingZeros_32(0xFF00FF00) == 8. -// Returns 32 if the word is zero. +/// CountTrailingZeros_32 - this function performs the platform optimal form of +/// counting the number of zeros from the least significant bit to the first one +/// bit. Ex. CountTrailingZeros_32(0xFF00FF00) == 8. +/// Returns 32 if the word is zero. inline unsigned CountTrailingZeros_32(unsigned Value) { return 32 - CountLeadingZeros_32(~Value & (Value - 1)); } -// CountTrailingZeros_64 - This function performs the platform optimal form -// of counting the number of zeros from the least significant bit to the first -// one bit (64 bit edition.) -// Returns 64 if the word is zero. +/// CountTrailingZeros_64 - This function performs the platform optimal form +/// of counting the number of zeros from the least significant bit to the first +/// one bit (64 bit edition.) +/// Returns 64 if the word is zero. inline unsigned CountTrailingZeros_64(uint64_t Value) { return 64 - CountLeadingZeros_64(~Value & (Value - 1)); } -// CountPopulation_32 - this function counts the number of set bits in a value. -// Ex. CountPopulation(0xF000F000) = 8 -// Returns 0 if the word is zero. +/// CountPopulation_32 - this function counts the number of set bits in a value. +/// Ex. CountPopulation(0xF000F000) = 8 +/// Returns 0 if the word is zero. inline unsigned CountPopulation_32(unsigned Value) { unsigned x, t; x = Value - ((Value >> 1) & 0x55555555); @@ -220,41 +219,52 @@ return x >> 24; } -// CountPopulation_64 - this function counts the number of set bits in a value, -// (64 bit edition.) +/// CountPopulation_64 - this function counts the number of set bits in a value, +/// (64 bit edition.) inline unsigned CountPopulation_64(uint64_t Value) { return CountPopulation_32(unsigned(Value >> 32)) + CountPopulation_32(unsigned(Value)); } -// Log2_32 - This function returns the floor log base 2 of the specified value, -// -1 if the value is zero. (32 bit edition.) -// Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2 +/// Log2_32 - This function returns the floor log base 2 of the specified value, +/// -1 if the value is zero. (32 bit edition.) +/// Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2 inline unsigned Log2_32(unsigned Value) { return 31 - CountLeadingZeros_32(Value); } -// Log2_64 - This function returns the floor log base 2 of the specified value, -// -1 if the value is zero. (64 bit edition.) +/// Log2_64 - This function returns the floor log base 2 of the specified value, +/// -1 if the value is zero. (64 bit edition.) inline unsigned Log2_64(uint64_t Value) { return 63 - CountLeadingZeros_64(Value); } -// Log2_32_Ceil - This function returns the ceil log base 2 of the specified -// value, 32 if the value is zero. (32 bit edition). -// Ex. Log2_32_Ceil(32) == 5, Log2_32_Ceil(1) == 0, Log2_32_Ceil(6) == 3 +/// Log2_32_Ceil - This function returns the ceil log base 2 of the specified +/// value, 32 if the value is zero. (32 bit edition). +/// Ex. Log2_32_Ceil(32) == 5, Log2_32_Ceil(1) == 0, Log2_32_Ceil(6) == 3 inline unsigned Log2_32_Ceil(unsigned Value) { return 32-CountLeadingZeros_32(Value-1); } -// Log2_64 - This function returns the ceil log base 2 of the specified value, -// 64 if the value is zero. (64 bit edition.) +/// Log2_64 - This function returns the ceil log base 2 of the specified value, +/// 64 if the value is zero. (64 bit edition.) inline unsigned Log2_64_Ceil(uint64_t Value) { return 64-CountLeadingZeros_64(Value-1); } -// BitsToDouble - This function takes a 64-bit integer and returns the bit -// equivalent double. +/// GreatestCommonDivisor64 - Return the greatest common divisor of the two +/// values using Euclid's algorithm. +inline uint64_t GreatestCommonDivisor64(uint64_t A, uint64_t B) { + while (B) { + uint64_t T = B; + B = A % B; + A = T; + } + return A; +} + +/// BitsToDouble - This function takes a 64-bit integer and returns the bit +/// equivalent double. inline double BitsToDouble(uint64_t Bits) { union { uint64_t L; @@ -264,8 +274,8 @@ return T.D; } -// BitsToFloat - This function takes a 32-bit integer and returns the bit -// equivalent float. +/// BitsToFloat - This function takes a 32-bit integer and returns the bit +/// equivalent float. inline float BitsToFloat(uint32_t Bits) { union { uint32_t I; @@ -275,8 +285,8 @@ return T.F; } -// DoubleToBits - This function takes a double and returns the bit -// equivalent 64-bit integer. +/// DoubleToBits - This function takes a double and returns the bit +/// equivalent 64-bit integer. inline uint64_t DoubleToBits(double Double) { union { uint64_t L; @@ -286,8 +296,8 @@ return T.L; } -// FloatToBits - This function takes a float and returns the bit -// equivalent 32-bit integer. +/// FloatToBits - This function takes a float and returns the bit +/// equivalent 32-bit integer. inline uint32_t FloatToBits(float Float) { union { uint32_t I; @@ -297,13 +307,13 @@ return T.I; } -// Platform-independent wrappers for the C99 isnan() function. -int IsNAN (float f); -int IsNAN (double d); - -// Platform-independent wrappers for the C99 isinf() function. -int IsInf (float f); -int IsInf (double d); +/// Platform-independent wrappers for the C99 isnan() function. +int IsNAN(float f); +int IsNAN(double d); + +/// Platform-independent wrappers for the C99 isinf() function. +int IsInf(float f); +int IsInf(double d); } // End llvm namespace From sabre at nondot.org Mon Dec 18 19:16:17 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 18 Dec 2006 19:16:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200612190116.kBJ1GHlr015787@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.72 -> 1.73 --- Log message: Fix a bug in GetConstantFactor for affine expressions, in which the existing code was wrong for things like 3+4*i. --- Diffs of the changes: (+9 -5) ScalarEvolution.cpp | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.72 llvm/lib/Analysis/ScalarEvolution.cpp:1.73 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.72 Tue Dec 12 17:36:14 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Dec 18 19:16:02 2006 @@ -74,6 +74,7 @@ #include "llvm/Support/ConstantRange.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Support/Streams.h" #include "llvm/ADT/Statistic.h" #include @@ -1372,11 +1373,14 @@ } if (SCEVAddRecExpr *A = dyn_cast(S)) { - // FIXME: Generalize. - if (A->getNumOperands() == 2) - return std::min(GetConstantFactor(A->getOperand(0)), - GetConstantFactor(A->getOperand(1))); - // ? + // For now, we just handle linear expressions. + if (A->getNumOperands() == 2) { + // We want the GCD between the start and the stride value. + uint64_t Start = GetConstantFactor(A->getOperand(0)); + if (Start == 1) return 1; + uint64_t Stride = GetConstantFactor(A->getOperand(1)); + return GreatestCommonDivisor64(Start, Stride); + } } // SCEVSDivExpr, SCEVUnknown. From reid at x10sys.com Mon Dec 18 19:28:37 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 19:28:37 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200612190128.kBJ1SbNc015986@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.189 -> 1.190 --- Log message: Make ConstantInt not care about sign any more. To ensure the AsmParser can still check the validity of signed values an overload to isValueValidForType was added to allow passing in an int64_t to check. --- Diffs of the changes: (+19 -14) Constants.cpp | 33 +++++++++++++++++++-------------- 1 files changed, 19 insertions(+), 14 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.189 llvm/lib/VMCore/Constants.cpp:1.190 --- llvm/lib/VMCore/Constants.cpp:1.189 Mon Dec 18 02:18:46 2006 +++ llvm/lib/VMCore/Constants.cpp Mon Dec 18 19:28:19 2006 @@ -592,26 +592,31 @@ //===----------------------------------------------------------------------===// // isValueValidForType implementations +bool ConstantInt::isValueValidForType(const Type *Ty, uint64_t Val) { + switch (Ty->getTypeID()) { + default: return false; // These can't be represented as integers! + case Type::SByteTyID: + case Type::UByteTyID: return Val <= UINT8_MAX; + case Type::ShortTyID: + case Type::UShortTyID:return Val <= UINT16_MAX; + case Type::IntTyID: + case Type::UIntTyID: return Val <= UINT32_MAX; + case Type::LongTyID: + case Type::ULongTyID: return true; // always true, has to fit in largest type + } +} + bool ConstantInt::isValueValidForType(const Type *Ty, int64_t Val) { switch (Ty->getTypeID()) { - default: - return false; // These can't be represented as integers!!! - // Signed types... + default: return false; // These can't be represented as integers! case Type::SByteTyID: - return (Val <= INT8_MAX && Val >= INT8_MIN); - case Type::UByteTyID: - return (Val >= 0) && (Val <= UINT8_MAX); + case Type::UByteTyID: return (Val >= INT8_MIN && Val <= INT8_MAX); case Type::ShortTyID: - return (Val <= INT16_MAX && Val >= INT16_MIN); - case Type::UShortTyID: - return (Val >= 0) && (Val <= UINT16_MAX); + case Type::UShortTyID:return (Val >= INT16_MIN && Val <= UINT16_MAX); case Type::IntTyID: - return (Val <= int(INT32_MAX) && Val >= int(INT32_MIN)); - case Type::UIntTyID: - return (Val >= 0) && (Val <= UINT32_MAX); + case Type::UIntTyID: return (Val >= INT32_MIN && Val <= UINT32_MAX); case Type::LongTyID: - case Type::ULongTyID: - return true; // always true, has to fit in largest type + case Type::ULongTyID: return true; // always true, has to fit in largest type } } From reid at x10sys.com Mon Dec 18 19:28:37 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 19:28:37 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200612190128.kBJ1SbbU015981@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.109 -> 1.110 --- Log message: Make ConstantInt not care about sign any more. To ensure the AsmParser can still check the validity of signed values an overload to isValueValidForType was added to allow passing in an int64_t to check. --- Diffs of the changes: (+6 -3) Constants.h | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.109 llvm/include/llvm/Constants.h:1.110 --- llvm/include/llvm/Constants.h:1.109 Mon Dec 18 02:18:46 2006 +++ llvm/include/llvm/Constants.h Mon Dec 18 19:28:19 2006 @@ -181,9 +181,12 @@ /// This static method returns true if the type Ty is big enough to /// represent the value V. This can be used to avoid having the get method - /// assert when V is larger than Ty can represent. + /// assert when V is larger than Ty can represent. Note that values are + /// always treated as unsigned so if the intention is to represent a signed + /// type, you must do the conversion first. /// @returns true if V is a valid value for type Ty /// @brief Determine if the value is in range for the given type. + static bool isValueValidForType(const Type *Ty, uint64_t V); static bool isValueValidForType(const Type *Ty, int64_t V); /// @returns true if this is the null integer value. @@ -205,7 +208,7 @@ int64_t V = getSExtValue(); if (V < 0) return false; // Be careful about wrap-around on 'long's ++V; - return !isValueValidForType(getType()->getSignedVersion(), V) || V < 0; + return !isValueValidForType(getType(), V) || V < 0; } return isAllOnesValue(); } @@ -219,7 +222,7 @@ int64_t V = getSExtValue(); if (V > 0) return false; // Be careful about wrap-around on 'long's --V; - return !isValueValidForType(getType()->getSignedVersion(), V) || V > 0; + return !isValueValidForType(getType(), V) || V > 0; } return getZExtValue() == 0; } From nicholas at mxc.ca Mon Dec 18 19:30:12 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 18 Dec 2006 20:30:12 -0500 Subject: [llvm-commits] ppc linux patch 2 Message-ID: <458740A4.4040708@mxc.ca> To GNU as, register classes are determined by context. This patch changes the asm printed to print just the register number alone on non-Darwin platforms. The "getRegisterPrefix" function might be a little too magical. I'd be happy to hear any suggestions. Nick Lewycky -------------- next part -------------- A non-text attachment was scrubbed... Name: ppclinux.2.patch Type: text/x-patch Size: 10807 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/f2f63d1f/attachment.bin From reid at x10sys.com Mon Dec 18 19:34:54 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 19:34:54 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200612190134.kBJ1YskC016095@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.110 -> 1.111 --- Log message: Correct the description of ConstantInt::isValueValidForType. --- Diffs of the changes: (+5 -3) Constants.h | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.110 llvm/include/llvm/Constants.h:1.111 --- llvm/include/llvm/Constants.h:1.110 Mon Dec 18 19:28:19 2006 +++ llvm/include/llvm/Constants.h Mon Dec 18 19:34:39 2006 @@ -181,9 +181,11 @@ /// This static method returns true if the type Ty is big enough to /// represent the value V. This can be used to avoid having the get method - /// assert when V is larger than Ty can represent. Note that values are - /// always treated as unsigned so if the intention is to represent a signed - /// type, you must do the conversion first. + /// assert when V is larger than Ty can represent. Note that there are two + /// versions of this method, one for unsigned and one for signed integers. + /// Although ConstantInt canonicalizes everything to an unsigned integer, + /// the signed version avoids callers having to convert a signed quantity + /// to the appropriate unsigned type before calling the method. /// @returns true if V is a valid value for type Ty /// @brief Determine if the value is in range for the given type. static bool isValueValidForType(const Type *Ty, uint64_t V); From nicholas at mxc.ca Mon Dec 18 19:36:28 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 18 Dec 2006 20:36:28 -0500 Subject: [llvm-commits] ppc linux patch 1 Message-ID: <4587421C.1080106@mxc.ca> I've done some work on a Linux subtarget for the PPC target. Since I can't test how these affect Darwin PPC, I'm going to email them here starting with little changes and building up. Note that I will not be submitting complete PPC/Linux support; this is just a start that someone else can continue. There shouldn't be any issue with this one unless TAI->getCommentString() returns the wrong value on Darwin. Nick Lewycky -------------- next part -------------- A non-text attachment was scrubbed... Name: ppclinux.1.patch Type: text/x-patch Size: 1356 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/af721629/attachment.bin From nicholas at mxc.ca Mon Dec 18 19:05:39 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 18 Dec 2006 20:05:39 -0500 Subject: [llvm-commits] ppc linux patch 1 Message-ID: <45873AE3.3080300@mxc.ca> I've done some work on a Linux subtarget for the PPC target. Since I can't test how these affect Darwin PPC, I'm going to email them here starting with little changes and building up. Note that I will not be submitting complete PPC/Linux support; this is just a start that someone else can continue. Patch #1: a comment and two literals Shouldn't be any issue with this one unless TAI->getCommentString() returns the wrong value on Darwin. Nick Lewycky -------------- next part -------------- A non-text attachment was scrubbed... Name: ppclinux.1.patch Type: text/x-patch Size: 1355 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/4f84123c/attachment.bin From evan.cheng at apple.com Mon Dec 18 19:44:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 18 Dec 2006 19:44:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612190144.kBJ1iJ12016255@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.448 -> 1.449 --- Log message: May need to promote the operand (either sign_extend_inreg or and) before expanding a {s|u}int_to_fp. --- Diffs of the changes: (+29 -18) LegalizeDAG.cpp | 47 +++++++++++++++++++++++++++++------------------ 1 files changed, 29 insertions(+), 18 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.448 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.449 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.448 Mon Dec 18 16:55:34 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 18 19:44:04 2006 @@ -5072,24 +5072,6 @@ case ISD::FP_ROUND: Lo = ExpandLibCall("__truncdfsf2", Node, Hi); break; - case ISD::SINT_TO_FP: { - const char *FnName = 0; - if (Node->getOperand(0).getValueType() == MVT::i64) - FnName = (VT == MVT::f32) ? "__floatdisf" : "__floatdidf"; - else - FnName = (VT == MVT::f32) ? "__floatsisf" : "__floatsidf"; - Lo = ExpandLibCall(FnName, Node, Hi); - break; - } - case ISD::UINT_TO_FP: { - const char *FnName = 0; - if (Node->getOperand(0).getValueType() == MVT::i64) - FnName = (VT == MVT::f32) ? "__floatundisf" : "__floatundidf"; - else - FnName = (VT == MVT::f32) ? "__floatunsisf" : "__floatunsidf"; - Lo = ExpandLibCall(FnName, Node, Hi); - break; - } case ISD::FSQRT: case ISD::FSIN: case ISD::FCOS: { @@ -5125,6 +5107,35 @@ ExpandOp(Lo, Lo, Hi); break; } + case ISD::SINT_TO_FP: + case ISD::UINT_TO_FP: { + bool isSigned = Node->getOpcode() == ISD::SINT_TO_FP; + MVT::ValueType SrcVT = Node->getOperand(0).getValueType(); + const char *FnName = 0; + if (Node->getOperand(0).getValueType() == MVT::i64) { + if (VT == MVT::f32) + FnName = isSigned ? "__floatdisf" : "__floatundisf"; + else + FnName = isSigned ? "__floatdidf" : "__floatundidf"; + } else { + if (VT == MVT::f32) + FnName = isSigned ? "__floatsisf" : "__floatunsisf"; + else + FnName = isSigned ? "__floatsidf" : "__floatunsidf"; + } + + // Promote the operand if needed. + if (getTypeAction(SrcVT) == Promote) { + SDOperand Tmp = PromoteOp(Node->getOperand(0)); + Tmp = isSigned + ? DAG.getNode(ISD::SIGN_EXTEND_INREG, Tmp.getValueType(), Tmp, + DAG.getValueType(SrcVT)) + : DAG.getZeroExtendInReg(Tmp, SrcVT); + Node = DAG.UpdateNodeOperands(Op, Tmp).Val; + } + Lo = ExpandLibCall(FnName, Node, Hi); + break; + } } // Make sure the resultant values have been legalized themselves, unless this From reid at x10sys.com Mon Dec 18 20:03:19 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 20:03:19 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2006-12-07-SelectCrash.ll Message-ID: <200612190203.kBJ23Jt8016611@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: 2006-12-07-SelectCrash.ll updated: 1.1 -> 1.2 --- Log message: This test needs to be upgraded. --- Diffs of the changes: (+3 -3) 2006-12-07-SelectCrash.ll | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/test/Regression/CodeGen/PowerPC/2006-12-07-SelectCrash.ll diff -u llvm/test/Regression/CodeGen/PowerPC/2006-12-07-SelectCrash.ll:1.1 llvm/test/Regression/CodeGen/PowerPC/2006-12-07-SelectCrash.ll:1.2 --- llvm/test/Regression/CodeGen/PowerPC/2006-12-07-SelectCrash.ll:1.1 Thu Dec 7 16:36:14 2006 +++ llvm/test/Regression/CodeGen/PowerPC/2006-12-07-SelectCrash.ll Mon Dec 18 20:03:04 2006 @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | llc -march=ppc64 && -; RUN: llvm-as < %s | llc -march=ppc32 && -; RUN: llvm-as < %s | llc +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 && +; RUN: llvm-upgrade < %s | llvm-as | llc %qsz.b = external global bool ; [#uses=1] From reid at x10sys.com Mon Dec 18 20:07:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 20:07:27 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll 2003-05-28-ManyArgs.ll 2003-07-06-BadIntCmp.ll 2003-07-29-BadConstSbyte.ll badCallArgLRLLVM.ll badarg6.ll badlive.ll Message-ID: <200612190207.kBJ27RA6016804@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2003-05-27-phifcmpd.ll updated: 1.3 -> 1.4 2003-05-28-ManyArgs.ll updated: 1.4 -> 1.5 2003-07-06-BadIntCmp.ll updated: 1.3 -> 1.4 2003-07-29-BadConstSbyte.ll updated: 1.4 -> 1.5 badCallArgLRLLVM.ll updated: 1.2 -> 1.3 badarg6.ll updated: 1.3 -> 1.4 badlive.ll updated: 1.3 -> 1.4 --- Log message: This test needs to be upgraded in preparation for the SETCC patch. --- Diffs of the changes: (+7 -7) 2003-05-27-phifcmpd.ll | 2 +- 2003-05-28-ManyArgs.ll | 2 +- 2003-07-06-BadIntCmp.ll | 2 +- 2003-07-29-BadConstSbyte.ll | 2 +- badCallArgLRLLVM.ll | 2 +- badarg6.ll | 2 +- badlive.ll | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll:1.3 llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll:1.4 --- llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll:1.3 Fri Jan 7 16:05:30 2005 +++ llvm/test/Regression/CodeGen/Generic/2003-05-27-phifcmpd.ll Mon Dec 18 20:07:11 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o - | llc +; RUN: llvm-upgrade < %s | llvm-as | llc void %QRiterate(int %p.1, double %tmp.212) { entry: ; No predecessors! Index: llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll:1.4 llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll:1.5 --- llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll:1.4 Thu Nov 23 09:14:52 2006 +++ llvm/test/Regression/CodeGen/Generic/2003-05-28-ManyArgs.ll Mon Dec 18 20:07:11 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o - | llc +; RUN: llvm-upgrade < %s | llvm-as | llc ;; Date: May 28, 2003. ;; From: test/Programs/External/SPEC/CINT2000/175.vpr.llvm.bc Index: llvm/test/Regression/CodeGen/Generic/2003-07-06-BadIntCmp.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-07-06-BadIntCmp.ll:1.3 llvm/test/Regression/CodeGen/Generic/2003-07-06-BadIntCmp.ll:1.4 --- llvm/test/Regression/CodeGen/Generic/2003-07-06-BadIntCmp.ll:1.3 Fri Jan 7 16:05:31 2005 +++ llvm/test/Regression/CodeGen/Generic/2003-07-06-BadIntCmp.ll Mon Dec 18 20:07:11 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o - | llc +; RUN: llvm-upgrade < %s | llvm-as | llc ;; Date: May 28, 2003. ;; From: test/Programs/MultiSource/Olden-perimeter/maketree.c Index: llvm/test/Regression/CodeGen/Generic/2003-07-29-BadConstSbyte.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-07-29-BadConstSbyte.ll:1.4 llvm/test/Regression/CodeGen/Generic/2003-07-29-BadConstSbyte.ll:1.5 --- llvm/test/Regression/CodeGen/Generic/2003-07-29-BadConstSbyte.ll:1.4 Tue Nov 30 01:38:41 2004 +++ llvm/test/Regression/CodeGen/Generic/2003-07-29-BadConstSbyte.ll Mon Dec 18 20:07:11 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o - | llc +; RUN: llvm-upgrade < %s | llvm-as | llc ;; Date: Jul 29, 2003. ;; From: test/Programs/MultiSource/Ptrdist-bc Index: llvm/test/Regression/CodeGen/Generic/badCallArgLRLLVM.ll diff -u llvm/test/Regression/CodeGen/Generic/badCallArgLRLLVM.ll:1.2 llvm/test/Regression/CodeGen/Generic/badCallArgLRLLVM.ll:1.3 --- llvm/test/Regression/CodeGen/Generic/badCallArgLRLLVM.ll:1.2 Sat Nov 6 17:05:53 2004 +++ llvm/test/Regression/CodeGen/Generic/badCallArgLRLLVM.ll Mon Dec 18 20:07:11 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o - | llc +; RUN: llvm-upgrade < %s | llvm-as | llc ; This caused a problem because the argument of a call was defined by ; the return value of another call that appears later in the code. Index: llvm/test/Regression/CodeGen/Generic/badarg6.ll diff -u llvm/test/Regression/CodeGen/Generic/badarg6.ll:1.3 llvm/test/Regression/CodeGen/Generic/badarg6.ll:1.4 --- llvm/test/Regression/CodeGen/Generic/badarg6.ll:1.3 Fri Jan 7 16:05:31 2005 +++ llvm/test/Regression/CodeGen/Generic/badarg6.ll Mon Dec 18 20:07:11 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o - | llc +; RUN: llvm-upgrade < %s | llvm-as | llc ; On this code, llc did not pass the sixth argument (%reg321) to printf. ; It passed the first five in %o0 - %o4, but never initialized %o5. Index: llvm/test/Regression/CodeGen/Generic/badlive.ll diff -u llvm/test/Regression/CodeGen/Generic/badlive.ll:1.3 llvm/test/Regression/CodeGen/Generic/badlive.ll:1.4 --- llvm/test/Regression/CodeGen/Generic/badlive.ll:1.3 Sat Nov 6 17:05:53 2004 +++ llvm/test/Regression/CodeGen/Generic/badlive.ll Mon Dec 18 20:07:11 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o - | llc +; RUN: llvm-upgrade < %s | llvm-as | llc implementation From reid at x10sys.com Mon Dec 18 20:09:35 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 20:09:35 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/ExecutionEngine/2003-01-04-LoopTest.ll 2003-06-04-bzip2-bug.ll test-branch.ll test-cast.ll test-loop.ll test-setcond-int.ll Message-ID: <200612190209.kBJ29ZDO016867@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/ExecutionEngine: 2003-01-04-LoopTest.ll updated: 1.2 -> 1.3 2003-06-04-bzip2-bug.ll updated: 1.2 -> 1.3 test-branch.ll updated: 1.6 -> 1.7 test-cast.ll updated: 1.11 -> 1.12 test-loop.ll updated: 1.2 -> 1.3 test-setcond-int.ll updated: 1.5 -> 1.6 --- Log message: For PR950: http://llvm.org/PR950 : These tests need to be upgraded in preparation for the SETCC patch. --- Diffs of the changes: (+6 -9) 2003-01-04-LoopTest.ll | 2 +- 2003-06-04-bzip2-bug.ll | 2 +- test-branch.ll | 2 +- test-cast.ll | 3 +-- test-loop.ll | 4 +--- test-setcond-int.ll | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) Index: llvm/test/Regression/ExecutionEngine/2003-01-04-LoopTest.ll diff -u llvm/test/Regression/ExecutionEngine/2003-01-04-LoopTest.ll:1.2 llvm/test/Regression/ExecutionEngine/2003-01-04-LoopTest.ll:1.3 --- llvm/test/Regression/ExecutionEngine/2003-01-04-LoopTest.ll:1.2 Sat Nov 6 17:32:43 2004 +++ llvm/test/Regression/ExecutionEngine/2003-01-04-LoopTest.ll Mon Dec 18 20:09:20 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o %t.bc +; RUN: llvm-upgrade < %s | llvm-as -o %t.bc -f ; RUN: lli %t.bc > /dev/null implementation Index: llvm/test/Regression/ExecutionEngine/2003-06-04-bzip2-bug.ll diff -u llvm/test/Regression/ExecutionEngine/2003-06-04-bzip2-bug.ll:1.2 llvm/test/Regression/ExecutionEngine/2003-06-04-bzip2-bug.ll:1.3 --- llvm/test/Regression/ExecutionEngine/2003-06-04-bzip2-bug.ll:1.2 Sat Nov 6 17:32:43 2004 +++ llvm/test/Regression/ExecutionEngine/2003-06-04-bzip2-bug.ll Mon Dec 18 20:09:20 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o %t.bc +; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc ; RUN: lli %t.bc > /dev/null ; Testcase distilled from 256.bzip2. Index: llvm/test/Regression/ExecutionEngine/test-branch.ll diff -u llvm/test/Regression/ExecutionEngine/test-branch.ll:1.6 llvm/test/Regression/ExecutionEngine/test-branch.ll:1.7 --- llvm/test/Regression/ExecutionEngine/test-branch.ll:1.6 Sat Nov 6 17:32:43 2004 +++ llvm/test/Regression/ExecutionEngine/test-branch.ll Mon Dec 18 20:09:20 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o %t.bc +; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc ; RUN: lli %t.bc > /dev/null ; test unconditional branch Index: llvm/test/Regression/ExecutionEngine/test-cast.ll diff -u llvm/test/Regression/ExecutionEngine/test-cast.ll:1.11 llvm/test/Regression/ExecutionEngine/test-cast.ll:1.12 --- llvm/test/Regression/ExecutionEngine/test-cast.ll:1.11 Sun Dec 3 10:17:19 2006 +++ llvm/test/Regression/ExecutionEngine/test-cast.ll Mon Dec 18 20:09:20 2006 @@ -1,8 +1,7 @@ -; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc +; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc ; RUN: lli %t.bc > /dev/null - int %foo() { ret int 0 } Index: llvm/test/Regression/ExecutionEngine/test-loop.ll diff -u llvm/test/Regression/ExecutionEngine/test-loop.ll:1.2 llvm/test/Regression/ExecutionEngine/test-loop.ll:1.3 --- llvm/test/Regression/ExecutionEngine/test-loop.ll:1.2 Sat Nov 6 17:32:43 2004 +++ llvm/test/Regression/ExecutionEngine/test-loop.ll Mon Dec 18 20:09:20 2006 @@ -1,8 +1,6 @@ -; RUN: llvm-as -f %s -o %t.bc +; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc ; RUN: lli %t.bc > /dev/null - - int %main() { br label %Loop Loop: Index: llvm/test/Regression/ExecutionEngine/test-setcond-int.ll diff -u llvm/test/Regression/ExecutionEngine/test-setcond-int.ll:1.5 llvm/test/Regression/ExecutionEngine/test-setcond-int.ll:1.6 --- llvm/test/Regression/ExecutionEngine/test-setcond-int.ll:1.5 Sat Nov 6 17:32:43 2004 +++ llvm/test/Regression/ExecutionEngine/test-setcond-int.ll Mon Dec 18 20:09:20 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o %t.bc +; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc ; RUN: lli %t.bc > /dev/null From reid at x10sys.com Mon Dec 18 20:10:19 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 20:10:19 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Linker/2003-04-26-NullPtrLinkProblem.ll Message-ID: <200612190210.kBJ2AJXl016899@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Linker: 2003-04-26-NullPtrLinkProblem.ll updated: 1.3 -> 1.4 --- Log message: For PR950: http://llvm.org/PR950 : Upgrade this test in preparation for the SETCC patch. --- Diffs of the changes: (+1 -1) 2003-04-26-NullPtrLinkProblem.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/Linker/2003-04-26-NullPtrLinkProblem.ll diff -u llvm/test/Regression/Linker/2003-04-26-NullPtrLinkProblem.ll:1.3 llvm/test/Regression/Linker/2003-04-26-NullPtrLinkProblem.ll:1.4 --- llvm/test/Regression/Linker/2003-04-26-NullPtrLinkProblem.ll:1.3 Mon Sep 15 15:04:28 2003 +++ llvm/test/Regression/Linker/2003-04-26-NullPtrLinkProblem.ll Mon Dec 18 20:10:04 2006 @@ -2,7 +2,7 @@ ; the same type to be created! ; RUN: echo "%T = type int" | llvm-as > %t.2.bc -; RUN: llvm-as < %s > %t.1.bc +; RUN: llvm-upgrade < %s | llvm-as -f > %t.1.bc ; RUN: llvm-link %t.[12].bc %T = type opaque From reid at x10sys.com Mon Dec 18 20:13:48 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 20:13:48 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll Message-ID: <200612190213.kBJ2DmQd016954@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/GlobalOpt: 2006-07-07-InlineAsmCrash.ll updated: 1.1 -> 1.2 --- Log message: For PR950: http://llvm.org/PR950 : Upgrade this test in preparation for the SETCC patch. --- Diffs of the changes: (+1 -1) 2006-07-07-InlineAsmCrash.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll diff -u llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll:1.1 llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll:1.2 --- llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll:1.1 Fri Jul 7 16:36:42 2006 +++ llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll Mon Dec 18 20:13:33 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as< %s | opt -globalopt -disable-output +; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt -disable-output ; PR820 target endian = little target pointersize = 32 From reid at x10sys.com Mon Dec 18 20:14:23 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 20:14:23 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx Message-ID: <200612190214.kBJ2ENUb016973@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/IndVarsSimplify: tripcount_infinite.llx updated: 1.2 -> 1.3 --- Log message: For PR950: http://llvm.org/PR950 : Upgrade this test in preparation for the SETCC patch. --- Diffs of the changes: (+2 -2) tripcount_infinite.llx | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx diff -u llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx:1.2 llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx:1.3 --- llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx:1.2 Fri Dec 1 22:23:09 2006 +++ llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx Mon Dec 18 20:14:08 2006 @@ -1,8 +1,8 @@ ; These tests have an infinite trip count. We obviously shouldn't remove the ; loops! :) ; -; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -adce -simplifycfg | llvm-dis | grep set | wc -l > %t2 -; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep set | wc -l > %t1 +; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -adce -simplifycfg | llvm-dis | grep icmp | wc -l > %t2 +; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep icmp | wc -l > %t1 ; RUN: diff %t1 %t2 int %infinite_linear() { ;; test for (i = 1; i != 100; i += 2) From reid at x10sys.com Mon Dec 18 20:17:38 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 20:17:38 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx Message-ID: <200612190217.kBJ2HcAp017048@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/IndVarsSimplify: tripcount_infinite.llx updated: 1.3 -> 1.4 --- Log message: Back out last revision, a bit premature, its not an upgrade-only change. --- Diffs of the changes: (+2 -2) tripcount_infinite.llx | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx diff -u llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx:1.3 llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx:1.4 --- llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx:1.3 Mon Dec 18 20:14:08 2006 +++ llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx Mon Dec 18 20:17:23 2006 @@ -1,8 +1,8 @@ ; These tests have an infinite trip count. We obviously shouldn't remove the ; loops! :) ; -; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -adce -simplifycfg | llvm-dis | grep icmp | wc -l > %t2 -; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep icmp | wc -l > %t1 +; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -adce -simplifycfg | llvm-dis | grep set | wc -l > %t2 +; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep set | wc -l > %t1 ; RUN: diff %t1 %t2 int %infinite_linear() { ;; test for (i = 1; i != 100; i += 2) From reid at x10sys.com Mon Dec 18 21:16:02 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 18 Dec 2006 21:16:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200612190316.kBJ3G2cS017952@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.116 -> 1.117 --- Log message: Rewrite ConstantFoldCastInstruction so that it doesn't use any of the ConstRules. Remove the casting rules from ConstRules and subclasses. This cleans up ConstantFolding significantly. Passes all tests. --- Diffs of the changes: (+50 -219) ConstantFolding.cpp | 269 +++++++++------------------------------------------- 1 files changed, 50 insertions(+), 219 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.116 llvm/lib/VMCore/ConstantFolding.cpp:1.117 --- llvm/lib/VMCore/ConstantFolding.cpp:1.116 Sun Dec 17 22:22:56 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Mon Dec 18 21:15:47 2006 @@ -54,21 +54,6 @@ virtual Constant *lessthan(const Constant *V1, const Constant *V2) const =0; virtual Constant *equalto(const Constant *V1, const Constant *V2) const = 0; - // Casting operators. - virtual Constant *castToBool (const Constant *V) const = 0; - virtual Constant *castToSByte (const Constant *V) const = 0; - virtual Constant *castToUByte (const Constant *V) const = 0; - virtual Constant *castToShort (const Constant *V) const = 0; - virtual Constant *castToUShort(const Constant *V) const = 0; - virtual Constant *castToInt (const Constant *V) const = 0; - virtual Constant *castToUInt (const Constant *V) const = 0; - virtual Constant *castToLong (const Constant *V) const = 0; - virtual Constant *castToULong (const Constant *V) const = 0; - virtual Constant *castToFloat (const Constant *V) const = 0; - virtual Constant *castToDouble(const Constant *V) const = 0; - virtual Constant *castToPointer(const Constant *V, - const PointerType *Ty) const = 0; - // ConstRules::get - Return an instance of ConstRules for the specified // constant operands. // @@ -154,44 +139,6 @@ return SubClassName::EqualTo((const ArgType *)V1, (const ArgType *)V2); } - // Casting operators. ick - virtual Constant *castToBool(const Constant *V) const { - return SubClassName::CastToBool((const ArgType*)V); - } - virtual Constant *castToSByte(const Constant *V) const { - return SubClassName::CastToSByte((const ArgType*)V); - } - virtual Constant *castToUByte(const Constant *V) const { - return SubClassName::CastToUByte((const ArgType*)V); - } - virtual Constant *castToShort(const Constant *V) const { - return SubClassName::CastToShort((const ArgType*)V); - } - virtual Constant *castToUShort(const Constant *V) const { - return SubClassName::CastToUShort((const ArgType*)V); - } - virtual Constant *castToInt(const Constant *V) const { - return SubClassName::CastToInt((const ArgType*)V); - } - virtual Constant *castToUInt(const Constant *V) const { - return SubClassName::CastToUInt((const ArgType*)V); - } - virtual Constant *castToLong(const Constant *V) const { - return SubClassName::CastToLong((const ArgType*)V); - } - virtual Constant *castToULong(const Constant *V) const { - return SubClassName::CastToULong((const ArgType*)V); - } - virtual Constant *castToFloat(const Constant *V) const { - return SubClassName::CastToFloat((const ArgType*)V); - } - virtual Constant *castToDouble(const Constant *V) const { - return SubClassName::CastToDouble((const ArgType*)V); - } - virtual Constant *castToPointer(const Constant *V, - const PointerType *Ty) const { - return SubClassName::CastToPointer((const ArgType*)V, Ty); - } //===--------------------------------------------------------------------===// // Default "noop" implementations @@ -219,21 +166,6 @@ return 0; } - // Casting operators. ick - static Constant *CastToBool (const Constant *V) { return 0; } - static Constant *CastToSByte (const Constant *V) { return 0; } - static Constant *CastToUByte (const Constant *V) { return 0; } - static Constant *CastToShort (const Constant *V) { return 0; } - static Constant *CastToUShort(const Constant *V) { return 0; } - static Constant *CastToInt (const Constant *V) { return 0; } - static Constant *CastToUInt (const Constant *V) { return 0; } - static Constant *CastToLong (const Constant *V) { return 0; } - static Constant *CastToULong (const Constant *V) { return 0; } - static Constant *CastToFloat (const Constant *V) { return 0; } - static Constant *CastToDouble(const Constant *V) { return 0; } - static Constant *CastToPointer(const Constant *, - const PointerType *) {return 0;} - public: virtual ~TemplateRules() {} }; @@ -287,25 +219,6 @@ static Constant *Xor(const ConstantBool *V1, const ConstantBool *V2) { return ConstantBool::get(V1->getValue() ^ V2->getValue()); } - - // Casting operators. ick -#define DEF_CAST(TYPE, CLASS, CTYPE) \ - static Constant *CastTo##TYPE (const ConstantBool *V) { \ - return CLASS::get(Type::TYPE##Ty, (CTYPE)(bool)V->getValue()); \ - } - - DEF_CAST(Bool , ConstantBool, bool) - DEF_CAST(SByte , ConstantInt, signed char) - DEF_CAST(UByte , ConstantInt, unsigned char) - DEF_CAST(Short , ConstantInt, signed short) - DEF_CAST(UShort, ConstantInt, unsigned short) - DEF_CAST(Int , ConstantInt, signed int) - DEF_CAST(UInt , ConstantInt, unsigned int) - DEF_CAST(Long , ConstantInt, int64_t) - DEF_CAST(ULong , ConstantInt, uint64_t) - DEF_CAST(Float , ConstantFP , float) - DEF_CAST(Double, ConstantFP , double) -#undef DEF_CAST }; } // end anonymous namespace @@ -323,44 +236,6 @@ static Constant *EqualTo(const Constant *V1, const Constant *V2) { return ConstantBool::getTrue(); // Null pointers are always equal } - static Constant *CastToBool(const Constant *V) { - return ConstantBool::getFalse(); - } - static Constant *CastToSByte (const Constant *V) { - return ConstantInt::get(Type::SByteTy, 0); - } - static Constant *CastToUByte (const Constant *V) { - return ConstantInt::get(Type::UByteTy, 0); - } - static Constant *CastToShort (const Constant *V) { - return ConstantInt::get(Type::ShortTy, 0); - } - static Constant *CastToUShort(const Constant *V) { - return ConstantInt::get(Type::UShortTy, 0); - } - static Constant *CastToInt (const Constant *V) { - return ConstantInt::get(Type::IntTy, 0); - } - static Constant *CastToUInt (const Constant *V) { - return ConstantInt::get(Type::UIntTy, 0); - } - static Constant *CastToLong (const Constant *V) { - return ConstantInt::get(Type::LongTy, 0); - } - static Constant *CastToULong (const Constant *V) { - return ConstantInt::get(Type::ULongTy, 0); - } - static Constant *CastToFloat (const Constant *V) { - return ConstantFP::get(Type::FloatTy, 0); - } - static Constant *CastToDouble(const Constant *V) { - return ConstantFP::get(Type::DoubleTy, 0); - } - - static Constant *CastToPointer(const ConstantPointerNull *V, - const PointerType *PTy) { - return ConstantPointerNull::get(PTy); - } }; } // end anonymous namespace @@ -497,32 +372,6 @@ return ConstantBool::get(R); } - static Constant *CastToPointer(const ConstantInt *V, - const PointerType *PTy) { - if (V->isNullValue()) // Is it a FP or Integral null value? - return ConstantPointerNull::get(PTy); - return 0; // Can't const prop other types of pointers - } - - // Casting operators. ick -#define DEF_CAST(TYPE, CLASS, CTYPE) \ - static Constant *CastTo##TYPE (const ConstantInt *V) { \ - return CLASS::get(Type::TYPE##Ty, (CTYPE)((BuiltinType)V->getZExtValue()));\ - } - - DEF_CAST(Bool , ConstantBool, bool) - DEF_CAST(SByte , ConstantInt, signed char) - DEF_CAST(UByte , ConstantInt, unsigned char) - DEF_CAST(Short , ConstantInt, signed short) - DEF_CAST(UShort, ConstantInt, unsigned short) - DEF_CAST(Int , ConstantInt, signed int) - DEF_CAST(UInt , ConstantInt, unsigned int) - DEF_CAST(Long , ConstantInt, int64_t) - DEF_CAST(ULong , ConstantInt, uint64_t) - DEF_CAST(Float , ConstantFP , float) - DEF_CAST(Double, ConstantFP , double) -#undef DEF_CAST - static Constant *UDiv(const ConstantInt *V1, const ConstantInt *V2) { if (V2->isNullValue()) // X / 0 return 0; @@ -630,32 +479,6 @@ return ConstantBool::get(R); } - static Constant *CastToPointer(const ConstantFP *V, - const PointerType *PTy) { - if (V->isNullValue()) // Is it a FP or Integral null value? - return ConstantPointerNull::get(PTy); - return 0; // Can't const prop other types of pointers - } - - // Casting operators. ick -#define DEF_CAST(TYPE, CLASS, CTYPE) \ - static Constant *CastTo##TYPE (const ConstantFP *V) { \ - return CLASS::get(Type::TYPE##Ty, (CTYPE)(BuiltinType)V->getValue()); \ - } - - DEF_CAST(Bool , ConstantBool, bool) - DEF_CAST(SByte , ConstantInt, signed char) - DEF_CAST(UByte , ConstantInt, unsigned char) - DEF_CAST(Short , ConstantInt, signed short) - DEF_CAST(UShort, ConstantInt, unsigned short) - DEF_CAST(Int , ConstantInt, signed int) - DEF_CAST(UInt , ConstantInt, unsigned int) - DEF_CAST(Long , ConstantInt, int64_t) - DEF_CAST(ULong , ConstantInt, uint64_t) - DEF_CAST(Float , ConstantFP , float) - DEF_CAST(Double, ConstantFP , double) -#undef DEF_CAST - static Constant *FRem(const ConstantFP *V1, const ConstantFP *V2) { if (V2->isNullValue()) return 0; BuiltinType Result = std::fmod((BuiltinType)V1->getValue(), @@ -852,43 +675,67 @@ } } - // We actually have to do a cast now, but first, we might need to fix up - // the value of the operand. + // We actually have to do a cast now. Perform the cast according to the + // opcode specified. switch (opc) { - case Instruction::PtrToInt: case Instruction::FPTrunc: case Instruction::FPExt: - break; + return ConstantFP::get(DestTy, cast(V)->getValue()); case Instruction::FPToUI: { - ConstRules &Rules = ConstRules::get(V, V); - V = Rules.castToULong(V); // make sure we get an unsigned value first - break; + double dVal = cast(V)->getValue(); + uint64_t iVal = (uint64_t) dVal; + return ConstantIntegral::get(DestTy, iVal); } case Instruction::FPToSI: { - ConstRules &Rules = ConstRules::get(V, V); - V = Rules.castToLong(V); // make sure we get a signed value first - break; + double dVal = cast(V)->getValue(); + int64_t iVal = (int64_t) dVal; + return ConstantIntegral::get(DestTy, iVal); } case Instruction::IntToPtr: //always treated as unsigned - case Instruction::UIToFP: + if (V->isNullValue()) // Is it a FP or Integral null value? + return ConstantPointerNull::get(cast(DestTy)); + return 0; // Other pointer types cannot be casted + case Instruction::PtrToInt: // always treated as unsigned + if (V->isNullValue()) + return ConstantIntegral::get(DestTy, 0); + return 0; // Other pointer types cannot be casted + case Instruction::UIToFP: { + // First, extract the unsigned integer value + uint64_t Val; + if (isa(V)) + Val = cast(V)->getZExtValue(); + else if (const ConstantBool *CB = dyn_cast(V)) + Val = CB->getValue() ? 1 : 0; + // Now generate the equivalent floating point value + double dVal = (double) Val; + return ConstantFP::get(DestTy, dVal); + } + case Instruction::SIToFP: { + // First, extract the signed integer value + int64_t Val; + if (isa(V)) + Val = cast(V)->getSExtValue(); + else if (const ConstantBool *CB = dyn_cast(V)) + Val = CB->getValue() ? -1 : 0; + // Now generate the equivalent floating point value + double dVal = (double) Val; + return ConstantFP::get(DestTy, dVal); + } case Instruction::ZExt: - // A ZExt always produces an unsigned value so we need to cast the value - // now before we try to cast it to the destination type + // Handle trunc directly here if it is a ConstantIntegral. if (isa(V)) - V = ConstantInt::get(SrcTy->getUnsignedVersion(), - cast(V)->getZExtValue()); - break; - case Instruction::SIToFP: + return ConstantInt::get(DestTy, cast(V)->getZExtValue()); + else if (const ConstantBool *CB = dyn_cast(V)) + return ConstantInt::get(DestTy, CB->getValue() ? 1 : 0); + return 0; case Instruction::SExt: // A SExt always produces a signed value so we need to cast the value // now before we try to cast it to the destiniation type. if (isa(V)) - V = ConstantInt::get(SrcTy->getSignedVersion(), - cast(V)->getSExtValue()); + return ConstantInt::get(DestTy, cast(V)->getSExtValue()); else if (const ConstantBool *CB = dyn_cast(V)) - V = ConstantInt::get(Type::SByteTy, CB->getValue() ? -1 : 0); - - break; + return ConstantInt::get(DestTy, CB->getValue() ? -1 : 0); + return 0; case Instruction::Trunc: // We just handle trunc directly here. The code below doesn't work for // trunc to bool. @@ -896,7 +743,8 @@ return ConstantIntegral::get(DestTy, CI->getZExtValue()); return 0; case Instruction::BitCast: - if (SrcTy == DestTy) return (Constant*)V; // no-op cast + if (SrcTy == DestTy) + return (Constant*)V; // no-op cast // Check to see if we are casting a pointer to an aggregate to a pointer to // the first element. If so, return the appropriate GEP instruction. @@ -995,25 +843,8 @@ break; } - // Okay, no more folding possible, time to cast - ConstRules &Rules = ConstRules::get(V, V); - switch (DestTy->getTypeID()) { - case Type::BoolTyID: return Rules.castToBool(V); - case Type::UByteTyID: return Rules.castToUByte(V); - case Type::SByteTyID: return Rules.castToSByte(V); - case Type::UShortTyID: return Rules.castToUShort(V); - case Type::ShortTyID: return Rules.castToShort(V); - case Type::UIntTyID: return Rules.castToUInt(V); - case Type::IntTyID: return Rules.castToInt(V); - case Type::ULongTyID: return Rules.castToULong(V); - case Type::LongTyID: return Rules.castToLong(V); - case Type::FloatTyID: return Rules.castToFloat(V); - case Type::DoubleTyID: return Rules.castToDouble(V); - case Type::PointerTyID: - return Rules.castToPointer(V, cast(DestTy)); - // what about packed ? - default: return 0; - } + assert(0 && "Failed to cast constant expression"); + return 0; } Constant *llvm::ConstantFoldSelectInstruction(const Constant *Cond, From clattner at apple.com Tue Dec 19 00:45:29 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Dec 2006 22:45:29 -0800 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp In-Reply-To: <200612190316.kBJ3G2cS017952@zion.cs.uiuc.edu> References: <200612190316.kBJ3G2cS017952@zion.cs.uiuc.edu> Message-ID: On Dec 18, 2006, at 7:16 PM, Reid Spencer wrote: > Rewrite ConstantFoldCastInstruction so that it doesn't use any of the > ConstRules. Remove the casting rules from ConstRules and > subclasses. This > cleans up ConstantFolding significantly. Passes all tests. Nice! > case Instruction::UIToFP: { > + // First, extract the unsigned integer value > + uint64_t Val; > + if (isa(V)) > + Val = cast(V)->getZExtValue(); > + else if (const ConstantBool *CB = dyn_cast(V)) > + Val = CB->getValue() ? 1 : 0; ConstantBool is ConstantIntegral. You should be able to do: > + if (ConstantIntegral *CI = dyn_cast(V)) > + Val = CI->getZExtValue(); to handle both cases. > + // Now generate the equivalent floating point value > + double dVal = (double) Val; > + return ConstantFP::get(DestTy, dVal); > + } > + case Instruction::SIToFP: { > + // First, extract the signed integer value > + int64_t Val; > + if (isa(V)) > + Val = cast(V)->getSExtValue(); > + else if (const ConstantBool *CB = dyn_cast(V)) > + Val = CB->getValue() ? -1 : 0; Likewise. > + // Now generate the equivalent floating point value > + double dVal = (double) Val; > + return ConstantFP::get(DestTy, dVal); > + } > case Instruction::ZExt: > + // Handle trunc directly here if it is a ConstantIntegral. > if (isa(V)) > + return ConstantInt::get(DestTy, cast(V)- > >getZExtValue()); > + else if (const ConstantBool *CB = dyn_cast(V)) > + return ConstantInt::get(DestTy, CB->getValue() ? 1 : 0); Likewise, also, please correct the comment. > + return 0; > case Instruction::SExt: > // A SExt always produces a signed value so we need to cast > the value > // now before we try to cast it to the destiniation type. > if (isa(V)) > + return ConstantInt::get(DestTy, cast(V)- > >getSExtValue()); > else if (const ConstantBool *CB = dyn_cast(V)) > + return ConstantInt::get(DestTy, CB->getValue() ? -1 : 0); Likewise. > + return 0; > case Instruction::Trunc: > // We just handle trunc directly here. The code below doesn't > work for > // trunc to bool. > @@ -896,7 +743,8 @@ > return ConstantIntegral::get(DestTy, CI->getZExtValue()); > return 0; > case Instruction::BitCast: > - if (SrcTy == DestTy) return (Constant*)V; // no-op cast > + if (SrcTy == DestTy) > + return (Constant*)V; // no-op cast Does this fold (int)4U ? -Chris From clattner at apple.com Tue Dec 19 01:15:25 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Dec 2006 23:15:25 -0800 Subject: [llvm-commits] [llvm-gcc] Cast Fix In-Reply-To: <1166485064.2850.39.camel@bashful.x10sys.com> References: <1166469922.2850.7.camel@bashful.x10sys.com> <1166485064.2850.39.camel@bashful.x10sys.com> Message-ID: <119AB276-889D-4BBE-89B6-820FE6C2C165@apple.com> >> You're basing all of the checks here on whether or not the LLVM types >> are signed. I understand that this is the most expedient way to get >> stuff working in the short term, but this isn't going to work long >> term, as the ->isSigned() methods are not going to exist any more. >> You should eventually migrate these to using TREE_UNSIGNED and >> similar macros, checking properties from the GCC trees. > > Yes, I understand. I was solely working towards a) fixing the breakage > and b) retaining current functionality. There were a lot of changes to > make in a short time to get llvm-gcc compiling again. Many of these > need > some deep analysis and rather than delay the patch, I took this route. Yep, makes sense. >> >> Further, the casts in i386.h that call getCastOpcode, should be >> updated to use the appropriate cast. However, I'm not sure what they >> are, you can work with Evan to figure them out. > > I tried a few of them as specific casts and it broke many things which > is just an indication that I didn't fully analyze the set of types > that > can be passed in. The places were getCastOpcode will remain in use are > those places where the type could be anything or close to anything > (e.g. > function arguments and returns). These also will be reviewed in more > detail as I continue to remove signlessness. Ok. > FYI: my strategy here is to work from the bottom up. With the last few > patches VMCore contains only one isSigned() call (in AsmWriter). I'm > currently working on a fix for that. Once VMCore is clean, I'll > move on > to other libraries and on up the chain, removing getCastOpcode, > isSigned, isUnsigned, getSignedVersion, getUnsignedVersion, etc. Nice. > This will take a while, many of the remaining cases require some > significant modifications in order to figure out if the value is > signed > or not. Speaking of which, I was thinking of adding a method to > Instruction, isSignedOperand(unsigned) which recursively figures > out if > the operand can be signed. Consider a bunch of arithmetic based on a > ZExt or SExt, something like: > > bool %func(sbyte %a) { > %b = zext sbyte %a to short > %c = sext sbyte %a to ushort > %d = add short %b, %b > %e = add ushort %c, %c > %f = bitcast short %d to ushort > %ret = call bool %doit(ushort %f, short %d) > ret bool %ret > } > > In such a function the declared types are meaningless. %b is > unsigned. % > c is signed. When it comes time to check the parameters to %doit, I > need > to know that. About the only way I can think of is to write a function > on Instruction that recursively calls itself following the use chain > until it finds something that is concretely signed or not. Even this > might not help. Suppose the zext and sext weren't in this function. I > can't statically determine the signedness of sbyte %a which might be > signed or not. I don't think this is a good idea. What specific clients would use this? -Chris From clattner at apple.com Tue Dec 19 01:20:42 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 18 Dec 2006 23:20:42 -0800 Subject: [llvm-commits] SETCC Patches #2 In-Reply-To: <1166054404.2863.13.camel@bashful.x10sys.com> References: <1165794220.15266.89.camel@bashful.x10sys.com> <5E1FE822-D236-4200-969D-C0EAB47B955E@apple.com> <1166054404.2863.13.camel@bashful.x10sys.com> Message-ID: <5C73D95A-87CD-4C24-BD63-A7E1EAA24944@apple.com> >> It would be better to split up the "EqualTo" predicate here so that >> there was one for FP and one for integers. When the FP part of this >> lands, you'll want "Unordered" "Equal" and "LessThan" instead of just >> LessThan + Equal. > > Okay, good idea. Could you please review the CF.patch file which is > attached. I think this is what you had in mind. It looks great. However, if possible, it sure would be nice to just nuke the templates :). >> Further, 'lessthan' drops the sign, so the code is apparently wrong. > > I'm not following this. I thought you weren't allowed to do relational > operators on packed type? Are you talking about the ConstantInt case? > This: > static Constant *LessThan(const ConstantInt *V1, const ConstantInt > *V2) { > bool R = (BuiltinType)V1->getZExtValue() < > (BuiltinType)V2->getZExtValue(); > return ConstantBool::get(R); > } Right, but that LessThan predicate (which always evaluates the predicate as unsigned) is also called for slt. This is a bug. >> >> +Constant *llvm::ConstantFoldCompareInstruction( >> + unsigned opcode, Constant *C1, Constant *C2, unsigned short >> predicate) { >> ... >> + case ICmpInst::ICMP_ULT: >> + case ICmpInst::ICMP_SLT: C = ConstRules::get(C1, C2).lessthan >> (C1, >> C2);break; >> + case ICmpInst::ICMP_UGT: >> + case ICmpInst::ICMP_SGT: C = ConstRules::get(C1, C2).lessthan >> (C2, >> C1);break; >> + case ICmpInst::ICMP_ULE: >> + case ICmpInst::ICMP_SLE: // C1 <= C2 === !(C2 < C1) >> + C = ConstRules::get(C1, C2).lessthan(C2, C1); >> + if (C) return ConstantExpr::getNot(C); >> + break; >> + case ICmpInst::ICMP_UGE: >> + case ICmpInst::ICMP_SGE: // C1 >= C2 === !(C1 < C2) >> + C = ConstRules::get(C1, C2).lessthan(C1, C2); >> + if (C) return ConstantExpr::getNot(C); >> + break; >> >> >> These drop the sign of the comparison, which is a serious bug. I'd >> expect this to miscompile things like: >> >> >> %X = iset slt ubyte 0, ubyte 128 >> >> >> ... or whatever the syntax is. > > The LessThan code above for ConstantInt works fine. It extracts the > canonical ZExt form then casts each operand to the correct type before > doing the compare: > bool R = (BuiltinType)V1->getZExtValue() < > (BuiltinType)V2->getZExtValue(); > > I don't see the problem. The code is trying to do a signed less than comparison, you're always doing an unsigned comparison. I will look into 'SETCC InstructionCombining.cpp' next, but not tonight. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061218/457a4a4a/attachment.html From reid at x10sys.com Tue Dec 19 01:41:56 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 01:41:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200612190741.kBJ7fuW8021971@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.117 -> 1.118 --- Log message: Clean up ConstantFoldCastInstruction. --- Diffs of the changes: (+30 -53) ConstantFolding.cpp | 83 ++++++++++++++++++---------------------------------- 1 files changed, 30 insertions(+), 53 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.117 llvm/lib/VMCore/ConstantFolding.cpp:1.118 --- llvm/lib/VMCore/ConstantFolding.cpp:1.117 Mon Dec 18 21:15:47 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Tue Dec 19 01:41:40 2006 @@ -680,66 +680,43 @@ switch (opc) { case Instruction::FPTrunc: case Instruction::FPExt: - return ConstantFP::get(DestTy, cast(V)->getValue()); - case Instruction::FPToUI: { - double dVal = cast(V)->getValue(); - uint64_t iVal = (uint64_t) dVal; - return ConstantIntegral::get(DestTy, iVal); - } - case Instruction::FPToSI: { - double dVal = cast(V)->getValue(); - int64_t iVal = (int64_t) dVal; - return ConstantIntegral::get(DestTy, iVal); - } - case Instruction::IntToPtr: //always treated as unsigned - if (V->isNullValue()) // Is it a FP or Integral null value? + if (const ConstantFP *FPC = dyn_cast(V)) + return ConstantFP::get(DestTy, FPC->getValue()); + return 0; // Can't fold. + case Instruction::FPToUI: + if (const ConstantFP *FPC = dyn_cast(V)) + return ConstantIntegral::get(DestTy,(uint64_t) FPC->getValue()); + return 0; // Can't fold. + case Instruction::FPToSI: + if (const ConstantFP *FPC = dyn_cast(V)) + return ConstantIntegral::get(DestTy,(int64_t) FPC->getValue()); + return 0; // Can't fold. + case Instruction::IntToPtr: //always treated as unsigned + if (V->isNullValue()) // Is it an integral null value? return ConstantPointerNull::get(cast(DestTy)); - return 0; // Other pointer types cannot be casted - case Instruction::PtrToInt: // always treated as unsigned - if (V->isNullValue()) + return 0; // Other pointer types cannot be casted + case Instruction::PtrToInt: // always treated as unsigned + if (V->isNullValue()) // is it a null pointer value? return ConstantIntegral::get(DestTy, 0); - return 0; // Other pointer types cannot be casted - case Instruction::UIToFP: { - // First, extract the unsigned integer value - uint64_t Val; - if (isa(V)) - Val = cast(V)->getZExtValue(); - else if (const ConstantBool *CB = dyn_cast(V)) - Val = CB->getValue() ? 1 : 0; - // Now generate the equivalent floating point value - double dVal = (double) Val; - return ConstantFP::get(DestTy, dVal); - } - case Instruction::SIToFP: { - // First, extract the signed integer value - int64_t Val; - if (isa(V)) - Val = cast(V)->getSExtValue(); - else if (const ConstantBool *CB = dyn_cast(V)) - Val = CB->getValue() ? -1 : 0; - // Now generate the equivalent floating point value - double dVal = (double) Val; - return ConstantFP::get(DestTy, dVal); - } + return 0; // Other pointer types cannot be casted + case Instruction::UIToFP: + if (const ConstantIntegral *CI = dyn_cast(V)) + return ConstantFP::get(DestTy, double(CI->getZExtValue())); + return 0; + case Instruction::SIToFP: + if (const ConstantIntegral *CI = dyn_cast(V)) + return ConstantFP::get(DestTy, double(CI->getSExtValue())); + return 0; case Instruction::ZExt: - // Handle trunc directly here if it is a ConstantIntegral. - if (isa(V)) - return ConstantInt::get(DestTy, cast(V)->getZExtValue()); - else if (const ConstantBool *CB = dyn_cast(V)) - return ConstantInt::get(DestTy, CB->getValue() ? 1 : 0); + if (const ConstantIntegral *CI = dyn_cast(V)) + return ConstantInt::get(DestTy, CI->getZExtValue()); return 0; case Instruction::SExt: - // A SExt always produces a signed value so we need to cast the value - // now before we try to cast it to the destiniation type. - if (isa(V)) - return ConstantInt::get(DestTy, cast(V)->getSExtValue()); - else if (const ConstantBool *CB = dyn_cast(V)) - return ConstantInt::get(DestTy, CB->getValue() ? -1 : 0); + if (const ConstantIntegral *CI = dyn_cast(V)) + return ConstantInt::get(DestTy, CI->getSExtValue()); return 0; case Instruction::Trunc: - // We just handle trunc directly here. The code below doesn't work for - // trunc to bool. - if (const ConstantInt *CI = dyn_cast(V)) + if (const ConstantInt *CI = dyn_cast(V)) // Can't trunc a bool return ConstantIntegral::get(DestTy, CI->getZExtValue()); return 0; case Instruction::BitCast: From asl at math.spbu.ru Tue Dec 19 09:24:33 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 19 Dec 2006 09:24:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/DynamicLibrary.inc Message-ID: <200612191524.kBJFOX7i006716@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: DynamicLibrary.inc updated: 1.17 -> 1.18 --- Log message: Partly fixed JITing on mingw32 platform. The support is not full due to absence of dllimport JIT codegen. --- Diffs of the changes: (+25 -0) DynamicLibrary.inc | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+) Index: llvm/lib/System/Win32/DynamicLibrary.inc diff -u llvm/lib/System/Win32/DynamicLibrary.inc:1.17 llvm/lib/System/Win32/DynamicLibrary.inc:1.18 --- llvm/lib/System/Win32/DynamicLibrary.inc:1.17 Fri Aug 25 16:37:17 2006 +++ llvm/lib/System/Win32/DynamicLibrary.inc Tue Dec 19 09:24:18 2006 @@ -51,7 +51,11 @@ stricmp(ModuleName, "msvcp60") != 0 && stricmp(ModuleName, "msvcp70") != 0 && stricmp(ModuleName, "msvcr70") != 0 && +#ifndef __MINGW32__ + // Mingw32 uses msvcrt.dll by default. Don't ignore it. + // Otherwise, user should be aware, what he's doing :) stricmp(ModuleName, "msvcrt") != 0 && +#endif stricmp(ModuleName, "msvcrt20") != 0 && stricmp(ModuleName, "msvcrt40") != 0) { OpenedHandles.push_back((HMODULE)ModuleBase); @@ -84,6 +88,17 @@ } } +#ifdef __MINGW32__ + #define EXPLICIT_SYMBOL(SYM) \ + if (!strcmp(symbolName, #SYM)) return (void*)&SYM + #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \ + if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO + #define EXPLICIT_SYMBOL_DEF(SYM) \ + extern "C" { extern void *SYM; } + + EXPLICIT_SYMBOL_DEF(_alloca); +#endif + bool DynamicLibrary::LoadLibraryPermanently(const char *filename, std::string *ErrMsg) { if (filename) { @@ -118,6 +133,16 @@ return (void *) ptr; } +#ifdef __MINGW32__ + { + EXPLICIT_SYMBOL(_alloca); + EXPLICIT_SYMBOL2(alloca, _alloca); +#undef EXPLICIT_SYMBOL +#undef EXPLICIT_SYMBOL2 +#undef EXPLICIT_SYMBOL_DEF + } +#endif + return 0; } From clattner at apple.com Tue Dec 19 11:29:36 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 19 Dec 2006 09:29:36 -0800 Subject: [llvm-commits] lvalue VIEW_CONVERT_EXPR support Message-ID: Apparently this is needed for Ada, simple enough: Index: llvm-convert.cpp =================================================================== --- llvm-convert.cpp (revision 121578) +++ llvm-convert.cpp (working copy) @@ -648,6 +648,9 @@ LValue TreeToLLVM::EmitLV(tree exp) { case BIT_FIELD_REF: return EmitLV_BIT_FIELD_REF(exp); case REALPART_EXPR: return EmitLV_XXXXPART_EXPR(exp, 0); case IMAGPART_EXPR: return EmitLV_XXXXPART_EXPR(exp, 1); + case VIEW_CONVERT_EXPR: + // The address of a VIEW_CONVERT_EXPR is the address of its operand. + return EmitLV(TREE_OPERAND(exp, 0)); } } -Chris From sabre at nondot.org Tue Dec 19 13:30:13 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 13:30:13 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-12-19-IntelSyntax.ll Message-ID: <200612191930.kBJJUDSM010758@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: 2006-12-19-IntelSyntax.ll added (r1.1) --- Log message: testcase for pr1061: http://llvm.org/PR1061 --- Diffs of the changes: (+91 -0) 2006-12-19-IntelSyntax.ll | 91 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 91 insertions(+) Index: llvm/test/Regression/CodeGen/X86/2006-12-19-IntelSyntax.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/2006-12-19-IntelSyntax.ll:1.1 *** /dev/null Tue Dec 19 13:30:01 2006 --- llvm/test/Regression/CodeGen/X86/2006-12-19-IntelSyntax.ll Tue Dec 19 13:29:50 2006 *************** *** 0 **** --- 1,91 ---- + ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel + ; PR1061 + + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + + implementation ; Functions: + + void %bar(uint %n) { + entry: + switch uint %n, label %bb12 [ + uint 1, label %bb + uint 2, label %bb6 + uint 4, label %bb7 + uint 5, label %bb8 + uint 6, label %bb10 + uint 7, label %bb1 + uint 8, label %bb3 + uint 9, label %bb4 + uint 10, label %bb9 + uint 11, label %bb2 + uint 12, label %bb5 + uint 13, label %bb11 + ] + + bb: ; preds = %entry + call void (...)* %foo1( ) + ret void + + bb1: ; preds = %entry + call void (...)* %foo2( ) + ret void + + bb2: ; preds = %entry + call void (...)* %foo6( ) + ret void + + bb3: ; preds = %entry + call void (...)* %foo3( ) + ret void + + bb4: ; preds = %entry + call void (...)* %foo4( ) + ret void + + bb5: ; preds = %entry + call void (...)* %foo5( ) + ret void + + bb6: ; preds = %entry + call void (...)* %foo1( ) + ret void + + bb7: ; preds = %entry + call void (...)* %foo2( ) + ret void + + bb8: ; preds = %entry + call void (...)* %foo6( ) + ret void + + bb9: ; preds = %entry + call void (...)* %foo3( ) + ret void + + bb10: ; preds = %entry + call void (...)* %foo4( ) + ret void + + bb11: ; preds = %entry + call void (...)* %foo5( ) + ret void + + bb12: ; preds = %entry + call void (...)* %foo6( ) + ret void + } + + declare void %foo1(...) + + declare void %foo2(...) + + declare void %foo6(...) + + declare void %foo3(...) + + declare void %foo4(...) + + declare void %foo5(...) From sabre at nondot.org Tue Dec 19 13:30:15 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 13:30:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Message-ID: <200612191930.kBJJUFVe010770@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86IntelAsmPrinter.cpp updated: 1.64 -> 1.65 --- Log message: Fix PR1061: http://llvm.org/PR1061 and CodeGen/X86/2006-12-19-IntelSyntax.ll --- Diffs of the changes: (+2 -1) X86IntelAsmPrinter.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.64 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.65 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.64 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Tue Dec 19 13:29:58 2006 @@ -211,7 +211,8 @@ NeedPlus = true; } - if (DispSpec.isGlobalAddress() || DispSpec.isConstantPoolIndex()) { + if (DispSpec.isGlobalAddress() || DispSpec.isConstantPoolIndex() || + DispSpec.isJumpTableIndex()) { if (NeedPlus) O << " + "; printOp(DispSpec, "mem"); From reid at x10sys.com Tue Dec 19 13:30:08 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 13:30:08 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Linker/weakextern.ll Message-ID: <200612191930.kBJJU8Yt010739@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Linker: weakextern.ll updated: 1.1 -> 1.2 --- Log message: Make sure linker output is overwritten so this test can pass multiple times. --- Diffs of the changes: (+1 -2) weakextern.ll | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/test/Regression/Linker/weakextern.ll diff -u llvm/test/Regression/Linker/weakextern.ll:1.1 llvm/test/Regression/Linker/weakextern.ll:1.2 --- llvm/test/Regression/Linker/weakextern.ll:1.1 Fri Dec 15 11:34:37 2006 +++ llvm/test/Regression/Linker/weakextern.ll Tue Dec 19 13:29:50 2006 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s > %t.bc ; RUN: llvm-as < `dirname %s`/testlink1.ll > %t2.bc -; RUN: llvm-link %t.bc %t.bc %t2.bc -o %t1.bc +; RUN: llvm-link %t.bc %t.bc %t2.bc -o %t1.bc -f ; RUN: llvm-dis < %t1.bc |grep "kallsyms_names = extern_weak" && ; RUN: llvm-dis < %t1.bc |grep "MyVar = external global int" && ; RUN: llvm-dis < %t1.bc |grep "Inte = global int" @@ -10,4 +10,3 @@ %Inte = extern_weak global int implementation - From reid at x10sys.com Tue Dec 19 13:31:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 13:31:13 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll Message-ID: <200612191931.kBJJVDP3010814@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2003-05-27-useboolinotherbb.ll updated: 1.3 -> 1.4 --- Log message: This test needs to be upgraded for the FCmpInst patch. --- Diffs of the changes: (+1 -1) 2003-05-27-useboolinotherbb.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll:1.3 llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll:1.4 --- llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll:1.3 Fri Jan 7 16:05:30 2005 +++ llvm/test/Regression/CodeGen/Generic/2003-05-27-useboolinotherbb.ll Tue Dec 19 13:30:58 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o - | llc +; RUN: llvm-upgrade < %s | llvm-as | llc void %QRiterate(double %tmp.212) { From sabre at nondot.org Tue Dec 19 13:40:24 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 13:40:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetMachine.cpp Message-ID: <200612191940.kBJJeOgB011031@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86TargetMachine.cpp updated: 1.130 -> 1.131 --- Log message: The x86-64 target machine should be used for amd64-* target triples. --- Diffs of the changes: (+5 -0) X86TargetMachine.cpp | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.130 llvm/lib/Target/X86/X86TargetMachine.cpp:1.131 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.130 Tue Dec 5 13:50:18 2006 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Tue Dec 19 13:40:09 2006 @@ -80,6 +80,11 @@ TT[3] == '_' && TT[4] == '6' && TT[5] == '4' && TT[6] == '-') return 20; + // We strongly match "amd64-*". + if (TT.size() >= 6 && TT[0] == 'a' && TT[1] == 'm' && TT[2] == 'd' && + TT[3] == '6' && TT[4] == '4' && TT[5] == '-') + return 20; + if (M.getEndianness() == Module::LittleEndian && M.getPointerSize() == Module::Pointer64) return 10; // Weak match From dpatel at apple.com Tue Dec 19 13:47:16 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 19 Dec 2006 13:47:16 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200612191947.kBJJlGMo011197@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.36 -> 1.37 --- Log message: s/BasicBlockPassManager/BBPassManager/g s/ModulePassManager/MPPassManager/g s/FunctionPassManagerImpl_New/FunctionPassManagerImpl/g s/PassManagerImpl_New/PassManagerImpl/g Introduce FPPassManager to manage function passes and BBPassManagers. Now FunctionPassManagerImpl is an implementation class used by externally visible FunctionPassManager to manage FPPassManagers. Module pass manager (MPPassManager) now manages FPPassManagers and ModulePasses. --- Diffs of the changes: (+4 -4) PassManager.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.36 llvm/include/llvm/PassManager.h:1.37 --- llvm/include/llvm/PassManager.h:1.36 Tue Dec 12 20:36:01 2006 +++ llvm/include/llvm/PassManager.h Tue Dec 19 13:46:59 2006 @@ -93,8 +93,8 @@ #else class ModulePassManager; -class PassManagerImpl_New; -class FunctionPassManagerImpl_New; +class PassManagerImpl; +class FunctionPassManagerImpl; /// PassManager manages ModulePassManagers class PassManager { @@ -118,7 +118,7 @@ /// PassManagerImpl_New is the actual class. PassManager is just the /// wraper to publish simple pass manager interface - PassManagerImpl_New *PM; + PassManagerImpl *PM; }; @@ -151,7 +151,7 @@ bool doFinalization(); private: - FunctionPassManagerImpl_New *FPM; + FunctionPassManagerImpl *FPM; ModuleProvider *MP; }; From dpatel at apple.com Tue Dec 19 13:47:14 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 19 Dec 2006 13:47:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612191947.kBJJlE5N011188@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.107 -> 1.108 --- Log message: s/BasicBlockPassManager/BBPassManager/g s/ModulePassManager/MPPassManager/g s/FunctionPassManagerImpl_New/FunctionPassManagerImpl/g s/PassManagerImpl_New/PassManagerImpl/g Introduce FPPassManager to manage function passes and BBPassManagers. Now FunctionPassManagerImpl is an implementation class used by externally visible FunctionPassManager to manage FPPassManagers. Module pass manager (MPPassManager) now manages FPPassManagers and ModulePasses. --- Diffs of the changes: (+230 -138) PassManager.cpp | 368 +++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 230 insertions(+), 138 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.107 llvm/lib/VMCore/PassManager.cpp:1.108 --- llvm/lib/VMCore/PassManager.cpp:1.107 Fri Dec 15 18:56:26 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 19 13:46:59 2006 @@ -36,7 +36,7 @@ // information before it is consumed by another pass. // // Pass Manager Infrastructure uses multiple pass managers. They are -// PassManager, FunctionPassManager, ModulePassManager, BasicBlockPassManager. +// PassManager, FunctionPassManager, MPPassManager, FPPassManager, BBPassManager. // This class hierarcy uses multiple inheritance but pass managers do not derive // from another pass manager. // @@ -58,9 +58,9 @@ // a place to implement common pass manager APIs. All pass managers derive from // PMDataManager. // -// [o] class BasicBlockPassManager : public FunctionPass, public PMDataManager; +// [o] class BBPassManager : public FunctionPass, public PMDataManager; // -// BasicBlockPassManager manages BasicBlockPasses. +// BBPassManager manages BasicBlockPasses. // // [o] class FunctionPassManager; // @@ -70,12 +70,15 @@ // [o] class FunctionPassManagerImpl : public ModulePass, PMDataManager, // public PMTopLevelManager; // -// FunctionPassManagerImpl is a top level manager. It manages FunctionPasses -// and BasicBlockPassManagers. +// FunctionPassManagerImpl is a top level manager. It manages FPPassManagers // -// [o] class ModulePassManager : public Pass, public PMDataManager; +// [o] class FPPassManager : public ModulePass, public PMDataManager; // -// ModulePassManager manages ModulePasses and FunctionPassManagerImpls. +// FPPassManager manages FunctionPasses and BBPassManagers +// +// [o] class MPPassManager : public Pass, public PMDataManager; +// +// MPPassManager manages ModulePasses and FPPassManagers // // [o] class PassManager; // @@ -86,7 +89,7 @@ // public PMDTopLevelManager // // PassManagerImpl is a top level pass manager responsible for managing -// ModulePassManagers. +// MPPassManagers. //===----------------------------------------------------------------------===// namespace llvm { @@ -126,12 +129,8 @@ class VISIBILITY_HIDDEN PMTopLevelManager { public: - inline std::vector::iterator passManagersBegin() { - return PassManagers.begin(); - } - - inline std::vector::iterator passManagersEnd() { - return PassManagers.end(); + virtual unsigned getNumContainedManagers() { + return PassManagers.size(); } /// Schedule pass P for execution. Make sure that passes required by @@ -194,11 +193,13 @@ void dumpPasses() const; void dumpArguments() const; -private: +protected: /// Collection of pass managers std::vector PassManagers; +private: + /// Collection of pass managers that are not directly maintained /// by this pass manager std::vector IndirectPassManagers; @@ -318,16 +319,16 @@ }; //===----------------------------------------------------------------------===// -// BasicBlockPassManager +// BBPassManager // -/// BasicBlockPassManager manages BasicBlockPass. It batches all the +/// BBPassManager manages BasicBlockPass. It batches all the /// pass together and sequence them to process one basic block before /// processing next basic block. -class VISIBILITY_HIDDEN BasicBlockPassManager : public PMDataManager, - public FunctionPass { +class VISIBILITY_HIDDEN BBPassManager : public PMDataManager, + public FunctionPass { public: - BasicBlockPassManager(int Depth) : PMDataManager(Depth) { } + BBPassManager(int Depth) : PMDataManager(Depth) { } /// Add a pass into a passmanager queue. bool addPass(Pass *p); @@ -364,55 +365,27 @@ }; //===----------------------------------------------------------------------===// -// FunctionPassManagerImpl_New +// FPPassManager // -/// FunctionPassManagerImpl_New manages FunctionPasses and -/// BasicBlockPassManagers. It batches all function passes and basic block pass -/// managers together and sequence them to process one function at a time before -/// processing next function. -class FunctionPassManagerImpl_New : public ModulePass, - public PMDataManager, - public PMTopLevelManager { -public: - FunctionPassManagerImpl_New(int Depth) : PMDataManager(Depth) { - activeBBPassManager = NULL; - } - ~FunctionPassManagerImpl_New() { /* TODO */ }; - - inline void addTopLevelPass(Pass *P) { - - if (ImmutablePass *IP = dynamic_cast (P)) { +/// FPPassManager manages BBPassManagers and FunctionPasses. +/// It batches all function passes and basic block pass managers together and +/// sequence them to process one function at a time before processing next +/// function. - // P is a immutable pass then it will be managed by this - // top level manager. Set up analysis resolver to connect them. - AnalysisResolver_New *AR = new AnalysisResolver_New(*this); - P->setResolver(AR); - initializeAnalysisImpl(P); - addImmutablePass(IP); - recordAvailableAnalysis(IP); - } - else - addPass(P); - } - - /// add - Add a pass to the queue of passes to run. This passes - /// ownership of the Pass to the PassManager. When the - /// PassManager_X is destroyed, the pass will be destroyed as well, so - /// there is no need to delete the pass. (TODO delete passes.) - /// This implies that all passes MUST be allocated with 'new'. - void add(Pass *P) { - schedulePass(P); +class FPPassManager : public ModulePass, public PMDataManager { + +public: + FPPassManager(int Depth) : PMDataManager(Depth) { + activeBBPassManager = NULL; } - - /// Add pass into the pass manager queue. - bool addPass(Pass *P); - - /// Execute all of the passes scheduled for execution. Keep - /// track of whether any of the passes modifies the function, and if - /// so, return true. - bool runOnModule(Module &M); + + /// Add a pass into a passmanager queue. + bool addPass(Pass *p); + + /// run - Execute all of the passes scheduled for execution. Keep track of + /// whether any of the passes modifies the module, and if so, return true. bool runOnFunction(Function &F); - bool run(Function &F); + bool runOnModule(Module &M); /// doInitialization - Run all of the initializers for the function passes. /// @@ -429,7 +402,7 @@ // Print passes managed by this manager void dumpPassStructure(unsigned Offset) { - llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager 42\n"; + llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager\n"; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { FunctionPass *FP = getContainedPass(Index); FP->dumpPassStructure(Offset + 1); @@ -444,20 +417,90 @@ } private: - // Active Pass Managers - BasicBlockPassManager *activeBBPassManager; + // Active Pass Manager + BBPassManager *activeBBPassManager; +}; + +//===----------------------------------------------------------------------===// +// FunctionPassManagerImpl +// +/// FunctionPassManagerImpl manages FPPassManagers +class FunctionPassManagerImpl : public Pass, + public PMDataManager, + public PMTopLevelManager { + +public: + + FunctionPassManagerImpl(int Depth) : PMDataManager(Depth) { + activeManager = NULL; + } + + /// add - Add a pass to the queue of passes to run. This passes ownership of + /// the Pass to the PassManager. When the PassManager is destroyed, the pass + /// will be destroyed as well, so there is no need to delete the pass. This + /// implies that all passes MUST be allocated with 'new'. + void add(Pass *P) { + schedulePass(P); + } + + /// run - Execute all of the passes scheduled for execution. Keep track of + /// whether any of the passes modifies the module, and if so, return true. + bool run(Function &F); + + /// doInitialization - Run all of the initializers for the function passes. + /// + bool doInitialization(Module &M); + + /// doFinalization - Run all of the initializers for the function passes. + /// + bool doFinalization(Module &M); + + /// Pass Manager itself does not invalidate any analysis info. + void getAnalysisUsage(AnalysisUsage &Info) const { + Info.setPreservesAll(); + } + + inline void addTopLevelPass(Pass *P) { + + if (ImmutablePass *IP = dynamic_cast (P)) { + + // P is a immutable pass and it will be managed by this + // top level manager. Set up analysis resolver to connect them. + AnalysisResolver_New *AR = new AnalysisResolver_New(*this); + P->setResolver(AR); + initializeAnalysisImpl(P); + addImmutablePass(IP); + recordAvailableAnalysis(IP); + } + else + addPass(P); + } + + FPPassManager *getContainedManager(unsigned N) { + assert ( N < PassManagers.size() && "Pass number out of range!"); + FPPassManager *FP = static_cast(PassManagers[N]); + return FP; + } + + /// Add a pass into a passmanager queue. + bool addPass(Pass *p); + +private: + + // Active Pass Manager + FPPassManager *activeManager; }; //===----------------------------------------------------------------------===// -// ModulePassManager +// MPPassManager // -/// ModulePassManager manages ModulePasses and function pass managers. +/// MPPassManager manages ModulePasses and function pass managers. /// It batches all Module passes passes and function pass managers together and /// sequence them to process one module. -class ModulePassManager : public Pass, public PMDataManager { +class MPPassManager : public Pass, public PMDataManager { public: - ModulePassManager(int Depth) : PMDataManager(Depth) { + MPPassManager(int Depth) : PMDataManager(Depth) { activeFunctionPassManager = NULL; } @@ -491,20 +534,20 @@ private: // Active Pass Manager - FunctionPassManagerImpl_New *activeFunctionPassManager; + FPPassManager *activeFunctionPassManager; }; //===----------------------------------------------------------------------===// -// PassManagerImpl_New +// PassManagerImpl // -/// PassManagerImpl_New manages ModulePassManagers -class PassManagerImpl_New : public Pass, +/// PassManagerImpl manages MPPassManagers +class PassManagerImpl : public Pass, public PMDataManager, public PMTopLevelManager { public: - PassManagerImpl_New(int Depth) : PMDataManager(Depth) { + PassManagerImpl(int Depth) : PMDataManager(Depth) { activeManager = NULL; } @@ -541,13 +584,19 @@ addPass(P); } + MPPassManager *getContainedManager(unsigned N) { + assert ( N < PassManagers.size() && "Pass number out of range!"); + MPPassManager *MP = static_cast(PassManagers[N]); + return MP; + } + private: /// Add a pass into a passmanager queue. bool addPass(Pass *p); // Active Pass Manager - ModulePassManager *activeManager; + MPPassManager *activeManager; }; } // End of llvm namespace @@ -700,6 +749,9 @@ // Print passes managed by this top level manager. void PMTopLevelManager::dumpPasses() const { + if (PassDebugging_New < Structure) + return; + // Print out the immutable passes for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) { ImmutablePasses[i]->dumpPassStructure(0); @@ -972,12 +1024,12 @@ } //===----------------------------------------------------------------------===// -// BasicBlockPassManager implementation +// BBPassManager implementation /// Add pass P into PassVector and return true. If this pass is not /// manageable by this manager then return false. bool -BasicBlockPassManager::addPass(Pass *P) { +BBPassManager::addPass(Pass *P) { BasicBlockPass *BP = dynamic_cast(P); if (!BP) @@ -997,7 +1049,7 @@ /// runOnBasicBlock method. Keep track of whether any of the passes modifies /// the function, and if so, return true. bool -BasicBlockPassManager::runOnFunction(Function &F) { +BBPassManager::runOnFunction(Function &F) { if (F.isExternal()) return false; @@ -1036,7 +1088,7 @@ } // Implement doInitialization and doFinalization -inline bool BasicBlockPassManager::doInitialization(Module &M) { +inline bool BBPassManager::doInitialization(Module &M) { bool Changed = false; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { @@ -1047,7 +1099,7 @@ return Changed; } -inline bool BasicBlockPassManager::doFinalization(Module &M) { +inline bool BBPassManager::doFinalization(Module &M) { bool Changed = false; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { @@ -1058,7 +1110,7 @@ return Changed; } -inline bool BasicBlockPassManager::doInitialization(Function &F) { +inline bool BBPassManager::doInitialization(Function &F) { bool Changed = false; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { @@ -1069,7 +1121,7 @@ return Changed; } -inline bool BasicBlockPassManager::doFinalization(Function &F) { +inline bool BBPassManager::doFinalization(Function &F) { bool Changed = false; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { @@ -1086,7 +1138,7 @@ /// Create new Function pass manager FunctionPassManager::FunctionPassManager(ModuleProvider *P) { - FPM = new FunctionPassManagerImpl_New(0); + FPM = new FunctionPassManagerImpl(0); // FPM is the top level manager. FPM->setTopLevelManager(FPM); @@ -1094,7 +1146,6 @@ AnalysisResolver_New *AR = new AnalysisResolver_New(*PMD); FPM->setResolver(AR); - FPM->addPassManager(FPM); MP = P; } @@ -1145,15 +1196,78 @@ } //===----------------------------------------------------------------------===// -// FunctionPassManagerImpl_New implementation +// FunctionPassManagerImpl implementation +// +/// Add P into active pass manager or use new module pass manager to +/// manage it. +bool FunctionPassManagerImpl::addPass(Pass *P) { + + if (!activeManager || !activeManager->addPass(P)) { + activeManager = new FPPassManager(getDepth() + 1); + // Inherit top level manager + activeManager->setTopLevelManager(this->getTopLevelManager()); + + // This top level manager is going to manage activeManager. + // Set up analysis resolver to connect them. + AnalysisResolver_New *AR = new AnalysisResolver_New(*this); + activeManager->setResolver(AR); + + addPassManager(activeManager); + return activeManager->addPass(P); + } + return true; +} + +inline bool FunctionPassManagerImpl::doInitialization(Module &M) { + bool Changed = false; + + for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) { + FPPassManager *FP = getContainedManager(Index); + Changed |= FP->doInitialization(M); + } + + return Changed; +} + +inline bool FunctionPassManagerImpl::doFinalization(Module &M) { + bool Changed = false; + + for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) { + FPPassManager *FP = getContainedManager(Index); + Changed |= FP->doFinalization(M); + } + + return Changed; +} + +// Execute all the passes managed by this top level manager. +// Return true if any function is modified by a pass. +bool FunctionPassManagerImpl::run(Function &F) { + + bool Changed = false; + + TimingInfo::createTheTimeInfo(); + + dumpArguments(); + dumpPasses(); + + for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) { + FPPassManager *FP = getContainedManager(Index); + Changed |= FP->runOnFunction(F); + } + return Changed; +} + +//===----------------------------------------------------------------------===// +// FPPassManager implementation /// Add pass P into the pass manager queue. If P is a BasicBlockPass then /// either use it into active basic block pass manager or create new basic /// block pass manager to handle pass P. bool -FunctionPassManagerImpl_New::addPass(Pass *P) { +FPPassManager::addPass(Pass *P) { - // If P is a BasicBlockPass then use BasicBlockPassManager. + // If P is a BasicBlockPass then use BBPassManager. if (BasicBlockPass *BP = dynamic_cast(P)) { if (!activeBBPassManager || !activeBBPassManager->addPass(BP)) { @@ -1163,8 +1277,7 @@ activeBBPassManager->initializeAnalysisInfo(); // Create and add new manager - activeBBPassManager = - new BasicBlockPassManager(getDepth() + 1); + activeBBPassManager = new BBPassManager(getDepth() + 1); // Inherit top level manager activeBBPassManager->setTopLevelManager(this->getTopLevelManager()); @@ -1187,7 +1300,6 @@ } - return true; } @@ -1214,21 +1326,7 @@ /// Execute all of the passes scheduled for execution by invoking /// runOnFunction method. Keep track of whether any of the passes modifies /// the function, and if so, return true. -bool FunctionPassManagerImpl_New::runOnModule(Module &M) { - - bool Changed = doInitialization(M); - initializeAnalysisInfo(); - - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - this->runOnFunction(*I); - - return Changed |= doFinalization(M); -} - -/// Execute all of the passes scheduled for execution by invoking -/// runOnFunction method. Keep track of whether any of the passes modifies -/// the function, and if so, return true. -bool FunctionPassManagerImpl_New::runOnFunction(Function &F) { +bool FPPassManager::runOnFunction(Function &F) { bool Changed = false; @@ -1267,8 +1365,18 @@ return Changed; } +bool FPPassManager::runOnModule(Module &M) { -inline bool FunctionPassManagerImpl_New::doInitialization(Module &M) { + bool Changed = doInitialization(M); + initializeAnalysisInfo(); + + for(Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + this->runOnFunction(*I); + + return Changed |= doFinalization(M); +} + +inline bool FPPassManager::doInitialization(Module &M) { bool Changed = false; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { @@ -1279,7 +1387,7 @@ return Changed; } -inline bool FunctionPassManagerImpl_New::doFinalization(Module &M) { +inline bool FPPassManager::doFinalization(Module &M) { bool Changed = false; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { @@ -1290,28 +1398,14 @@ return Changed; } -// Execute all the passes managed by this top level manager. -// Return true if any function is modified by a pass. -bool FunctionPassManagerImpl_New::run(Function &F) { - - bool Changed = false; - for (std::vector::iterator I = passManagersBegin(), - E = passManagersEnd(); I != E; ++I) { - FunctionPassManagerImpl_New *FP = - dynamic_cast(*I); - Changed |= FP->runOnFunction(F); - } - return Changed; -} - //===----------------------------------------------------------------------===// -// ModulePassManager implementation +// MPPassManager implementation /// Add P into pass vector if it is manageble. If P is a FunctionPass -/// then use FunctionPassManagerImpl_New to manage it. Return false if P +/// then use FPPassManager to manage it. Return false if P /// is not manageable by this manager. bool -ModulePassManager::addPass(Pass *P) { +MPPassManager::addPass(Pass *P) { // If P is FunctionPass then use function pass maanager. if (FunctionPass *FP = dynamic_cast(P)) { @@ -1324,7 +1418,7 @@ // Create and add new manager activeFunctionPassManager = - new FunctionPassManagerImpl_New(getDepth() + 1); + new FPPassManager(getDepth() + 1); // Add new manager into current manager's list addPassToManager(activeFunctionPassManager, false); @@ -1377,7 +1471,7 @@ /// runOnModule method. Keep track of whether any of the passes modifies /// the module, and if so, return true. bool -ModulePassManager::runOnModule(Module &M) { +MPPassManager::runOnModule(Module &M) { bool Changed = false; initializeAnalysisInfo(); @@ -1416,10 +1510,10 @@ // /// Add P into active pass manager or use new module pass manager to /// manage it. -bool PassManagerImpl_New::addPass(Pass *P) { +bool PassManagerImpl::addPass(Pass *P) { if (!activeManager || !activeManager->addPass(P)) { - activeManager = new ModulePassManager(getDepth() + 1); + activeManager = new MPPassManager(getDepth() + 1); // Inherit top level manager activeManager->setTopLevelManager(this->getTopLevelManager()); @@ -1436,19 +1530,17 @@ /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. -bool PassManagerImpl_New::run(Module &M) { +bool PassManagerImpl::run(Module &M) { bool Changed = false; TimingInfo::createTheTimeInfo(); dumpArguments(); - if (PassDebugging_New >= Structure) - dumpPasses(); + dumpPasses(); - for (std::vector::iterator I = passManagersBegin(), - E = passManagersEnd(); I != E; ++I) { - ModulePassManager *MP = dynamic_cast(*I); + for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) { + MPPassManager *MP = getContainedManager(Index); Changed |= MP->runOnModule(M); } return Changed; @@ -1459,7 +1551,7 @@ /// Create new pass manager PassManager::PassManager() { - PM = new PassManagerImpl_New(0); + PM = new PassManagerImpl(0); // PM is the top level manager PM->setTopLevelManager(PM); } From reid at x10sys.com Tue Dec 19 13:47:34 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 13:47:34 -0600 Subject: [llvm-commits] CVS: llvm/docs/ProgrammersManual.html Message-ID: <200612191947.kBJJlYrc011265@zion.cs.uiuc.edu> Changes in directory llvm/docs: ProgrammersManual.html updated: 1.96 -> 1.97 --- Log message: Make changes for removal of SETCC instruction to unify with LangRef.html. --- Diffs of the changes: (+26 -3) ProgrammersManual.html | 29 ++++++++++++++++++++++++++--- 1 files changed, 26 insertions(+), 3 deletions(-) Index: llvm/docs/ProgrammersManual.html diff -u llvm/docs/ProgrammersManual.html:1.96 llvm/docs/ProgrammersManual.html:1.97 --- llvm/docs/ProgrammersManual.html:1.96 Thu Dec 7 14:04:41 2006 +++ llvm/docs/ProgrammersManual.html Tue Dec 19 13:47:19 2006 @@ -1851,10 +1851,10 @@ the Instruction class is the llvm/Instruction.def file. This file contains some meta-data about the various different types of instructions in LLVM. It describes the enum values that are used as opcodes (for example -Instruction::Add and Instruction::SetLE), as well as the +Instruction::Add and Instruction::ICmp), as well as the concrete sub-classes of Instruction that implement the instruction (for example BinaryOperator and SetCondInst). Unfortunately, the use of macros in +href="#CmpInst">CmpInst). Unfortunately, the use of macros in this file confuses doxygen, so these enum values don't show up correctly in the doxygen output.

@@ -1862,6 +1862,29 @@ +
+
    +
  • BinaryOperator +

    This subclasses represents all two operand instructions whose operands + must be the same type, except for the comparison instructions.

  • +
  • CastInst +

    This subclass is the parent of the 12 casting instructions. It provides + common operations on cast instructions.

    +
  • CmpInst +

    This subclass respresents the two comparison instructions, + ICmpInst (integer opreands), and + FCmpInst (floating point operands).

    +
  • TerminatorInst +

    This subclass is the parent of all terminator instructions (those which + can terminate a block).

    +
+
+ + + @@ -2554,7 +2577,7 @@ Dinakar Dhurjati and Chris Lattner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2006/12/07 20:04:41 $ + Last modified: $Date: 2006/12/19 19:47:19 $ From reid at x10sys.com Tue Dec 19 13:48:09 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 13:48:09 -0600 Subject: [llvm-commits] CVS: llvm/docs/Stacker.html Message-ID: <200612191948.kBJJm9Z8011338@zion.cs.uiuc.edu> Changes in directory llvm/docs: Stacker.html updated: 1.21 -> 1.22 --- Log message: Fix an example that used the old SetCondInst instruction. --- Diffs of the changes: (+2 -2) Stacker.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/docs/Stacker.html diff -u llvm/docs/Stacker.html:1.21 llvm/docs/Stacker.html:1.22 --- llvm/docs/Stacker.html:1.21 Fri Oct 20 02:07:23 2006 +++ llvm/docs/Stacker.html Tue Dec 19 13:47:54 2006 @@ -229,7 +229,7 @@
 using namespace llvm;
 BasicBlock*
-MyCompiler::handle_if( BasicBlock* bb, SetCondInst* condition )
+MyCompiler::handle_if( BasicBlock* bb, ICmpInst* condition )
 {
     // Create the blocks to contain code in the structure of if/then/else
     BasicBlock* then_bb = new BasicBlock(); 
@@ -1405,7 +1405,7 @@
 
   Reid Spencer
LLVM Compiler Infrastructure
- Last modified: $Date: 2006/10/20 07:07:23 $ + Last modified: $Date: 2006/12/19 19:47:54 $ From reid at x10sys.com Tue Dec 19 13:50:46 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 13:50:46 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll Message-ID: <200612191950.kBJJokjx011396@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2003-05-27-usefsubasbool.ll updated: 1.3 -> 1.4 --- Log message: This test needs to be upgraded for the forthcoming FCmpInst patch. --- Diffs of the changes: (+1 -1) 2003-05-27-usefsubasbool.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll diff -u llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll:1.3 llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll:1.4 --- llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll:1.3 Fri Jan 7 16:05:30 2005 +++ llvm/test/Regression/CodeGen/Generic/2003-05-27-usefsubasbool.ll Tue Dec 19 13:50:30 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o - | llc +; RUN: llvm-upgrade < %s | llvm-as | llc void %QRiterate(double %tmp.212) { entry: ; No predecessors! From reid at x10sys.com Tue Dec 19 13:55:33 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 13:55:33 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/ExecutionEngine/2003-01-10-FUCOM.ll test-constantexpr.ll test-setcond-fp.ll Message-ID: <200612191955.kBJJtXMS011501@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/ExecutionEngine: 2003-01-10-FUCOM.ll updated: 1.2 -> 1.3 test-constantexpr.ll updated: 1.3 -> 1.4 test-setcond-fp.ll updated: 1.3 -> 1.4 --- Log message: For PR950: http://llvm.org/PR950 : Test needs to be upgraded for the forthcoming FCmpInst patch. --- Diffs of the changes: (+3 -3) 2003-01-10-FUCOM.ll | 2 +- test-constantexpr.ll | 2 +- test-setcond-fp.ll | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/test/Regression/ExecutionEngine/2003-01-10-FUCOM.ll diff -u llvm/test/Regression/ExecutionEngine/2003-01-10-FUCOM.ll:1.2 llvm/test/Regression/ExecutionEngine/2003-01-10-FUCOM.ll:1.3 --- llvm/test/Regression/ExecutionEngine/2003-01-10-FUCOM.ll:1.2 Sat Nov 6 17:32:43 2004 +++ llvm/test/Regression/ExecutionEngine/2003-01-10-FUCOM.ll Tue Dec 19 13:55:17 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o %t.bc +; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc ; RUN: lli %t.bc > /dev/null Index: llvm/test/Regression/ExecutionEngine/test-constantexpr.ll diff -u llvm/test/Regression/ExecutionEngine/test-constantexpr.ll:1.3 llvm/test/Regression/ExecutionEngine/test-constantexpr.ll:1.4 --- llvm/test/Regression/ExecutionEngine/test-constantexpr.ll:1.3 Sun Feb 27 00:14:21 2005 +++ llvm/test/Regression/ExecutionEngine/test-constantexpr.ll Tue Dec 19 13:55:17 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o %t.bc +; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc ; RUN: lli %t.bc > /dev/null ; This tests to make sure that we can evaluate weird constant expressions Index: llvm/test/Regression/ExecutionEngine/test-setcond-fp.ll diff -u llvm/test/Regression/ExecutionEngine/test-setcond-fp.ll:1.3 llvm/test/Regression/ExecutionEngine/test-setcond-fp.ll:1.4 --- llvm/test/Regression/ExecutionEngine/test-setcond-fp.ll:1.3 Sat Nov 6 17:32:43 2004 +++ llvm/test/Regression/ExecutionEngine/test-setcond-fp.ll Tue Dec 19 13:55:17 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as -f %s -o %t.bc +; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc ; RUN: lli %t.bc > /dev/null From isanbard at gmail.com Tue Dec 19 14:01:39 2006 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 19 Dec 2006 12:01:39 -0800 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h In-Reply-To: <200612191947.kBJJlGMo011197@zion.cs.uiuc.edu> References: <200612191947.kBJJlGMo011197@zion.cs.uiuc.edu> Message-ID: <16e5fdf90612191201ub8531f3qfa0ca9310cdbb643@mail.gmail.com> On 12/19/06, Devang Patel wrote: > > > Changes in directory llvm/include/llvm: > > PassManager.h updated: 1.36 -> 1.37 > --- > Log message: > > s/BasicBlockPassManager/BBPassManager/g > s/ModulePassManager/MPPassManager/g > Why these name changes? LLVM seems to enjoy longer, more descriptive names than abbreviations. Just curious. -bw From dpatel at apple.com Tue Dec 19 14:05:26 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 19 Dec 2006 12:05:26 -0800 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h In-Reply-To: <16e5fdf90612191201ub8531f3qfa0ca9310cdbb643@mail.gmail.com> References: <200612191947.kBJJlGMo011197@zion.cs.uiuc.edu> <16e5fdf90612191201ub8531f3qfa0ca9310cdbb643@mail.gmail.com> Message-ID: On Dec 19, 2006, at 12:01 PM, Bill Wendling wrote: > On 12/19/06, Devang Patel wrote: >> >> >> Changes in directory llvm/include/llvm: >> >> PassManager.h updated: 1.36 -> 1.37 >> --- >> Log message: >> >> s/BasicBlockPassManager/BBPassManager/g >> s/ModulePassManager/MPPassManager/g >> > Why these name changes? LLVM seems to enjoy longer, more descriptive > names than abbreviations. We had FunctionPassManager and FunctionPassManagerImpl. And I needed another pass manager to manage FunctionPasses. So I used FPPassManager name. So, now FunctionPassManager and PassManager are externally visible managers. FunctionPassManagerImpl and PassManagerImpl provides implementation support for these two externally visible managers. And, BBPassManager, FPPassManager and MPPassManagers are internal managers used to implement pass manager infrastructure. Here, I thought, it would be confusing to use BasicBlockPassManager name. Because it may imply that it is at the same level as FunctionPassManager (the one that is externally visible in PassManager.h). - Devang From isanbard at gmail.com Tue Dec 19 14:11:00 2006 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 19 Dec 2006 12:11:00 -0800 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h In-Reply-To: References: <200612191947.kBJJlGMo011197@zion.cs.uiuc.edu> <16e5fdf90612191201ub8531f3qfa0ca9310cdbb643@mail.gmail.com> Message-ID: <16e5fdf90612191211r2b283c24l30fdaf3b8708d62e@mail.gmail.com> On 12/19/06, Devang Patel wrote: > > On Dec 19, 2006, at 12:01 PM, Bill Wendling wrote: > > > On 12/19/06, Devang Patel wrote: > >> > >> > >> Changes in directory llvm/include/llvm: > >> > >> PassManager.h updated: 1.36 -> 1.37 > >> --- > >> Log message: > >> > >> s/BasicBlockPassManager/BBPassManager/g > >> s/ModulePassManager/MPPassManager/g > >> > > Why these name changes? LLVM seems to enjoy longer, more descriptive > > names than abbreviations. > > We had FunctionPassManager and FunctionPassManagerImpl. > And I needed another pass manager to manage FunctionPasses. So I used > FPPassManager name. > > So, now > > FunctionPassManager and PassManager are externally visible managers. > > FunctionPassManagerImpl and PassManagerImpl provides implementation > support for these two externally visible managers. > > And, BBPassManager, FPPassManager and MPPassManagers are internal > managers used to implement pass manager infrastructure. Here, I thought, > it would be confusing to use BasicBlockPassManager name. Because it may > imply that it is at the same level as FunctionPassManager (the one > that is > externally visible in PassManager.h). > Ah! Okay. Would having something like the "Impl" suffix work? Maybe something like "Internal"? I don't have any real objections to using abbreviations. I was mostly just curious. I'll leave it to your better judgement. -bw From dpatel at apple.com Tue Dec 19 14:12:54 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 19 Dec 2006 14:12:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612192012.kBJKCsJx011950@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.108 -> 1.109 --- Log message: Now, there is additional layer, referred in the comment, in place to handle this correctly. --- Diffs of the changes: (+0 -11) PassManager.cpp | 11 ----------- 1 files changed, 11 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.108 llvm/lib/VMCore/PassManager.cpp:1.109 --- llvm/lib/VMCore/PassManager.cpp:1.108 Tue Dec 19 13:46:59 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 19 14:12:38 2006 @@ -153,10 +153,6 @@ /// then return NULL. Pass *findAnalysisPass(AnalysisID AID); - inline void clearManagers() { - PassManagers.clear(); - } - virtual ~PMTopLevelManager() { for (std::vector::iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) @@ -1150,13 +1146,6 @@ } FunctionPassManager::~FunctionPassManager() { - // Note : FPM maintains one entry in PassManagers vector. - // This one entry is FPM itself. This is not ideal. One - // alternative is have one additional layer between - // FunctionPassManager and FunctionPassManagerImpl. - // Meanwhile, to avoid going into infinte loop, first - // remove FPM from its PassMangers vector. - FPM->clearManagers(); delete FPM; } From asl at math.spbu.ru Tue Dec 19 15:04:36 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 19 Dec 2006 15:04:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200612192104.kBJL4acW012772@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.126 -> 1.127 --- Log message: Fix for PR1059: http://llvm.org/PR1059 : http://llvm.org/PR1059: http://llvm.org/PR1059 --- Diffs of the changes: (+6 -3) AsmPrinter.cpp | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.126 llvm/lib/CodeGen/AsmPrinter.cpp:1.127 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.126 Sun Dec 17 21:37:18 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Tue Dec 19 15:04:20 2006 @@ -214,14 +214,17 @@ // Pick the directive to use to print the jump table entries, and switch to // the appropriate section. TargetLowering *LoweringInfo = TM.getTargetLowering(); - - if (IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) { + + const char* JumpTableDataSection = TAI->getJumpTableDataSection(); + if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) || + !JumpTableDataSection) { // In PIC mode, we need to emit the jump table to the same section as the // function body itself, otherwise the label differences won't make sense. + // We should also do if the section name is NULL. const Function *F = MF.getFunction(); SwitchToTextSection(getSectionForFunction(*F).c_str(), F); } else { - SwitchToDataSection(TAI->getJumpTableDataSection()); + SwitchToDataSection(JumpTableDataSection); } EmitAlignment(Log2_32(MJTI->getAlignment())); From asl at math.spbu.ru Tue Dec 19 15:04:37 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 19 Dec 2006 15:04:37 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp X86TargetAsmInfo.cpp Message-ID: <200612192104.kBJL4bdS012779@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86IntelAsmPrinter.cpp updated: 1.65 -> 1.66 X86TargetAsmInfo.cpp updated: 1.12 -> 1.13 --- Log message: Fix for PR1059: http://llvm.org/PR1059 : http://llvm.org/PR1059: http://llvm.org/PR1059 --- Diffs of the changes: (+10 -2) X86IntelAsmPrinter.cpp | 11 +++++++++-- X86TargetAsmInfo.cpp | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.65 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.66 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.65 Tue Dec 19 13:29:58 2006 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Tue Dec 19 15:04:20 2006 @@ -113,7 +113,7 @@ const char *Modifier) { const MRegisterInfo &RI = *TM.getRegisterInfo(); switch (MO.getType()) { - case MachineOperand::MO_Register: + case MachineOperand::MO_Register: { if (MRegisterInfo::isPhysicalRegister(MO.getReg())) { unsigned Reg = MO.getReg(); if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) { @@ -126,13 +126,20 @@ } else O << "reg" << MO.getReg(); return; - + } case MachineOperand::MO_Immediate: O << MO.getImmedValue(); return; case MachineOperand::MO_MachineBasicBlock: printBasicBlockLabel(MO.getMachineBasicBlock()); return; + case MachineOperand::MO_JumpTableIndex: { + bool isMemOp = Modifier && !strcmp(Modifier, "mem"); + if (!isMemOp) O << "OFFSET "; + O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() + << "_" << MO.getJumpTableIndex(); + return; + } case MachineOperand::MO_ConstantPoolIndex: { bool isMemOp = Modifier && !strcmp(Modifier, "mem"); if (!isMemOp) O << "OFFSET "; Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.12 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.13 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.12 Fri Dec 1 14:47:11 2006 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp Tue Dec 19 15:04:20 2006 @@ -152,6 +152,7 @@ TextSection = "_text"; DataSection = "_data"; + JumpTableDataSection = NULL; SwitchToSectionDirective = ""; TextSectionStartSuffix = "\tsegment 'CODE'"; DataSectionStartSuffix = "\tsegment 'DATA'"; From reid at x10sys.com Tue Dec 19 15:16:50 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 15:16:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200612192116.kBJLGooA013090@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.229 -> 1.230 --- Log message: Now that ConstantInt::isValueValidForType can handle signed and unsigned values regardless of the signedness of the constant's type, it is okay to always make the AsmWriter.cpp print constant ints as signed values. The AsmParser will automatically handle things like: uint -1 as a result. --- Diffs of the changes: (+1 -4) AsmWriter.cpp | 5 +---- 1 files changed, 1 insertion(+), 4 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.229 llvm/lib/VMCore/AsmWriter.cpp:1.230 --- llvm/lib/VMCore/AsmWriter.cpp:1.229 Fri Dec 8 12:06:15 2006 +++ llvm/lib/VMCore/AsmWriter.cpp Tue Dec 19 15:16:35 2006 @@ -434,10 +434,7 @@ if (const ConstantBool *CB = dyn_cast(CV)) { Out << (CB->getValue() ? "true" : "false"); } else if (const ConstantInt *CI = dyn_cast(CV)) { - if (CI->getType()->isSigned()) - Out << CI->getSExtValue(); - else - Out << CI->getZExtValue(); + Out << CI->getSExtValue(); } else if (const ConstantFP *CFP = dyn_cast(CV)) { // We would like to output the FP constant value in exponential notation, // but we cannot do this if doing so will lose precision. Check here to From sabre at nondot.org Tue Dec 19 15:28:03 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 15:28:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/Statistic.cpp Message-ID: <200612192128.kBJLS3Bk013311@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Statistic.cpp updated: 1.23 -> 1.24 --- Log message: Refactor statistic a big and introduce a horrible-but-necessary macro (STATISTIC), which allows us to define statistics that don't introduce static ctors into the .o files. I'm migrating code over to use this incrementally. --- Diffs of the changes: (+4 -4) Statistic.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Support/Statistic.cpp diff -u llvm/lib/Support/Statistic.cpp:1.23 llvm/lib/Support/Statistic.cpp:1.24 --- llvm/lib/Support/Statistic.cpp:1.23 Fri Dec 8 14:00:42 2006 +++ llvm/lib/Support/Statistic.cpp Tue Dec 19 15:27:47 2006 @@ -45,11 +45,11 @@ /// on demand (when the first statistic is bumped) and destroyed only when /// llvm_shutdown is called. We print statistics from the destructor. class StatisticInfo { - std::vector Stats; + std::vector Stats; public: ~StatisticInfo(); - void addStatistic(const Statistic *S) { + void addStatistic(const StatisticBase *S) { Stats.push_back(S); } }; @@ -60,7 +60,7 @@ /// RegisterStatistic - The first time a statistic is bumped, this method is /// called. -void Statistic::RegisterStatistic() { +void StatisticBase::RegisterStatistic() { // If stats are enabled, inform StatInfo that this statistic should be // printed. if (Enabled) @@ -70,7 +70,7 @@ } struct NameCompare { - bool operator()(const Statistic *LHS, const Statistic *RHS) const { + bool operator()(const StatisticBase *LHS, const StatisticBase *RHS) const { int Cmp = std::strcmp(LHS->getName(), RHS->getName()); if (Cmp != 0) return Cmp < 0; From sabre at nondot.org Tue Dec 19 15:28:03 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 15:28:03 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/Statistic.h Message-ID: <200612192128.kBJLS3TO013306@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: Statistic.h updated: 1.20 -> 1.21 --- Log message: Refactor statistic a big and introduce a horrible-but-necessary macro (STATISTIC), which allows us to define statistics that don't introduce static ctors into the .o files. I'm migrating code over to use this incrementally. --- Diffs of the changes: (+22 -14) Statistic.h | 36 ++++++++++++++++++++++-------------- 1 files changed, 22 insertions(+), 14 deletions(-) Index: llvm/include/llvm/ADT/Statistic.h diff -u llvm/include/llvm/ADT/Statistic.h:1.20 llvm/include/llvm/ADT/Statistic.h:1.21 --- llvm/include/llvm/ADT/Statistic.h:1.20 Fri Dec 8 14:00:42 2006 +++ llvm/include/llvm/ADT/Statistic.h Tue Dec 19 15:27:47 2006 @@ -28,16 +28,12 @@ namespace llvm { -class Statistic { +class StatisticBase { +public: const char *Name; const char *Desc; unsigned Value : 31; bool Initialized : 1; -public: - // Normal constructor, default initialize data item... - Statistic(const char *name, const char *desc) - : Name(name), Desc(desc), Value(0), Initialized(0) { - } unsigned getValue() const { return Value; } const char *getName() const { return Name; } @@ -45,23 +41,35 @@ // Allow use of this class as the value itself. operator unsigned() const { return Value; } - const Statistic &operator=(unsigned Val) { Value = Val; return init(); } - const Statistic &operator++() { ++Value; return init(); } + const StatisticBase &operator=(unsigned Val) { Value = Val; return init(); } + const StatisticBase &operator++() { ++Value; return init(); } unsigned operator++(int) { init(); return Value++; } - const Statistic &operator--() { --Value; return init(); } + const StatisticBase &operator--() { --Value; return init(); } unsigned operator--(int) { init(); return Value--; } - const Statistic &operator+=(const unsigned &V) { Value += V; return init(); } - const Statistic &operator-=(const unsigned &V) { Value -= V; return init(); } - const Statistic &operator*=(const unsigned &V) { Value *= V; return init(); } - const Statistic &operator/=(const unsigned &V) { Value /= V; return init(); } + const StatisticBase &operator+=(const unsigned &V) {Value += V;return init();} + const StatisticBase &operator-=(const unsigned &V) {Value -= V;return init();} + const StatisticBase &operator*=(const unsigned &V) {Value *= V;return init();} + const StatisticBase &operator/=(const unsigned &V) {Value /= V;return init();} private: - Statistic &init() { + StatisticBase &init() { if (!Initialized) RegisterStatistic(); return *this; } void RegisterStatistic(); }; + +struct Statistic : public StatisticBase { + Statistic(const char *name, const char *desc) { + Name = name; Desc = desc; Value = 0; Initialized = 0; + } +}; + + +// STATISTIC - A macro to make definition of statistics really simple. This +// automatically passes the DEBUG_TYPE of the file into the statistic. +#define STATISTIC(VARNAME, DESC) \ + static StatisticBase VARNAME = { DEBUG_TYPE, DESC, 0, 0 } } // End llvm namespace From evan.cheng at apple.com Tue Dec 19 15:31:58 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 19 Dec 2006 15:31:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200612192131.kBJLVwvA013422@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.138 -> 1.139 --- Log message: Fix for PR1062: http://llvm.org/PR1062 by Dan Gohman. --- Diffs of the changes: (+2 -4) X86ISelDAGToDAG.cpp | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.138 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.139 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.138 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Dec 19 15:31:42 2006 @@ -604,11 +604,9 @@ SDOperand N0 = N.getOperand(0); if (GlobalAddressSDNode *G = dyn_cast(N0)) { GlobalValue *GV = G->getGlobal(); - bool isAbs32 = !is64Bit || - (isStatic && !(GV->isExternal() || GV->hasWeakLinkage() || - GV->hasLinkOnceLinkage())); + bool isAbs32 = !is64Bit || isStatic; if (isAbs32 || isRoot) { - AM.GV = G->getGlobal(); + AM.GV = GV; AM.Disp += G->getOffset(); AM.isRIPRel = !isAbs32; return false; From dpatel at apple.com Tue Dec 19 15:32:39 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 19 Dec 2006 15:32:39 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200612192132.kBJLWd7s013446@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.62 -> 1.63 --- Log message: Enable new pass manager. --- Diffs of the changes: (+1 -1) Pass.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.62 llvm/include/llvm/Pass.h:1.63 --- llvm/include/llvm/Pass.h:1.62 Sat Dec 16 23:15:12 2006 +++ llvm/include/llvm/Pass.h Tue Dec 19 15:32:24 2006 @@ -36,7 +36,7 @@ #include #include -#define USE_OLD_PASSMANAGER 1 +//#define USE_OLD_PASSMANAGER 1 namespace llvm { From sabre at nondot.org Tue Dec 19 15:40:33 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 15:40:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp BasicBlockPlacement.cpp CondPropagate.cpp ConstantProp.cpp CorrelatedExprs.cpp DCE.cpp DeadStoreElimination.cpp GCSE.cpp IndVarSimplify.cpp InstructionCombining.cpp LICM.cpp LoopStrengthReduce.cpp LoopUnroll.cpp LoopUnswitch.cpp Reassociate.cpp Reg2Mem.cpp SCCP.cpp ScalarReplAggregates.cpp SimplifyCFG.cpp TailDuplication.cpp TailRecursionElimination.cpp Message-ID: <200612192140.kBJLeXPS013664@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ADCE.cpp updated: 1.100 -> 1.101 BasicBlockPlacement.cpp updated: 1.7 -> 1.8 CondPropagate.cpp updated: 1.10 -> 1.11 ConstantProp.cpp updated: 1.53 -> 1.54 CorrelatedExprs.cpp updated: 1.40 -> 1.41 DCE.cpp updated: 1.60 -> 1.61 DeadStoreElimination.cpp updated: 1.15 -> 1.16 GCSE.cpp updated: 1.49 -> 1.50 IndVarSimplify.cpp updated: 1.97 -> 1.98 InstructionCombining.cpp updated: 1.571 -> 1.572 LICM.cpp updated: 1.82 -> 1.83 LoopStrengthReduce.cpp updated: 1.100 -> 1.101 LoopUnroll.cpp updated: 1.32 -> 1.33 LoopUnswitch.cpp updated: 1.51 -> 1.52 Reassociate.cpp updated: 1.68 -> 1.69 Reg2Mem.cpp updated: 1.8 -> 1.9 SCCP.cpp updated: 1.141 -> 1.142 ScalarReplAggregates.cpp updated: 1.58 -> 1.59 SimplifyCFG.cpp updated: 1.17 -> 1.18 TailDuplication.cpp updated: 1.35 -> 1.36 TailRecursionElimination.cpp updated: 1.26 -> 1.27 --- Log message: Switch over Transforms/Scalar to use the STATISTIC macro. For each statistic converted, we lose a static initializer. This also allows GCC to emit warnings about unused statistics. --- Diffs of the changes: (+101 -102) ADCE.cpp | 9 +++++---- BasicBlockPlacement.cpp | 5 +++-- CondPropagate.cpp | 8 +++----- ConstantProp.cpp | 5 +++-- CorrelatedExprs.cpp | 9 +++++---- DCE.cpp | 15 +++++++-------- DeadStoreElimination.cpp | 7 ++++--- GCSE.cpp | 16 ++++++++-------- IndVarSimplify.cpp | 13 +++++++------ InstructionCombining.cpp | 12 ++++++------ LICM.cpp | 13 ++++++------- LoopStrengthReduce.cpp | 8 ++++---- LoopUnroll.cpp | 4 ++-- LoopUnswitch.cpp | 13 ++++++------- Reassociate.cpp | 11 +++++------ Reg2Mem.cpp | 7 +++---- SCCP.cpp | 20 ++++++++++---------- ScalarReplAggregates.cpp | 10 +++++----- SimplifyCFG.cpp | 5 +++-- TailDuplication.cpp | 6 ++---- TailRecursionElimination.cpp | 7 ++++--- 21 files changed, 101 insertions(+), 102 deletions(-) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.100 llvm/lib/Transforms/Scalar/ADCE.cpp:1.101 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.100 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Tue Dec 19 15:40:18 2006 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "adce" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" @@ -29,11 +30,11 @@ #include using namespace llvm; -namespace { - Statistic NumBlockRemoved("adce", "Number of basic blocks removed"); - Statistic NumInstRemoved ("adce", "Number of instructions removed"); - Statistic NumCallRemoved ("adce", "Number of calls and invokes removed"); +STATISTIC(NumBlockRemoved, "Number of basic blocks removed"); +STATISTIC(NumInstRemoved , "Number of instructions removed"); +STATISTIC(NumCallRemoved , "Number of calls and invokes removed"); +namespace { //===----------------------------------------------------------------------===// // ADCE Class // Index: llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp diff -u llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp:1.7 llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp:1.8 --- llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp:1.7 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp Tue Dec 19 15:40:18 2006 @@ -26,6 +26,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "block-placement" #include "llvm/Analysis/ProfileInfo.h" #include "llvm/Function.h" #include "llvm/Pass.h" @@ -35,9 +36,9 @@ #include using namespace llvm; -namespace { - Statistic NumMoved("block-placement", "Number of basic blocks moved"); +STATISTIC(NumMoved, "Number of basic blocks moved"); +namespace { struct BlockPlacement : public FunctionPass { virtual bool runOnFunction(Function &F); Index: llvm/lib/Transforms/Scalar/CondPropagate.cpp diff -u llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.10 llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.11 --- llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.10 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/Scalar/CondPropagate.cpp Tue Dec 19 15:40:18 2006 @@ -25,12 +25,10 @@ #include "llvm/Support/Streams.h" using namespace llvm; -namespace { - Statistic - NumBrThread("condprop", "Number of CFG edges threaded through branches"); - Statistic - NumSwThread("condprop", "Number of CFG edges threaded through switches"); +STATISTIC(NumBrThread, "Number of CFG edges threaded through branches"); +STATISTIC(NumSwThread, "Number of CFG edges threaded through switches"); +namespace { struct CondProp : public FunctionPass { virtual bool runOnFunction(Function &F); Index: llvm/lib/Transforms/Scalar/ConstantProp.cpp diff -u llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.53 llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.54 --- llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.53 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/Scalar/ConstantProp.cpp Tue Dec 19 15:40:18 2006 @@ -18,6 +18,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "constprop" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Constant.h" @@ -28,9 +29,9 @@ #include using namespace llvm; -namespace { - Statistic NumInstKilled("constprop", "Number of instructions killed"); +STATISTIC(NumInstKilled, "Number of instructions killed"); +namespace { struct ConstantPropagation : public FunctionPass { bool runOnFunction(Function &F); Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.40 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.41 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.40 Thu Dec 7 14:04:42 2006 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Tue Dec 19 15:40:18 2006 @@ -26,6 +26,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "cee" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/Pass.h" @@ -44,11 +45,11 @@ #include using namespace llvm; -namespace { - Statistic NumSetCCRemoved("cee", "Number of setcc instruction eliminated"); - Statistic NumOperandsCann("cee", "Number of operands canonicalized"); - Statistic BranchRevectors("cee", "Number of branches revectored"); +STATISTIC(NumSetCCRemoved, "Number of setcc instruction eliminated"); +STATISTIC(NumOperandsCann, "Number of operands canonicalized"); +STATISTIC(BranchRevectors, "Number of branches revectored"); +namespace { class ValueInfo; class Relation { Value *Val; // Relation to what value? Index: llvm/lib/Transforms/Scalar/DCE.cpp diff -u llvm/lib/Transforms/Scalar/DCE.cpp:1.60 llvm/lib/Transforms/Scalar/DCE.cpp:1.61 --- llvm/lib/Transforms/Scalar/DCE.cpp:1.60 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/Scalar/DCE.cpp Tue Dec 19 15:40:18 2006 @@ -16,6 +16,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "dce" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Instruction.h" @@ -25,14 +26,13 @@ #include using namespace llvm; -namespace { - Statistic DIEEliminated("die", "Number of insts removed"); - Statistic DCEEliminated("dce", "Number of insts removed"); +STATISTIC(DIEEliminated, "Number of insts removed by DIE pass"); +STATISTIC(DCEEliminated, "Number of insts removed"); +namespace { //===--------------------------------------------------------------------===// // DeadInstElimination pass implementation // - struct DeadInstElimination : public BasicBlockPass { virtual bool runOnBasicBlock(BasicBlock &BB) { bool Changed = false; @@ -58,11 +58,10 @@ } -//===----------------------------------------------------------------------===// -// DeadCodeElimination pass implementation -// - namespace { + //===--------------------------------------------------------------------===// + // DeadCodeElimination pass implementation + // struct DCE : public FunctionPass { virtual bool runOnFunction(Function &F); Index: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp diff -u llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1.15 llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1.16 --- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1.15 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp Tue Dec 19 15:40:18 2006 @@ -15,6 +15,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "dse" #include "llvm/Transforms/Scalar.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" @@ -27,10 +28,10 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumStores("dse", "Number of stores deleted"); - Statistic NumOther ("dse", "Number of other instrs removed"); +STATISTIC(NumStores, "Number of stores deleted"); +STATISTIC(NumOther , "Number of other instrs removed"); +namespace { struct DSE : public FunctionPass { virtual bool runOnFunction(Function &F) { Index: llvm/lib/Transforms/Scalar/GCSE.cpp diff -u llvm/lib/Transforms/Scalar/GCSE.cpp:1.49 llvm/lib/Transforms/Scalar/GCSE.cpp:1.50 --- llvm/lib/Transforms/Scalar/GCSE.cpp:1.49 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/Scalar/GCSE.cpp Tue Dec 19 15:40:18 2006 @@ -14,6 +14,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "gcse" #include "llvm/Transforms/Scalar.h" #include "llvm/BasicBlock.h" #include "llvm/Constant.h" @@ -27,15 +28,14 @@ #include using namespace llvm; +STATISTIC(NumInstRemoved, "Number of instructions removed"); +STATISTIC(NumLoadRemoved, "Number of loads removed"); +STATISTIC(NumCallRemoved, "Number of calls removed"); +STATISTIC(NumNonInsts , "Number of instructions removed due " + "to non-instruction values"); +STATISTIC(NumArgsRepl , "Number of function arguments replaced " + "with constant values"); namespace { - Statistic NumInstRemoved("gcse", "Number of instructions removed"); - Statistic NumLoadRemoved("gcse", "Number of loads removed"); - Statistic NumCallRemoved("gcse", "Number of calls removed"); - Statistic NumNonInsts ("gcse", "Number of instructions removed due " - "to non-instruction values"); - Statistic NumArgsRepl ("gcse", "Number of function arguments replaced " - "with constant values"); - struct GCSE : public FunctionPass { virtual bool runOnFunction(Function &F); Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.97 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.98 --- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.97 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Tue Dec 19 15:40:18 2006 @@ -37,6 +37,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "indvars" #include "llvm/Transforms/Scalar.h" #include "llvm/BasicBlock.h" #include "llvm/Constants.h" @@ -51,13 +52,13 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumRemoved ("indvars", "Number of aux indvars removed"); - Statistic NumPointer ("indvars", "Number of pointer indvars promoted"); - Statistic NumInserted("indvars", "Number of canonical indvars added"); - Statistic NumReplaced("indvars", "Number of exit values replaced"); - Statistic NumLFTR ("indvars", "Number of loop exit tests replaced"); +STATISTIC(NumRemoved , "Number of aux indvars removed"); +STATISTIC(NumPointer , "Number of pointer indvars promoted"); +STATISTIC(NumInserted, "Number of canonical indvars added"); +STATISTIC(NumReplaced, "Number of exit values replaced"); +STATISTIC(NumLFTR , "Number of loop exit tests replaced"); +namespace { class IndVarSimplify : public FunctionPass { LoopInfo *LI; ScalarEvolution *SE; Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.571 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.572 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.571 Mon Dec 18 02:47:13 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 19 15:40:18 2006 @@ -55,13 +55,13 @@ using namespace llvm; using namespace llvm::PatternMatch; -namespace { - Statistic NumCombined ("instcombine", "Number of insts combined"); - Statistic NumConstProp("instcombine", "Number of constant folds"); - Statistic NumDeadInst ("instcombine", "Number of dead inst eliminated"); - Statistic NumDeadStore("instcombine", "Number of dead stores eliminated"); - Statistic NumSunkInst ("instcombine", "Number of instructions sunk"); +STATISTIC(NumCombined , "Number of insts combined"); +STATISTIC(NumConstProp, "Number of constant folds"); +STATISTIC(NumDeadInst , "Number of dead inst eliminated"); +STATISTIC(NumDeadStore, "Number of dead stores eliminated"); +STATISTIC(NumSunkInst , "Number of instructions sunk"); +namespace { class VISIBILITY_HIDDEN InstCombiner : public FunctionPass, public InstVisitor { Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.82 llvm/lib/Transforms/Scalar/LICM.cpp:1.83 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.82 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Scalar/LICM.cpp Tue Dec 19 15:40:18 2006 @@ -49,18 +49,17 @@ #include using namespace llvm; +STATISTIC(NumSunk , "Number of instructions sunk out of loop"); +STATISTIC(NumHoisted , "Number of instructions hoisted out of loop"); +STATISTIC(NumMovedLoads, "Number of load insts hoisted or sunk"); +STATISTIC(NumMovedCalls, "Number of call insts hoisted or sunk"); +STATISTIC(NumPromoted , "Number of memory locations promoted to registers"); + namespace { cl::opt DisablePromotion("disable-licm-promotion", cl::Hidden, cl::desc("Disable memory promotion in LICM pass")); - Statistic NumSunk("licm", "Number of instructions sunk out of loop"); - Statistic NumHoisted("licm", "Number of instructions hoisted out of loop"); - Statistic NumMovedLoads("licm", "Number of load insts hoisted or sunk"); - Statistic NumMovedCalls("licm", "Number of call insts hoisted or sunk"); - Statistic NumPromoted("licm", - "Number of memory locations promoted to registers"); - struct LICM : public FunctionPass { virtual bool runOnFunction(Function &F); Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.100 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.101 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.100 Wed Dec 13 02:06:42 2006 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Dec 19 15:40:18 2006 @@ -37,11 +37,11 @@ #include using namespace llvm; -namespace { - Statistic NumReduced ("loop-reduce", "Number of GEPs strength reduced"); - Statistic NumInserted("loop-reduce", "Number of PHIs inserted"); - Statistic NumVariable("loop-reduce","Number of PHIs with variable strides"); +STATISTIC(NumReduced , "Number of GEPs strength reduced"); +STATISTIC(NumInserted, "Number of PHIs inserted"); +STATISTIC(NumVariable, "Number of PHIs with variable strides"); +namespace { /// IVStrideUse - Keep track of one use of a strided induction variable, where /// the stride is stored externally. The Offset member keeps track of the /// offset from the IV, User is the actual user of the operand, and 'Operand' Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.32 llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.33 --- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.32 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp Tue Dec 19 15:40:18 2006 @@ -36,9 +36,9 @@ #include using namespace llvm; -namespace { - Statistic NumUnrolled("loop-unroll", "Number of loops completely unrolled"); +STATISTIC(NumUnrolled, "Number of loops completely unrolled"); +namespace { cl::opt UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden, cl::desc("The cut-off point for loop unrolling")); Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.51 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.52 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.51 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Dec 19 15:40:18 2006 @@ -43,14 +43,13 @@ #include using namespace llvm; +STATISTIC(NumBranches, "Number of branches unswitched"); +STATISTIC(NumSwitches, "Number of switches unswitched"); +STATISTIC(NumSelects , "Number of selects unswitched"); +STATISTIC(NumTrivial , "Number of unswitches that are trivial"); +STATISTIC(NumSimplify, "Number of simplifications of unswitched code"); + namespace { - Statistic NumBranches("loop-unswitch", "Number of branches unswitched"); - Statistic NumSwitches("loop-unswitch", "Number of switches unswitched"); - Statistic NumSelects ("loop-unswitch", "Number of selects unswitched"); - Statistic NumTrivial ("loop-unswitch", - "Number of unswitches that are trivial"); - Statistic NumSimplify("loop-unswitch", - "Number of simplifications of unswitched code"); cl::opt Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"), cl::init(10), cl::Hidden); Index: llvm/lib/Transforms/Scalar/Reassociate.cpp diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.68 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.69 --- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.68 Thu Dec 7 14:04:42 2006 +++ llvm/lib/Transforms/Scalar/Reassociate.cpp Tue Dec 19 15:40:18 2006 @@ -35,13 +35,12 @@ #include using namespace llvm; -namespace { - Statistic NumLinear ("reassociate","Number of insts linearized"); - Statistic NumChanged("reassociate","Number of insts reassociated"); - Statistic NumSwapped("reassociate","Number of insts with operands swapped"); - Statistic NumAnnihil("reassociate","Number of expr tree annihilated"); - Statistic NumFactor ("reassociate","Number of multiplies factored"); +STATISTIC(NumLinear , "Number of insts linearized"); +STATISTIC(NumChanged, "Number of insts reassociated"); +STATISTIC(NumAnnihil, "Number of expr tree annihilated"); +STATISTIC(NumFactor , "Number of multiplies factored"); +namespace { struct ValueEntry { unsigned Rank; Value *Op; Index: llvm/lib/Transforms/Scalar/Reg2Mem.cpp diff -u llvm/lib/Transforms/Scalar/Reg2Mem.cpp:1.8 llvm/lib/Transforms/Scalar/Reg2Mem.cpp:1.9 --- llvm/lib/Transforms/Scalar/Reg2Mem.cpp:1.8 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Scalar/Reg2Mem.cpp Tue Dec 19 15:40:18 2006 @@ -16,6 +16,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "reg2mem" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Pass.h" @@ -24,14 +25,12 @@ #include "llvm/BasicBlock.h" #include "llvm/Instructions.h" #include "llvm/ADT/Statistic.h" - #include - using namespace llvm; +STATISTIC(NumDemoted, "Number of registers demoted"); + namespace { - Statistic NumDemoted("reg2mem", "Number of registers demoted"); - struct RegToMem : public FunctionPass { virtual void getAnalysisUsage(AnalysisUsage &AU) const { Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.141 llvm/lib/Transforms/Scalar/SCCP.cpp:1.142 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.141 Mon Dec 11 23:04:59 2006 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Tue Dec 19 15:40:18 2006 @@ -39,6 +39,16 @@ #include using namespace llvm; +STATISTIC(NumInstRemoved, "Number of instructions removed"); +STATISTIC(NumDeadBlocks , "Number of basic blocks unreachable"); + +STATISTIC(IPNumInstRemoved, "Number ofinstructions removed by IPSCCP"); +STATISTIC(IPNumDeadBlocks , "Number of basic blocks unreachable by IPSCCP"); +STATISTIC(IPNumArgsElimed ,"Number of arguments constant propagated by IPSCCP"); +STATISTIC(IPNumGlobalConst, "Number of globals found to be constant by IPSCCP"); + + + // LatticeVal class - This class represents the different lattice values that an // instruction may occupy. It is a simple class with value semantics. // @@ -1081,9 +1091,6 @@ namespace { - Statistic NumInstRemoved("sccp", "Number of instructions removed"); - Statistic NumDeadBlocks ("sccp", "Number of basic blocks unreachable"); - //===--------------------------------------------------------------------===// // /// SCCP Class - This class uses the SCCPSolver to implement a per-function @@ -1192,13 +1199,6 @@ } namespace { - Statistic IPNumInstRemoved("ipsccp", "Number of instructions removed"); - Statistic IPNumDeadBlocks ("ipsccp", "Number of basic blocks unreachable"); - Statistic IPNumArgsElimed ("ipsccp", - "Number of arguments constant propagated"); - Statistic IPNumGlobalConst("ipsccp", - "Number of globals found to be constant"); - //===--------------------------------------------------------------------===// // /// IPSCCP Class - This class implements interprocedural Sparse Conditional Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.58 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.59 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.58 Fri Dec 15 01:32:38 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Dec 19 15:40:18 2006 @@ -19,6 +19,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "scalarrepl" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -36,12 +37,11 @@ #include "llvm/ADT/StringExtras.h" using namespace llvm; -namespace { - Statistic NumReplaced("scalarrepl", "Number of allocas broken up"); - Statistic NumPromoted("scalarrepl", "Number of allocas promoted"); - Statistic NumConverted("scalarrepl", - "Number of aggregates converted to scalar"); +STATISTIC(NumReplaced, "Number of allocas broken up"); +STATISTIC(NumPromoted, "Number of allocas promoted"); +STATISTIC(NumConverted, "Number of aggregates converted to scalar"); +namespace { struct VISIBILITY_HIDDEN SROA : public FunctionPass { bool runOnFunction(Function &F); Index: llvm/lib/Transforms/Scalar/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Scalar/SimplifyCFG.cpp:1.17 llvm/lib/Transforms/Scalar/SimplifyCFG.cpp:1.18 --- llvm/lib/Transforms/Scalar/SimplifyCFG.cpp:1.17 Fri Dec 8 15:52:01 2006 +++ llvm/lib/Transforms/Scalar/SimplifyCFG.cpp Tue Dec 19 15:40:18 2006 @@ -18,6 +18,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "simplifycfg" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Constants.h" @@ -29,9 +30,9 @@ #include using namespace llvm; -namespace { - Statistic NumSimpl("cfgsimplify", "Number of blocks simplified"); +STATISTIC(NumSimpl, "Number of blocks simplified"); +namespace { struct CFGSimplifyPass : public FunctionPass { virtual bool runOnFunction(Function &F); }; Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.35 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.36 --- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.35 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Scalar/TailDuplication.cpp Tue Dec 19 15:40:18 2006 @@ -33,14 +33,12 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(NumEliminated, "Number of unconditional branches eliminated"); + namespace { cl::opt Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"), cl::init(6), cl::Hidden); - Statistic NumEliminated("tailduplicate", - "Number of unconditional branches eliminated"); - Statistic NumPHINodes("tailduplicate", "Number of phi nodes inserted"); - class TailDup : public FunctionPass { bool runOnFunction(Function &F); private: Index: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp diff -u llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.26 llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.27 --- llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.26 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp Tue Dec 19 15:40:18 2006 @@ -50,6 +50,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "tailcallelim" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -60,10 +61,10 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumEliminated("tailcallelim", "Number of tail calls removed"); - Statistic NumAccumAdded("tailcallelim","Number of accumulators introduced"); +STATISTIC(NumEliminated, "Number of tail calls removed"); +STATISTIC(NumAccumAdded, "Number of accumulators introduced"); +namespace { struct TailCallElim : public FunctionPass { virtual bool runOnFunction(Function &F); From sabre at nondot.org Tue Dec 19 15:46:37 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 15:46:37 -0600 Subject: [llvm-commits] CVS: llvm/docs/ProgrammersManual.html Message-ID: <200612192146.kBJLkbJM013864@zion.cs.uiuc.edu> Changes in directory llvm/docs: ProgrammersManual.html updated: 1.97 -> 1.98 --- Log message: update to reflect changes in statistic class. --- Diffs of the changes: (+11 -9) ProgrammersManual.html | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) Index: llvm/docs/ProgrammersManual.html diff -u llvm/docs/ProgrammersManual.html:1.97 llvm/docs/ProgrammersManual.html:1.98 --- llvm/docs/ProgrammersManual.html:1.97 Tue Dec 19 13:47:19 2006 +++ llvm/docs/ProgrammersManual.html Tue Dec 19 15:46:21 2006 @@ -35,7 +35,7 @@ and the -debug-only option -
  • The Statistic template & -stats +
  • The Statistic class & -stats option
  • @@ -493,7 +493,7 @@

    The "llvm/ADT/Statistic.h" file -provides a template named Statistic that is used as a unified way to +provides a class named Statistic that is used as a unified way to keep track of what the LLVM compiler is doing and how effective various optimizations are. It is useful to see what optimizations are contributing to making a particular program run faster.

    @@ -501,7 +501,7 @@

    Often you may run your pass on some big program, and you're interested to see how many times it makes a certain transformation. Although you can do this with hand inspection, or some ad-hoc method, this is a real pain and not very useful -for big programs. Using the Statistic template makes it very easy to +for big programs. Using the Statistic class makes it very easy to keep track of this information, and the calculated information is presented in a uniform manner with the rest of the passes being executed.

    @@ -513,13 +513,15 @@
    -static Statistic<> NumXForms("mypassname", "The # of times I did stuff");
    +#define DEBUG_TYPE "mypassname"   // This goes before any #includes.
    +STATISTIC(NumXForms, "The # of times I did stuff");
     
    -

    The Statistic template can emulate just about any data-type, - but if you do not specify a template argument, it defaults to acting like - an unsigned int counter (this is usually what you want).

    +

    The STATISTIC macro defines a static variable, whose name is + specified by the first argument. The pass name is taken from the DEBUG_TYPE + macro, and the description is taken from the second argument. The variable + defined ("NumXForms" in this case) acts like an unsigned int.

  • Whenever you make a transformation, bump the counter:

    @@ -2577,7 +2579,7 @@ Dinakar Dhurjati and Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/12/19 19:47:19 $ + Last modified: $Date: 2006/12/19 21:46:21 $ From sabre at nondot.org Tue Dec 19 15:49:18 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 15:49:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200612192149.kBJLnIVA013927@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.38 -> 1.39 --- Log message: Convert more Statistic's over to STATISTIC --- Diffs of the changes: (+4 -7) PredicateSimplifier.cpp | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.38 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.39 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.38 Thu Dec 7 14:04:42 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Tue Dec 19 15:49:03 2006 @@ -92,14 +92,11 @@ #include using namespace llvm; -namespace { - Statistic - NumVarsReplaced("predsimplify", "Number of argument substitutions"); - Statistic - NumInstruction("predsimplify", "Number of instructions removed"); - Statistic - NumSimple("predsimplify", "Number of simple replacements"); +STATISTIC(NumVarsReplaced, "Number of argument substitutions"); +STATISTIC(NumInstruction , "Number of instructions removed"); +STATISTIC(NumSimple , "Number of simple replacements"); +namespace { /// The InequalityGraph stores the relationships between values. /// Each Value in the graph is assigned to a Node. Nodes are pointer /// comparable for equality. The caller is expected to maintain the logical From sabre at nondot.org Tue Dec 19 16:09:33 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:09:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp ConstantMerge.cpp DeadArgumentElimination.cpp DeadTypeElimination.cpp FunctionResolution.cpp GlobalDCE.cpp GlobalOpt.cpp IPConstantPropagation.cpp IndMemRemoval.cpp Inliner.cpp Internalize.cpp LoopExtractor.cpp LowerSetJmp.cpp PruneEH.cpp RaiseAllocations.cpp SimplifyLibCalls.cpp Message-ID: <200612192209.kBJM9XH8014395@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: ArgumentPromotion.cpp updated: 1.31 -> 1.32 ConstantMerge.cpp updated: 1.33 -> 1.34 DeadArgumentElimination.cpp updated: 1.32 -> 1.33 DeadTypeElimination.cpp updated: 1.57 -> 1.58 FunctionResolution.cpp updated: 1.64 -> 1.65 GlobalDCE.cpp updated: 1.39 -> 1.40 GlobalOpt.cpp updated: 1.79 -> 1.80 IPConstantPropagation.cpp updated: 1.20 -> 1.21 IndMemRemoval.cpp updated: 1.8 -> 1.9 Inliner.cpp updated: 1.34 -> 1.35 Internalize.cpp updated: 1.39 -> 1.40 LoopExtractor.cpp updated: 1.20 -> 1.21 LowerSetJmp.cpp updated: 1.33 -> 1.34 PruneEH.cpp updated: 1.25 -> 1.26 RaiseAllocations.cpp updated: 1.33 -> 1.34 SimplifyLibCalls.cpp updated: 1.76 -> 1.77 --- Log message: Eliminate static ctors due to Statistic objects --- Diffs of the changes: (+71 -85) ArgumentPromotion.cpp | 11 ++++------- ConstantMerge.cpp | 5 +++-- DeadArgumentElimination.cpp | 8 +++----- DeadTypeElimination.cpp | 5 +++-- FunctionResolution.cpp | 7 ++++--- GlobalDCE.cpp | 7 ++++--- GlobalOpt.cpp | 28 ++++++++++++---------------- IPConstantPropagation.cpp | 9 ++++----- IndMemRemoval.cpp | 17 ++++------------- Inliner.cpp | 7 ++++--- Internalize.cpp | 6 ++++-- LoopExtractor.cpp | 5 +++-- LowerSetJmp.cpp | 15 ++++++--------- PruneEH.cpp | 7 ++++--- RaiseAllocations.cpp | 5 +++-- SimplifyLibCalls.cpp | 14 ++++++-------- 16 files changed, 71 insertions(+), 85 deletions(-) Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.31 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.32 --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.31 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Tue Dec 19 16:09:18 2006 @@ -47,14 +47,11 @@ #include using namespace llvm; -namespace { - Statistic NumArgumentsPromoted("argpromotion", - "Number of pointer arguments promoted"); - Statistic NumAggregatesPromoted("argpromotion", - "Number of aggregate arguments promoted"); - Statistic NumArgumentsDead("argpromotion", - "Number of dead pointer args eliminated"); +STATISTIC(NumArgumentsPromoted , "Number of pointer arguments promoted"); +STATISTIC(NumAggregatesPromoted, "Number of aggregate arguments promoted"); +STATISTIC(NumArgumentsDead , "Number of dead pointer args eliminated"); +namespace { /// ArgPromotion - The 'by reference' to 'by value' argument promotion pass. /// struct ArgPromotion : public CallGraphSCCPass { Index: llvm/lib/Transforms/IPO/ConstantMerge.cpp diff -u llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.33 llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.34 --- llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.33 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/ConstantMerge.cpp Tue Dec 19 16:09:18 2006 @@ -17,15 +17,16 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "constmerge" #include "llvm/Transforms/IPO.h" #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumMerged("constmerge", "Number of global constants merged"); +STATISTIC(NumMerged, "Number of global constants merged"); +namespace { struct ConstantMerge : public ModulePass { // run - For this pass, process all of the globals in the module, // eliminating duplicate constants. Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.32 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.33 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.32 Sat Dec 16 15:21:53 2006 +++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Tue Dec 19 16:09:18 2006 @@ -32,12 +32,10 @@ #include using namespace llvm; -namespace { - Statistic NumArgumentsEliminated("deadargelim", - "Number of unread args removed"); - Statistic NumRetValsEliminated("deadargelim", - "Number of unused return values removed"); +STATISTIC(NumArgumentsEliminated, "Number of unread args removed"); +STATISTIC(NumRetValsEliminated , "Number of unused return values removed"); +namespace { /// DAE - The dead argument elimination pass. /// class DAE : public ModulePass { Index: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.57 llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.58 --- llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.57 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/DeadTypeElimination.cpp Tue Dec 19 16:09:18 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "deadtypeelim" #include "llvm/Transforms/IPO.h" #include "llvm/Analysis/FindUsedTypes.h" #include "llvm/Module.h" @@ -20,6 +21,8 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(NumKilled, "Number of unused typenames removed from symtab"); + namespace { struct DTE : public ModulePass { // doPassInitialization - For this pass, it removes global symbol table @@ -37,8 +40,6 @@ } }; RegisterPass X("deadtypeelim", "Dead Type Elimination"); - Statistic - NumKilled("deadtypeelim", "Number of unused typenames removed from symtab"); } ModulePass *llvm::createDeadTypeEliminationPass() { Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.64 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.65 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.64 Mon Dec 11 23:04:59 2006 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Tue Dec 19 16:09:18 2006 @@ -18,6 +18,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "funcresolve" #include "llvm/Transforms/IPO.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" @@ -31,10 +32,10 @@ #include using namespace llvm; -namespace { - Statistic NumResolved("funcresolve", "Number of varargs functions resolved"); - Statistic NumGlobals("funcresolve", "Number of global variables resolved"); +STATISTIC(NumResolved, "Number of varargs functions resolved"); +STATISTIC(NumGlobals, "Number of global variables resolved"); +namespace { struct FunctionResolvingPass : public ModulePass { virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.39 llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.40 --- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.39 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/GlobalDCE.cpp Tue Dec 19 16:09:18 2006 @@ -15,6 +15,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "globaldce" #include "llvm/Transforms/IPO.h" #include "llvm/Constants.h" #include "llvm/Module.h" @@ -23,10 +24,10 @@ #include using namespace llvm; -namespace { - Statistic NumFunctions("globaldce","Number of functions removed"); - Statistic NumVariables("globaldce","Number of global variables removed"); +STATISTIC(NumFunctions, "Number of functions removed"); +STATISTIC(NumVariables, "Number of global variables removed"); +namespace { struct GlobalDCE : public ModulePass { // run - Do the GlobalDCE pass on the specified module, optionally updating // the specified callgraph to reflect the changes. Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.79 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.80 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.79 Tue Dec 12 17:36:14 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Tue Dec 19 16:09:18 2006 @@ -31,23 +31,19 @@ #include using namespace llvm; -namespace { - Statistic NumMarked ("globalopt", "Number of globals marked constant"); - Statistic NumSRA ("globalopt", "Number of aggregate globals broken " - "into scalars"); - Statistic NumHeapSRA ("globalopt", "Number of heap objects SRA'd"); - Statistic NumSubstitute("globalopt", - "Number of globals with initializers stored into them"); - Statistic NumDeleted ("globalopt", "Number of globals deleted"); - Statistic NumFnDeleted("globalopt", "Number of functions deleted"); - Statistic NumGlobUses ("globalopt", "Number of global uses devirtualized"); - Statistic NumLocalized("globalopt", "Number of globals localized"); - Statistic NumShrunkToBool("globalopt", - "Number of global vars shrunk to booleans"); - Statistic NumFastCallFns("globalopt", - "Number of functions converted to fastcc"); - Statistic NumCtorsEvaluated("globalopt","Number of static ctors evaluated"); +STATISTIC(NumMarked , "Number of globals marked constant"); +STATISTIC(NumSRA , "Number of aggregate globals broken into scalars"); +STATISTIC(NumHeapSRA , "Number of heap objects SRA'd"); +STATISTIC(NumSubstitute,"Number of globals with initializers stored into them"); +STATISTIC(NumDeleted , "Number of globals deleted"); +STATISTIC(NumFnDeleted , "Number of functions deleted"); +STATISTIC(NumGlobUses , "Number of global uses devirtualized"); +STATISTIC(NumLocalized , "Number of globals localized"); +STATISTIC(NumShrunkToBool , "Number of global vars shrunk to booleans"); +STATISTIC(NumFastCallFns , "Number of functions converted to fastcc"); +STATISTIC(NumCtorsEvaluated, "Number of static ctors evaluated"); +namespace { struct GlobalOpt : public ModulePass { virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); Index: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp diff -u llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.20 llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.21 --- llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.20 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/IPConstantPropagation.cpp Tue Dec 19 16:09:18 2006 @@ -15,6 +15,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "ipconstprop" #include "llvm/Transforms/IPO.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" @@ -24,12 +25,10 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumArgumentsProped("ipconstprop", - "Number of args turned into constants"); - Statistic NumReturnValProped("ipconstprop", - "Number of return values turned into constants"); +STATISTIC(NumArgumentsProped, "Number of args turned into constants"); +STATISTIC(NumReturnValProped, "Number of return values turned into constants"); +namespace { /// IPCP - The interprocedural constant propagation pass /// struct IPCP : public ModulePass { Index: llvm/lib/Transforms/IPO/IndMemRemoval.cpp diff -u llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.8 llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.9 --- llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.8 Tue Dec 12 18:50:17 2006 +++ llvm/lib/Transforms/IPO/IndMemRemoval.cpp Tue Dec 19 16:09:18 2006 @@ -15,36 +15,27 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "indmemrem" #include "llvm/Transforms/IPO.h" #include "llvm/Pass.h" #include "llvm/Module.h" -#include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Type.h" -#include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" -#include -#include using namespace llvm; -namespace { - Statistic NumBounceSites("indmemrem", "Number of sites modified"); - Statistic NumBounce ("indmemrem", "Number of bounce functions created"); +STATISTIC(NumBounceSites, "Number of sites modified"); +STATISTIC(NumBounce , "Number of bounce functions created"); +namespace { class IndMemRemPass : public ModulePass { - public: - IndMemRemPass(); virtual bool runOnModule(Module &M); }; RegisterPass X("indmemrem","Indirect Malloc and Free Removal"); } // end anonymous namespace -IndMemRemPass::IndMemRemPass() -{ -} - bool IndMemRemPass::runOnModule(Module &M) { //in Theory, all direct calls of malloc and free should be promoted //to intrinsics. Therefor, this goes through and finds where the Index: llvm/lib/Transforms/IPO/Inliner.cpp diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.34 llvm/lib/Transforms/IPO/Inliner.cpp:1.35 --- llvm/lib/Transforms/IPO/Inliner.cpp:1.34 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/Inliner.cpp Tue Dec 19 16:09:18 2006 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "inline" #include "Inliner.h" #include "llvm/Module.h" #include "llvm/Instructions.h" @@ -25,10 +26,10 @@ #include using namespace llvm; +STATISTIC(NumInlined, "Number of functions inlined"); +STATISTIC(NumDeleted, "Number of functions deleted because all callers found"); + namespace { - Statistic NumInlined("inline", "Number of functions inlined"); - Statistic NumDeleted("inline", - "Number of functions deleted because all callers found"); cl::opt // FIXME: 200 is VERY conservative InlineLimit("inline-threshold", cl::Hidden, cl::init(200), cl::desc("Control the amount of inlining to perform (default = 200)")); Index: llvm/lib/Transforms/IPO/Internalize.cpp diff -u llvm/lib/Transforms/IPO/Internalize.cpp:1.39 llvm/lib/Transforms/IPO/Internalize.cpp:1.40 --- llvm/lib/Transforms/IPO/Internalize.cpp:1.39 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/IPO/Internalize.cpp Tue Dec 19 16:09:18 2006 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "internalize" #include "llvm/Transforms/IPO.h" #include "llvm/Pass.h" #include "llvm/Module.h" @@ -23,9 +24,10 @@ #include using namespace llvm; +STATISTIC(NumFunctions, "Number of functions internalized"); +STATISTIC(NumGlobals , "Number of global vars internalized"); + namespace { - Statistic NumFunctions("internalize", "Number of functions internalized"); - Statistic NumGlobals ("internalize", "Number of global vars internalized"); // APIFile - A file which contains a list of symbols that should not be marked // external. Index: llvm/lib/Transforms/IPO/LoopExtractor.cpp diff -u llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.20 llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.21 --- llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.20 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/LoopExtractor.cpp Tue Dec 19 16:09:18 2006 @@ -14,6 +14,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "loop-extract" #include "llvm/Transforms/IPO.h" #include "llvm/Instructions.h" #include "llvm/Module.h" @@ -25,9 +26,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumExtracted("loop-extract", "Number of loops extracted"); +STATISTIC(NumExtracted, "Number of loops extracted"); +namespace { // FIXME: This is not a function pass, but the PassManager doesn't allow // Module passes to require FunctionPasses, so we can't get loop info if we're // not a function pass. Index: llvm/lib/Transforms/IPO/LowerSetJmp.cpp diff -u llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.33 llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.34 --- llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.33 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/LowerSetJmp.cpp Tue Dec 19 16:09:18 2006 @@ -33,6 +33,7 @@ // pass invokable via the "opt" command at will. //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "lowersetjmp" #include "llvm/Transforms/IPO.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -49,16 +50,12 @@ #include "llvm/ADT/VectorExtras.h" using namespace llvm; -namespace { - Statistic LongJmpsTransformed("lowersetjmp", - "Number of longjmps transformed"); - Statistic SetJmpsTransformed("lowersetjmp", - "Number of setjmps transformed"); - Statistic CallsTransformed("lowersetjmp", - "Number of calls invokified"); - Statistic InvokesTransformed("lowersetjmp", - "Number of invokes modified"); +STATISTIC(LongJmpsTransformed, "Number of longjmps transformed"); +STATISTIC(SetJmpsTransformed , "Number of setjmps transformed"); +STATISTIC(CallsTransformed , "Number of calls invokified"); +STATISTIC(InvokesTransformed , "Number of invokes modified"); +namespace { //===--------------------------------------------------------------------===// // LowerSetJmp pass implementation. class LowerSetJmp : public ModulePass, Index: llvm/lib/Transforms/IPO/PruneEH.cpp diff -u llvm/lib/Transforms/IPO/PruneEH.cpp:1.25 llvm/lib/Transforms/IPO/PruneEH.cpp:1.26 --- llvm/lib/Transforms/IPO/PruneEH.cpp:1.25 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/PruneEH.cpp Tue Dec 19 16:09:18 2006 @@ -14,6 +14,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "prune-eh" #include "llvm/Transforms/IPO.h" #include "llvm/CallGraphSCCPass.h" #include "llvm/Constants.h" @@ -27,10 +28,10 @@ #include using namespace llvm; -namespace { - Statistic NumRemoved("prune-eh", "Number of invokes removed"); - Statistic NumUnreach("prune-eh", "Number of noreturn calls optimized"); +STATISTIC(NumRemoved, "Number of invokes removed"); +STATISTIC(NumUnreach, "Number of noreturn calls optimized"); +namespace { struct PruneEH : public CallGraphSCCPass { /// DoesNotUnwind - This set contains all of the functions which we have /// determined cannot unwind. Index: llvm/lib/Transforms/IPO/RaiseAllocations.cpp diff -u llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.33 llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.34 --- llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.33 Tue Dec 12 18:50:17 2006 +++ llvm/lib/Transforms/IPO/RaiseAllocations.cpp Tue Dec 19 16:09:18 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "raiseallocs" #include "llvm/Transforms/IPO.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -22,9 +23,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumRaised("raiseallocs", "Number of allocations raised"); +STATISTIC(NumRaised, "Number of allocations raised"); +namespace { // RaiseAllocations - Turn %malloc and %free calls into the appropriate // instruction. // Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.76 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.77 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.76 Wed Dec 13 02:04:32 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Tue Dec 19 16:09:18 2006 @@ -31,17 +31,15 @@ #include "llvm/Transforms/IPO.h" using namespace llvm; -namespace { - /// This statistic keeps track of the total number of library calls that have /// been simplified regardless of which call it is. -Statistic SimplifiedLibCalls("simplify-libcalls", - "Number of library calls simplified"); - -// Forward declarations -class LibCallOptimization; -class SimplifyLibCalls; +STATISTIC(SimplifiedLibCalls, "Number of library calls simplified"); +namespace { + // Forward declarations + class LibCallOptimization; + class SimplifyLibCalls; + /// This list is populated by the constructor for LibCallOptimization class. /// Therefore all subclasses are registered here at static initialization time /// and this list is what the SimplifyLibCalls pass uses to apply the individual From sabre at nondot.org Tue Dec 19 16:17:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:17:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/LevelRaise.cpp Message-ID: <200612192217.kBJMHxuD014620@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: LevelRaise.cpp updated: 1.115 -> 1.116 --- Log message: switch more statistics over to STATISTIC, eliminating static ctors. Also, delete some dead ones. --- Diffs of the changes: (+7 -12) LevelRaise.cpp | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-) Index: llvm/lib/Transforms/LevelRaise.cpp diff -u llvm/lib/Transforms/LevelRaise.cpp:1.115 llvm/lib/Transforms/LevelRaise.cpp:1.116 --- llvm/lib/Transforms/LevelRaise.cpp:1.115 Tue Dec 12 18:50:17 2006 +++ llvm/lib/Transforms/LevelRaise.cpp Tue Dec 19 16:17:40 2006 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "raise" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "TransformInternals.h" @@ -34,23 +35,17 @@ StartInst("raise-start-inst", cl::Hidden, cl::value_desc("inst name"), cl::desc("Start raise pass at the instruction with the specified name")); -static Statistic -NumLoadStorePeepholes("raise", "Number of load/store peepholes"); +STATISTIC(NumLoadStorePeepholes, "Number of load/store peepholes"); -static Statistic -NumGEPInstFormed("raise", "Number of other getelementptr's formed"); +STATISTIC(NumGEPInstFormed, "Number of other getelementptr's formed"); -static Statistic -NumExprTreesConv("raise", "Number of expression trees converted"); +STATISTIC(NumExprTreesConv, "Number of expression trees converted"); -static Statistic -NumCastOfCast("raise", "Number of cast-of-self removed"); +STATISTIC(NumCastOfCast, "Number of cast-of-self removed"); -static Statistic -NumDCEorCP("raise", "Number of insts DCEd or constprop'd"); +STATISTIC(NumDCEorCP, "Number of insts DCEd or constprop'd"); -static Statistic -NumVarargCallChanges("raise", "Number of vararg call peepholes"); +STATISTIC(NumVarargCallChanges, "Number of vararg call peepholes"); #define PRINT_PEEPHOLE(ID, NUM, I) \ DOUT << "Inst P/H " << ID << "[" << NUM << "] " << I From sabre at nondot.org Tue Dec 19 16:17:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:17:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp LCSSA.cpp LoopSimplify.cpp LowerAllocations.cpp LowerInvoke.cpp LowerSelect.cpp LowerSwitch.cpp Mem2Reg.cpp Message-ID: <200612192217.kBJMHx8c014643@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: BreakCriticalEdges.cpp updated: 1.37 -> 1.38 LCSSA.cpp updated: 1.31 -> 1.32 LoopSimplify.cpp updated: 1.78 -> 1.79 LowerAllocations.cpp updated: 1.67 -> 1.68 LowerInvoke.cpp updated: 1.46 -> 1.47 LowerSelect.cpp updated: 1.8 -> 1.9 LowerSwitch.cpp updated: 1.29 -> 1.30 Mem2Reg.cpp updated: 1.21 -> 1.22 --- Log message: switch more statistics over to STATISTIC, eliminating static ctors. Also, delete some dead ones. --- Diffs of the changes: (+23 -27) BreakCriticalEdges.cpp | 5 +++-- LCSSA.cpp | 7 +++---- LoopSimplify.cpp | 9 ++++----- LowerAllocations.cpp | 5 +++-- LowerInvoke.cpp | 13 +++++++------ LowerSelect.cpp | 3 --- LowerSwitch.cpp | 3 --- Mem2Reg.cpp | 5 +++-- 8 files changed, 23 insertions(+), 27 deletions(-) Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.37 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.38 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.37 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Tue Dec 19 16:17:40 2006 @@ -16,6 +16,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "break-crit-edges" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Analysis/Dominators.h" @@ -29,9 +30,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumBroken("break-crit-edges", "Number of blocks inserted"); +STATISTIC(NumBroken, "Number of blocks inserted"); +namespace { struct VISIBILITY_HIDDEN BreakCriticalEdges : public FunctionPass { virtual bool runOnFunction(Function &F); Index: llvm/lib/Transforms/Utils/LCSSA.cpp diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.31 llvm/lib/Transforms/Utils/LCSSA.cpp:1.32 --- llvm/lib/Transforms/Utils/LCSSA.cpp:1.31 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/LCSSA.cpp Tue Dec 19 16:17:40 2006 @@ -27,6 +27,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "lcssa" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/Pass.h" @@ -39,13 +40,11 @@ #include "llvm/Support/CFG.h" #include #include - using namespace llvm; +STATISTIC(NumLCSSA, "Number of live out of a loop variables"); + namespace { - static Statistic NumLCSSA("lcssa", - "Number of live out of a loop variables"); - struct LCSSA : public FunctionPass { // Cached analysis information for the current function. LoopInfo *LI; Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.78 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.79 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.78 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/LoopSimplify.cpp Tue Dec 19 16:17:40 2006 @@ -32,6 +32,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "loopsimplify" #include "llvm/Transforms/Scalar.h" #include "llvm/Constant.h" #include "llvm/Instructions.h" @@ -48,12 +49,10 @@ #include "llvm/ADT/DepthFirstIterator.h" using namespace llvm; -namespace { - Statistic - NumInserted("loopsimplify", "Number of pre-header or exit blocks inserted"); - Statistic - NumNested("loopsimplify", "Number of nested loops split out"); +STATISTIC(NumInserted, "Number of pre-header or exit blocks inserted"); +STATISTIC(NumNested , "Number of nested loops split out"); +namespace { struct VISIBILITY_HIDDEN LoopSimplify : public FunctionPass { // AA - If we have an alias analysis object to update, this is it, otherwise // this is null. Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.67 llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.68 --- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.67 Tue Dec 12 18:50:17 2006 +++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Tue Dec 19 16:17:40 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "lowerallocs" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" #include "llvm/Module.h" @@ -24,9 +25,9 @@ #include "llvm/Support/Compiler.h" using namespace llvm; -namespace { - Statistic NumLowered("lowerallocs", "Number of allocations lowered"); +STATISTIC(NumLowered, "Number of allocations lowered"); +namespace { /// LowerAllocations - Turn malloc and free instructions into %malloc and /// %free calls. /// Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.46 llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.47 --- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.46 Mon Dec 11 23:05:00 2006 +++ llvm/lib/Transforms/Utils/LowerInvoke.cpp Tue Dec 19 16:17:40 2006 @@ -34,6 +34,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "lowerinvoke" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -49,14 +50,14 @@ #include using namespace llvm; -namespace { - Statistic NumInvokes("lowerinvoke", "Number of invokes replaced"); - Statistic NumUnwinds("lowerinvoke", "Number of unwinds replaced"); - Statistic NumSpilled("lowerinvoke", - "Number of registers live across unwind edges"); - cl::opt ExpensiveEHSupport("enable-correct-eh-support", +STATISTIC(NumInvokes, "Number of invokes replaced"); +STATISTIC(NumUnwinds, "Number of unwinds replaced"); +STATISTIC(NumSpilled, "Number of registers live across unwind edges"); + +static cl::opt ExpensiveEHSupport("enable-correct-eh-support", cl::desc("Make the -lowerinvoke pass insert expensive, but correct, EH code")); +namespace { class VISIBILITY_HIDDEN LowerInvoke : public FunctionPass { // Used for both models. Function *WriteFn; Index: llvm/lib/Transforms/Utils/LowerSelect.cpp diff -u llvm/lib/Transforms/Utils/LowerSelect.cpp:1.8 llvm/lib/Transforms/Utils/LowerSelect.cpp:1.9 --- llvm/lib/Transforms/Utils/LowerSelect.cpp:1.8 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/LowerSelect.cpp Tue Dec 19 16:17:40 2006 @@ -24,12 +24,9 @@ #include "llvm/Instructions.h" #include "llvm/Pass.h" #include "llvm/Type.h" -#include "llvm/ADT/Statistic.h" using namespace llvm; namespace { - Statistic NumLowered("lowerselect","Number of select instructions lowered"); - /// LowerSelect - Turn select instructions into conditional branches. /// class LowerSelect : public FunctionPass { Index: llvm/lib/Transforms/Utils/LowerSwitch.cpp diff -u llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.29 llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.30 --- llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.29 Sat Dec 16 23:15:13 2006 +++ llvm/lib/Transforms/Utils/LowerSwitch.cpp Tue Dec 19 16:17:40 2006 @@ -21,13 +21,10 @@ #include "llvm/Pass.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Compiler.h" -#include "llvm/ADT/Statistic.h" #include using namespace llvm; namespace { - Statistic NumLowered("lowerswitch", "Number of SwitchInst's replaced"); - /// LowerSwitch Pass - Replace all SwitchInst instructions with chained branch /// instructions. Note that this cannot be a BasicBlock pass because it /// modifies the CFG! Index: llvm/lib/Transforms/Utils/Mem2Reg.cpp diff -u llvm/lib/Transforms/Utils/Mem2Reg.cpp:1.21 llvm/lib/Transforms/Utils/Mem2Reg.cpp:1.22 --- llvm/lib/Transforms/Utils/Mem2Reg.cpp:1.21 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/Mem2Reg.cpp Tue Dec 19 16:17:40 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "mem2reg" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/PromoteMemToReg.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" @@ -23,9 +24,9 @@ #include "llvm/Support/Compiler.h" using namespace llvm; -namespace { - Statistic NumPromoted("mem2reg", "Number of alloca's promoted"); +STATISTIC(NumPromoted, "Number of alloca's promoted"); +namespace { struct VISIBILITY_HIDDEN PromotePass : public FunctionPass { // runOnFunction - To run this pass, first we calculate the alloca // instructions that are safe for promotion, then we promote each one. From sabre at nondot.org Tue Dec 19 16:23:36 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:23:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp Message-ID: <200612192223.kBJMNaPe014756@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: RSProfiling.cpp updated: 1.11 -> 1.12 --- Log message: remove dead statistic --- Diffs of the changes: (+0 -4) RSProfiling.cpp | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.11 llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.12 --- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.11 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp Tue Dec 19 16:23:21 2006 @@ -39,11 +39,9 @@ #include "llvm/DerivedTypes.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Transforms/Instrumentation.h" -//#include "ProfilingUtils.h" #include "RSProfiling.h" #include #include @@ -52,8 +50,6 @@ using namespace llvm; namespace { - Statistic NumBackEdges("bedge", "Number of BackEdges"); - enum RandomMeth { GBV, GBVO, HOSTCC }; From sabre at nondot.org Tue Dec 19 16:24:24 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:24:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Hello/Hello.cpp Message-ID: <200612192224.kBJMOOWT014794@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Hello: Hello.cpp updated: 1.12 -> 1.13 --- Log message: eliminate static ctor from example. --- Diffs of the changes: (+3 -2) Hello.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Hello/Hello.cpp diff -u llvm/lib/Transforms/Hello/Hello.cpp:1.12 llvm/lib/Transforms/Hello/Hello.cpp:1.13 --- llvm/lib/Transforms/Hello/Hello.cpp:1.12 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/Hello/Hello.cpp Tue Dec 19 16:24:09 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "hello" #include "llvm/Pass.h" #include "llvm/Function.h" #include "llvm/ADT/StringExtras.h" @@ -20,9 +21,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(HelloCounter, "Counts number of functions greeted"); + namespace { - Statistic HelloCounter("hellocount", - "Counts number of functions greeted"); // Hello - The first implementation, without getAnalysisUsage. struct Hello : public FunctionPass { virtual bool runOnFunction(Function &F) { From sabre at nondot.org Tue Dec 19 16:30:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:30:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/Andersens.cpp GlobalsModRef.cpp Message-ID: <200612192230.kBJMUoNN014957@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: Andersens.cpp updated: 1.40 -> 1.41 GlobalsModRef.cpp updated: 1.25 -> 1.26 --- Log message: eliminate static ctors from Statistics --- Diffs of the changes: (+14 -27) Andersens.cpp | 17 ++++++----------- GlobalsModRef.cpp | 24 ++++++++---------------- 2 files changed, 14 insertions(+), 27 deletions(-) Index: llvm/lib/Analysis/IPA/Andersens.cpp diff -u llvm/lib/Analysis/IPA/Andersens.cpp:1.40 llvm/lib/Analysis/IPA/Andersens.cpp:1.41 --- llvm/lib/Analysis/IPA/Andersens.cpp:1.40 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Analysis/IPA/Andersens.cpp Tue Dec 19 16:30:33 2006 @@ -64,18 +64,13 @@ #include using namespace llvm; -namespace { - Statistic - NumIters("anders-aa", "Number of iterations to reach convergence"); - Statistic - NumConstraints("anders-aa", "Number of constraints"); - Statistic - NumNodes("anders-aa", "Number of nodes"); - Statistic - NumEscapingFunctions("anders-aa", "Number of internal functions that escape"); - Statistic - NumIndirectCallees("anders-aa", "Number of indirect callees found"); +STATISTIC(NumIters , "Number of iterations to reach convergence"); +STATISTIC(NumConstraints , "Number of constraints"); +STATISTIC(NumNodes , "Number of nodes"); +STATISTIC(NumEscapingFunctions, "Number of internal functions that escape"); +STATISTIC(NumIndirectCallees , "Number of indirect callees found"); +namespace { class Andersens : public ModulePass, public AliasAnalysis, private InstVisitor { /// Node class - This class is used to represent a memory object in the Index: llvm/lib/Analysis/IPA/GlobalsModRef.cpp diff -u llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.25 llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.26 --- llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.25 Wed Dec 6 11:46:31 2006 +++ llvm/lib/Analysis/IPA/GlobalsModRef.cpp Tue Dec 19 16:30:33 2006 @@ -14,6 +14,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "globalsmodref-aa" #include "llvm/Analysis/Passes.h" #include "llvm/Module.h" #include "llvm/Pass.h" @@ -29,23 +30,14 @@ #include using namespace llvm; +STATISTIC(NumNonAddrTakenGlobalVars, + "Number of global vars without address taken"); +STATISTIC(NumNonAddrTakenFunctions,"Number of functions without address taken"); +STATISTIC(NumNoMemFunctions, "Number of functions that do not access memory"); +STATISTIC(NumReadMemFunctions, "Number of functions that only read memory"); +STATISTIC(NumIndirectGlobalVars, "Number of indirect global objects"); + namespace { - Statistic - NumNonAddrTakenGlobalVars("globalsmodref-aa", - "Number of global vars without address taken"); - Statistic - NumNonAddrTakenFunctions("globalsmodref-aa", - "Number of functions without address taken"); - Statistic - NumNoMemFunctions("globalsmodref-aa", - "Number of functions that do not access memory"); - Statistic - NumReadMemFunctions("globalsmodref-aa", - "Number of functions that only read memory"); - Statistic - NumIndirectGlobalVars("globalsmodref-aa", - "Number of indirect global objects"); - /// FunctionRecord - One instance of this structure is stored for every /// function in the program. Later, the entries for these functions are /// removed if the function is found to call an external function (in which From sabre at nondot.org Tue Dec 19 16:30:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:30:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/InstCount.cpp ScalarEvolution.cpp Message-ID: <200612192230.kBJMUo12014964@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: InstCount.cpp updated: 1.18 -> 1.19 ScalarEvolution.cpp updated: 1.73 -> 1.74 --- Log message: eliminate static ctors from Statistics --- Diffs of the changes: (+27 -29) InstCount.cpp | 14 ++++++++------ ScalarEvolution.cpp | 42 +++++++++++++++++++----------------------- 2 files changed, 27 insertions(+), 29 deletions(-) Index: llvm/lib/Analysis/InstCount.cpp diff -u llvm/lib/Analysis/InstCount.cpp:1.18 llvm/lib/Analysis/InstCount.cpp:1.19 --- llvm/lib/Analysis/InstCount.cpp:1.18 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Analysis/InstCount.cpp Tue Dec 19 16:30:33 2006 @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "instcount" #include "llvm/Analysis/Passes.h" #include "llvm/Pass.h" #include "llvm/Function.h" @@ -20,17 +21,18 @@ #include using namespace llvm; -namespace { - Statistic TotalInsts ("instcount", "Number of instructions (of all types)"); - Statistic TotalBlocks("instcount", "Number of basic blocks"); - Statistic TotalFuncs ("instcount", "Number of non-external functions"); - Statistic TotalMemInst("instcount", "Number of memory instructions"); +STATISTIC(TotalInsts , "Number of instructions (of all types)"); +STATISTIC(TotalBlocks, "Number of basic blocks"); +STATISTIC(TotalFuncs , "Number of non-external functions"); +STATISTIC(TotalMemInst, "Number of memory instructions"); #define HANDLE_INST(N, OPCODE, CLASS) \ - Statistic Num##OPCODE##Inst("instcount", "Number of " #OPCODE " insts"); + STATISTIC(Num ## OPCODE ## Inst, "Number of " #OPCODE " insts"); #include "llvm/Instruction.def" + +namespace { class InstCount : public FunctionPass, public InstVisitor { friend class InstVisitor; Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.73 llvm/lib/Analysis/ScalarEvolution.cpp:1.74 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.73 Mon Dec 18 19:16:02 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Tue Dec 19 16:30:33 2006 @@ -59,6 +59,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "scalar-evolution" #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -82,32 +83,27 @@ #include using namespace llvm; +STATISTIC(NumBruteForceEvaluations, + "Number of brute force evaluations needed to " + "calculate high-order polynomial exit values"); +STATISTIC(NumArrayLenItCounts, + "Number of trip counts computed with array length"); +STATISTIC(NumTripCountsComputed, + "Number of loops with predictable loop counts"); +STATISTIC(NumTripCountsNotComputed, + "Number of loops without predictable loop counts"); +STATISTIC(NumBruteForceTripCountsComputed, + "Number of loops with trip counts computed by force"); + +cl::opt +MaxBruteForceIterations("scalar-evolution-max-iterations", cl::ReallyHidden, + cl::desc("Maximum number of iterations SCEV will " + "symbolically execute a constant derived loop"), + cl::init(100)); + namespace { RegisterPass R("scalar-evolution", "Scalar Evolution Analysis"); - - Statistic - NumBruteForceEvaluations("scalar-evolution", - "Number of brute force evaluations needed to " - "calculate high-order polynomial exit values"); - Statistic - NumArrayLenItCounts("scalar-evolution", - "Number of trip counts computed with array length"); - Statistic - NumTripCountsComputed("scalar-evolution", - "Number of loops with predictable loop counts"); - Statistic - NumTripCountsNotComputed("scalar-evolution", - "Number of loops without predictable loop counts"); - Statistic - NumBruteForceTripCountsComputed("scalar-evolution", - "Number of loops with trip counts computed by force"); - - cl::opt - MaxBruteForceIterations("scalar-evolution-max-iterations", cl::ReallyHidden, - cl::desc("Maximum number of iterations SCEV will " - "symbolically execute a constant derived loop"), - cl::init(100)); } //===----------------------------------------------------------------------===// From sabre at nondot.org Tue Dec 19 16:41:40 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:41:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp ScheduleDAGList.cpp Message-ID: <200612192241.kBJMfeKM015243@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.263 -> 1.264 ScheduleDAGList.cpp updated: 1.70 -> 1.71 --- Log message: Eliminate static ctors from Statistics --- Diffs of the changes: (+6 -12) DAGCombiner.cpp | 12 ++++-------- ScheduleDAGList.cpp | 6 ++---- 2 files changed, 6 insertions(+), 12 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.263 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.264 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.263 Sat Dec 16 00:25:23 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Dec 19 16:41:21 2006 @@ -40,15 +40,11 @@ #include using namespace llvm; +STATISTIC(NodesCombined , "Number of dag nodes combined"); +STATISTIC(PreIndexedNodes , "Number of pre-indexed nodes created"); +STATISTIC(PostIndexedNodes, "Number of post-indexed nodes created"); + namespace { - static Statistic NodesCombined ("dagcombiner", - "Number of dag nodes combined"); - - static Statistic PreIndexedNodes ("pre_indexed_ops", - "Number of pre-indexed nodes created"); - static Statistic PostIndexedNodes ("post_indexed_ops", - "Number of post-indexed nodes created"); - static cl::opt CombinerAA("combiner-alias-analysis", cl::Hidden, cl::desc("Turn on alias analysis during testing")); Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.70 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.71 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp:1.70 Thu Dec 7 14:04:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Tue Dec 19 16:41:21 2006 @@ -34,10 +34,8 @@ #include using namespace llvm; -namespace { - static Statistic NumNoops ("scheduler", "Number of noops inserted"); - static Statistic NumStalls("scheduler", "Number of pipeline stalls"); -} +STATISTIC(NumNoops , "Number of noops inserted"); +STATISTIC(NumStalls, "Number of pipeline stalls"); static RegisterScheduler tdListDAGScheduler("list-td", " Top-down list scheduler", From sabre at nondot.org Tue Dec 19 16:41:40 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:41:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp LiveIntervalAnalysis.cpp PHIElimination.cpp RegAllocLinearScan.cpp RegAllocLocal.cpp RegAllocSimple.cpp TwoAddressInstructionPass.cpp VirtRegMap.cpp Message-ID: <200612192241.kBJMfeE5015238@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.38 -> 1.39 LiveIntervalAnalysis.cpp updated: 1.203 -> 1.204 PHIElimination.cpp updated: 1.52 -> 1.53 RegAllocLinearScan.cpp updated: 1.135 -> 1.136 RegAllocLocal.cpp updated: 1.98 -> 1.99 RegAllocSimple.cpp updated: 1.81 -> 1.82 TwoAddressInstructionPass.cpp updated: 1.44 -> 1.45 VirtRegMap.cpp updated: 1.91 -> 1.92 --- Log message: Eliminate static ctors from Statistics --- Diffs of the changes: (+37 -52) BranchFolding.cpp | 6 +++--- LiveIntervalAnalysis.cpp | 21 ++++++--------------- PHIElimination.cpp | 7 ++++--- RegAllocLinearScan.cpp | 15 ++++++--------- RegAllocLocal.cpp | 9 ++++----- RegAllocSimple.cpp | 6 +++--- TwoAddressInstructionPass.cpp | 11 ++++------- VirtRegMap.cpp | 14 +++++++------- 8 files changed, 37 insertions(+), 52 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.38 llvm/lib/CodeGen/BranchFolding.cpp:1.39 --- llvm/lib/CodeGen/BranchFolding.cpp:1.38 Wed Dec 6 11:46:31 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Tue Dec 19 16:41:21 2006 @@ -30,9 +30,9 @@ #include using namespace llvm; -static Statistic NumDeadBlocks("branchfold", "Number of dead blocks removed"); -static Statistic NumBranchOpts("branchfold", "Number of branches optimized"); -static Statistic NumTailMerge ("branchfold", "Number of block tails merged"); +STATISTIC(NumDeadBlocks, "Number of dead blocks removed"); +STATISTIC(NumBranchOpts, "Number of branches optimized"); +STATISTIC(NumTailMerge , "Number of block tails merged"); static cl::opt EnableTailMerge("enable-tail-merge", cl::Hidden); namespace { Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.203 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.204 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.203 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Dec 19 16:41:21 2006 @@ -36,24 +36,15 @@ #include using namespace llvm; +STATISTIC(numIntervals, "Number of original intervals"); +STATISTIC(numIntervalsAfter, "Number of intervals after coalescing"); +STATISTIC(numJoins , "Number of interval joins performed"); +STATISTIC(numPeep , "Number of identity moves eliminated after coalescing"); +STATISTIC(numFolded , "Number of loads/stores folded into instructions"); + namespace { RegisterPass X("liveintervals", "Live Interval Analysis"); - static Statistic numIntervals - ("liveintervals", "Number of original intervals"); - - static Statistic numIntervalsAfter - ("liveintervals", "Number of intervals after coalescing"); - - static Statistic numJoins - ("liveintervals", "Number of interval joins performed"); - - static Statistic numPeep - ("liveintervals", "Number of identity moves eliminated after coalescing"); - - static Statistic numFolded - ("liveintervals", "Number of loads/stores folded into instructions"); - static cl::opt EnableJoining("join-liveintervals", cl::desc("Coallesce copies (default=true)"), Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.52 llvm/lib/CodeGen/PHIElimination.cpp:1.53 --- llvm/lib/CodeGen/PHIElimination.cpp:1.52 Wed Dec 6 11:46:31 2006 +++ llvm/lib/CodeGen/PHIElimination.cpp Tue Dec 19 16:41:21 2006 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "phielim" #include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -28,10 +29,10 @@ #include using namespace llvm; +STATISTIC(NumAtomic, "Number of atomic phis lowered"); +//STATISTIC(NumSimple, "Number of simple phis lowered"); + namespace { - static Statistic NumAtomic("phielim", "Number of atomic phis lowered"); - static Statistic NumSimple("phielim", "Number of simple phis lowered"); - struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { analyzePHINodes(Fn); Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.135 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.136 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.135 Wed Dec 6 11:46:31 2006 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Dec 19 16:41:21 2006 @@ -35,17 +35,14 @@ #include using namespace llvm; -namespace { +STATISTIC(NumIters , "Number of iterations performed"); +STATISTIC(NumBacktracks, "Number of times we had to backtrack"); - static Statistic NumIters - ("regalloc", "Number of iterations performed"); - static Statistic NumBacktracks - ("regalloc", "Number of times we had to backtrack"); - - static RegisterRegAlloc - linearscanRegAlloc("linearscan", " linear scan register allocator", - createLinearScanRegisterAllocator); +static RegisterRegAlloc +linearscanRegAlloc("linearscan", " linear scan register allocator", + createLinearScanRegisterAllocator); +namespace { static unsigned numIterations = 0; static unsigned numIntervals = 0; Index: llvm/lib/CodeGen/RegAllocLocal.cpp diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.98 llvm/lib/CodeGen/RegAllocLocal.cpp:1.99 --- llvm/lib/CodeGen/RegAllocLocal.cpp:1.98 Thu Dec 7 14:04:42 2006 +++ llvm/lib/CodeGen/RegAllocLocal.cpp Tue Dec 19 16:41:21 2006 @@ -32,12 +32,11 @@ #include using namespace llvm; -namespace { - static Statistic NumStores("ra-local", "Number of stores added"); - static Statistic NumLoads ("ra-local", "Number of loads added"); - static Statistic NumFolded("ra-local", "Number of loads/stores folded " - "into instructions"); +STATISTIC(NumStores, "Number of stores added"); +STATISTIC(NumLoads , "Number of loads added"); +STATISTIC(NumFolded, "Number of loads/stores folded into instructions"); +namespace { static RegisterRegAlloc localRegAlloc("local", " local register allocator", createLocalRegisterAllocator); Index: llvm/lib/CodeGen/RegAllocSimple.cpp diff -u llvm/lib/CodeGen/RegAllocSimple.cpp:1.81 llvm/lib/CodeGen/RegAllocSimple.cpp:1.82 --- llvm/lib/CodeGen/RegAllocSimple.cpp:1.81 Fri Dec 8 12:45:48 2006 +++ llvm/lib/CodeGen/RegAllocSimple.cpp Tue Dec 19 16:41:21 2006 @@ -29,10 +29,10 @@ #include "llvm/ADT/STLExtras.h" using namespace llvm; -namespace { - static Statistic NumStores("ra-simple", "Number of stores added"); - static Statistic NumLoads ("ra-simple", "Number of loads added"); +STATISTIC(NumStores, "Number of stores added"); +STATISTIC(NumLoads , "Number of loads added"); +namespace { static RegisterRegAlloc simpleRegAlloc("simple", " simple register allocator", createSimpleRegisterAllocator); Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp diff -u llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.44 llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.45 --- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.44 Thu Dec 7 14:28:15 2006 +++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp Tue Dec 19 16:41:21 2006 @@ -43,14 +43,11 @@ #include "llvm/ADT/STLExtras.h" using namespace llvm; -namespace { - static Statistic NumTwoAddressInstrs("twoaddressinstruction", - "Number of two-address instructions"); - static Statistic NumCommuted("twoaddressinstruction", - "Number of instructions commuted to coalesce"); - static Statistic NumConvertedTo3Addr("twoaddressinstruction", - "Number of instructions promoted to 3-address"); +STATISTIC(NumTwoAddressInstrs, "Number of two-address instructions"); +STATISTIC(NumCommuted , "Number of instructions commuted to coalesce"); +STATISTIC(NumConvertedTo3Addr, "Number of instructions promoted to 3-address"); +namespace { struct VISIBILITY_HIDDEN TwoAddressInstructionPass : public MachineFunctionPass { virtual void getAnalysisUsage(AnalysisUsage &AU) const; Index: llvm/lib/CodeGen/VirtRegMap.cpp diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.91 llvm/lib/CodeGen/VirtRegMap.cpp:1.92 --- llvm/lib/CodeGen/VirtRegMap.cpp:1.91 Sat Dec 16 23:15:13 2006 +++ llvm/lib/CodeGen/VirtRegMap.cpp Tue Dec 19 16:41:21 2006 @@ -32,14 +32,14 @@ #include using namespace llvm; -namespace { - static Statistic NumSpills("spiller", "Number of register spills"); - static Statistic NumStores("spiller", "Number of stores added"); - static Statistic NumLoads ("spiller", "Number of loads added"); - static Statistic NumReused("spiller", "Number of values reused"); - static Statistic NumDSE ("spiller", "Number of dead stores elided"); - static Statistic NumDCE ("spiller", "Number of copies elided"); +STATISTIC(NumSpills, "Number of register spills"); +STATISTIC(NumStores, "Number of stores added"); +STATISTIC(NumLoads , "Number of loads added"); +STATISTIC(NumReused, "Number of values reused"); +STATISTIC(NumDSE , "Number of dead stores elided"); +STATISTIC(NumDCE , "Number of copies elided"); +namespace { enum SpillerName { simple, local }; static cl::opt From reid at x10sys.com Tue Dec 19 16:42:32 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 16:42:32 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ConstProp/2006-11-30-vector-cast.ll Message-ID: <200612192242.kBJMgWif015270@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ConstProp: 2006-11-30-vector-cast.ll updated: 1.2 -> 1.3 --- Log message: Update this test because constant integers are always printed signed now. --- Diffs of the changes: (+1 -1) 2006-11-30-vector-cast.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/ConstProp/2006-11-30-vector-cast.ll diff -u llvm/test/Regression/Transforms/ConstProp/2006-11-30-vector-cast.ll:1.2 llvm/test/Regression/Transforms/ConstProp/2006-11-30-vector-cast.ll:1.3 --- llvm/test/Regression/Transforms/ConstProp/2006-11-30-vector-cast.ll:1.2 Fri Dec 1 22:23:09 2006 +++ llvm/test/Regression/Transforms/ConstProp/2006-11-30-vector-cast.ll Tue Dec 19 16:42:17 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | grep 4294967295 && +; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | grep 'uint -1' && ; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | not grep zeroinitializer < 4 x uint> %test() { From sabre at nondot.org Tue Dec 19 16:43:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:43:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200612192243.kBJMhoHN015329@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JITEmitter.cpp updated: 1.123 -> 1.124 --- Log message: remove static ctors from Statistic objects --- Diffs of the changes: (+3 -6) JITEmitter.cpp | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.123 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.124 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.123 Thu Dec 14 16:53:42 2006 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Tue Dec 19 16:43:32 2006 @@ -33,12 +33,9 @@ #include using namespace llvm; -namespace { - Statistic NumBytes("jit", "Number of bytes of machine code compiled"); - Statistic NumRelos("jit", "Number of relocations applied"); - JIT *TheJIT = 0; -} - +STATISTIC(NumBytes, "Number of bytes of machine code compiled"); +STATISTIC(NumRelos, "Number of relocations applied"); +static JIT *TheJIT = 0; //===----------------------------------------------------------------------===// // JITMemoryManager code. From sabre at nondot.org Tue Dec 19 16:43:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:43:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200612192243.kBJMholI015324@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.92 -> 1.93 --- Log message: remove static ctors from Statistic objects --- Diffs of the changes: (+2 -4) ExecutionEngine.cpp | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.92 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.93 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.92 Wed Dec 6 19:30:31 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Tue Dec 19 16:43:32 2006 @@ -26,10 +26,8 @@ #include "llvm/Target/TargetData.h" using namespace llvm; -namespace { - Statistic NumInitBytes("lli", "Number of bytes of global vars initialized"); - Statistic NumGlobals ("lli", "Number of global vars initialized"); -} +STATISTIC(NumInitBytes, "Number of bytes of global vars initialized"); +STATISTIC(NumGlobals , "Number of global vars initialized"); ExecutionEngine::EECtorFn ExecutionEngine::JITCtor = 0; ExecutionEngine::EECtorFn ExecutionEngine::InterpCtor = 0; From criswell at cs.uiuc.edu Tue Dec 19 16:56:27 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 19 Dec 2006 16:56:27 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/Statistic.h Message-ID: <200612192256.QAA03161@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: Statistic.h updated: 1.21 -> 1.22 --- Log message: Added operator methods to the Statistic class; some LLVM projects depend on these. --- Diffs of the changes: (+13 -1) Statistic.h | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletion(-) Index: llvm/include/llvm/ADT/Statistic.h diff -u llvm/include/llvm/ADT/Statistic.h:1.21 llvm/include/llvm/ADT/Statistic.h:1.22 --- llvm/include/llvm/ADT/Statistic.h:1.21 Tue Dec 19 15:27:47 2006 +++ llvm/include/llvm/ADT/Statistic.h Tue Dec 19 16:55:57 2006 @@ -51,7 +51,7 @@ const StatisticBase &operator*=(const unsigned &V) {Value *= V;return init();} const StatisticBase &operator/=(const unsigned &V) {Value /= V;return init();} -private: +protected: StatisticBase &init() { if (!Initialized) RegisterStatistic(); return *this; @@ -63,6 +63,18 @@ Statistic(const char *name, const char *desc) { Name = name; Desc = desc; Value = 0; Initialized = 0; } + + // Allow use of this class as the value itself. + operator unsigned() const { return Value; } + const Statistic &operator=(unsigned Val) { Value = Val; init(); return *this;} + const Statistic &operator++() { ++Value; init(); return *this;} + unsigned operator++(int) { init(); return Value++; } + const Statistic &operator--() { --Value; init(); return *this;} + unsigned operator--(int) { init(); return Value--; } + const Statistic &operator+=(const unsigned &V) {Value += V;init();return *this;} + const Statistic &operator-=(const unsigned &V) {Value -= V;init();return *this;} + const Statistic &operator*=(const unsigned &V) {Value *= V;init();return *this;} + const Statistic &operator/=(const unsigned &V) {Value /= V;init();return *this;} }; From sabre at nondot.org Tue Dec 19 16:57:08 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:57:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Message-ID: <200612192257.kBJMv8Ma015652@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.152 -> 1.153 --- Log message: elimiante Statistic static ctors --- Diffs of the changes: (+2 -5) Execution.cpp | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.152 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.153 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.152 Wed Dec 6 19:30:31 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Tue Dec 19 16:56:53 2006 @@ -23,11 +23,8 @@ #include using namespace llvm; -namespace { - Statistic NumDynamicInsts("lli", "Number of dynamic instructions executed"); - - Interpreter *TheEE = 0; -} +STATISTIC(NumDynamicInsts, "Number of dynamic instructions executed"); +static Interpreter *TheEE = 0; //===----------------------------------------------------------------------===// From sabre at nondot.org Tue Dec 19 16:59:45 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:59:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64AsmPrinter.cpp IA64Bundling.cpp IA64ISelDAGToDAG.cpp Message-ID: <200612192259.kBJMxj5J015813@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64AsmPrinter.cpp updated: 1.40 -> 1.41 IA64Bundling.cpp updated: 1.6 -> 1.7 IA64ISelDAGToDAG.cpp updated: 1.63 -> 1.64 --- Log message: eliminate static ctors for Statistic objects. --- Diffs of the changes: (+7 -8) IA64AsmPrinter.cpp | 5 +++-- IA64Bundling.cpp | 5 +++-- IA64ISelDAGToDAG.cpp | 5 +---- 3 files changed, 7 insertions(+), 8 deletions(-) Index: llvm/lib/Target/IA64/IA64AsmPrinter.cpp diff -u llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.40 llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.41 --- llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.40 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/IA64/IA64AsmPrinter.cpp Tue Dec 19 16:59:26 2006 @@ -16,6 +16,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "IA64.h" #include "IA64TargetMachine.h" #include "llvm/Module.h" @@ -28,9 +29,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(EmittedInsts, "Number of machine instrs printed"); + namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); - struct IA64AsmPrinter : public AsmPrinter { std::set ExternalFunctionNames, ExternalObjectNames; Index: llvm/lib/Target/IA64/IA64Bundling.cpp diff -u llvm/lib/Target/IA64/IA64Bundling.cpp:1.6 llvm/lib/Target/IA64/IA64Bundling.cpp:1.7 --- llvm/lib/Target/IA64/IA64Bundling.cpp:1.6 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/IA64/IA64Bundling.cpp Tue Dec 19 16:59:26 2006 @@ -20,6 +20,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "ia64-codegen" #include "IA64.h" #include "IA64InstrInfo.h" #include "IA64TargetMachine.h" @@ -31,9 +32,9 @@ #include using namespace llvm; -namespace { - Statistic StopBitsAdded("ia64-codegen", "Number of stop bits added"); +STATISTIC(StopBitsAdded, "Number of stop bits added"); +namespace { struct IA64BundlingPass : public MachineFunctionPass { /// Target machine description which we query for reg. names, data /// layout, etc. Index: llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp diff -u llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.63 llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.64 --- llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.63 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp Tue Dec 19 16:59:26 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "ia64-codegen" #include "IA64.h" #include "IA64TargetMachine.h" #include "IA64ISelLowering.h" @@ -21,7 +22,6 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Constants.h" #include "llvm/GlobalValue.h" #include "llvm/Intrinsics.h" @@ -32,9 +32,6 @@ using namespace llvm; namespace { - Statistic FusedFP ("ia64-codegen", "Number of fused fp operations"); - Statistic FrameOff("ia64-codegen", "Number of frame idx offsets collapsed"); - //===--------------------------------------------------------------------===// /// IA64DAGToDAGISel - IA64 specific code to select IA64 machine /// instructions for SelectionDAG operations. From sabre at nondot.org Tue Dec 19 16:59:49 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:59:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h X86CodeEmitter.cpp X86FloatingPoint.cpp X86ISelDAGToDAG.cpp X86IntelAsmPrinter.cpp Message-ID: <200612192259.kBJMxnwH015834@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.79 -> 1.80 X86AsmPrinter.cpp updated: 1.222 -> 1.223 X86AsmPrinter.h updated: 1.39 -> 1.40 X86CodeEmitter.cpp updated: 1.127 -> 1.128 X86FloatingPoint.cpp updated: 1.66 -> 1.67 X86ISelDAGToDAG.cpp updated: 1.139 -> 1.140 X86IntelAsmPrinter.cpp updated: 1.66 -> 1.67 --- Log message: eliminate static ctors for Statistic objects. --- Diffs of the changes: (+18 -21) X86ATTAsmPrinter.cpp | 4 ++++ X86AsmPrinter.cpp | 4 ---- X86AsmPrinter.h | 3 --- X86CodeEmitter.cpp | 6 ++---- X86FloatingPoint.cpp | 8 ++++---- X86ISelDAGToDAG.cpp | 10 ++++------ X86IntelAsmPrinter.cpp | 4 ++++ 7 files changed, 18 insertions(+), 21 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.79 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.80 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.79 Sun Dec 17 21:37:18 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Tue Dec 19 16:59:26 2006 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "X86ATTAsmPrinter.h" #include "X86.h" #include "X86MachineFunctionInfo.h" @@ -23,8 +24,11 @@ #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(EmittedInsts, "Number of machine instrs printed"); + /// getSectionForFunction - Return the section that we should emit the /// specified function body into. std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const { Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.222 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.223 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.222 Sun Dec 17 21:37:18 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Tue Dec 19 16:59:26 2006 @@ -27,12 +27,8 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" - using namespace llvm; -Statistic llvm::EmittedInsts("asm-printer", - "Number of machine instrs printed"); - static X86FunctionInfo calculateFunctionInfo(const Function *F, const TargetData *TD) { X86FunctionInfo Info; Index: llvm/lib/Target/X86/X86AsmPrinter.h diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.39 llvm/lib/Target/X86/X86AsmPrinter.h:1.40 --- llvm/lib/Target/X86/X86AsmPrinter.h:1.39 Sun Dec 17 21:37:18 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.h Tue Dec 19 16:59:26 2006 @@ -22,15 +22,12 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineDebugInfo.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" #include namespace llvm { -extern Statistic EmittedInsts; - // FIXME: Move this to CodeGen/AsmPrinter.h namespace PICStyle { enum X86AsmPICStyle { Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.127 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.128 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.127 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Tue Dec 19 16:59:26 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "x86-emitter" #include "X86InstrInfo.h" #include "X86Subtarget.h" #include "X86TargetMachine.h" @@ -28,10 +29,7 @@ #include "llvm/Target/TargetOptions.h" using namespace llvm; -namespace { - Statistic - NumEmitted("x86-emitter", "Number of machine instructions emitted"); -} +STATISTIC(NumEmitted, "Number of machine instructions emitted"); namespace { class VISIBILITY_HIDDEN Emitter : public MachineFunctionPass { Index: llvm/lib/Target/X86/X86FloatingPoint.cpp diff -u llvm/lib/Target/X86/X86FloatingPoint.cpp:1.66 llvm/lib/Target/X86/X86FloatingPoint.cpp:1.67 --- llvm/lib/Target/X86/X86FloatingPoint.cpp:1.66 Thu Dec 7 23:41:26 2006 +++ llvm/lib/Target/X86/X86FloatingPoint.cpp Tue Dec 19 16:59:26 2006 @@ -28,7 +28,7 @@ // //===----------------------------------------------------------------------===// -#define DEBUG_TYPE "fp" +#define DEBUG_TYPE "x86-codegen" #include "X86.h" #include "X86InstrInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -47,10 +47,10 @@ #include using namespace llvm; -namespace { - Statistic NumFXCH("x86-codegen", "Number of fxch instructions inserted"); - Statistic NumFP ("x86-codegen", "Number of floating point instructions"); +STATISTIC(NumFXCH, "Number of fxch instructions inserted"); +STATISTIC(NumFP , "Number of floating point instructions"); +namespace { struct VISIBILITY_HIDDEN FPS : public MachineFunctionPass { virtual bool runOnMachineFunction(MachineFunction &MF); Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.139 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.140 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.139 Tue Dec 19 15:31:42 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Dec 19 16:59:26 2006 @@ -38,6 +38,10 @@ #include using namespace llvm; +STATISTIC(NumFPKill , "Number of FP_REG_KILL instructions added"); +STATISTIC(NumLoadMoved, "Number of loads moved below TokenFactor"); + + //===----------------------------------------------------------------------===// // Pattern Matcher Implementation //===----------------------------------------------------------------------===// @@ -75,12 +79,6 @@ } namespace { - Statistic - NumFPKill("x86-codegen", "Number of FP_REG_KILL instructions added"); - - Statistic - NumLoadMoved("x86-codegen", "Number of loads moved below TokenFactor"); - //===--------------------------------------------------------------------===// /// ISel - X86 specific code to select X86 machine instructions for /// SelectionDAG operations. Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.66 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.67 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.66 Tue Dec 19 15:04:20 2006 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Tue Dec 19 16:59:26 2006 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "X86IntelAsmPrinter.h" #include "X86TargetAsmInfo.h" #include "X86.h" @@ -23,8 +24,11 @@ #include "llvm/Support/Mangler.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(EmittedInsts, "Number of machine instrs printed"); + std::string X86IntelAsmPrinter::getSectionForFunction(const Function &F) const { // Intel asm always emits functions to _text. return "_text"; From sabre at nondot.org Tue Dec 19 16:59:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:59:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMAsmPrinter.cpp Message-ID: <200612192259.kBJMxpTf015839@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMAsmPrinter.cpp updated: 1.40 -> 1.41 --- Log message: eliminate static ctors for Statistic objects. --- Diffs of the changes: (+4 -2) ARMAsmPrinter.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.40 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.41 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.40 Sun Dec 17 21:37:18 2006 +++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp Tue Dec 19 16:59:25 2006 @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "ARM.h" #include "ARMInstrInfo.h" #include "llvm/Constants.h" @@ -33,9 +34,9 @@ #include using namespace llvm; -namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); +STATISTIC(EmittedInsts, "Number of machine instrs printed"); +namespace { static const char *ARMCondCodeToString(ARMCC::CondCodes CC) { switch (CC) { default: assert(0 && "Unknown condition code"); @@ -144,6 +145,7 @@ II != E; ++II) { // Print the assembly for the instruction. O << "\t"; + ++EmittedInsts; printInstruction(II); } } From sabre at nondot.org Tue Dec 19 16:59:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:59:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/DelaySlotFiller.cpp FPMover.cpp SparcAsmPrinter.cpp Message-ID: <200612192259.kBJMxpqU015855@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: DelaySlotFiller.cpp updated: 1.12 -> 1.13 FPMover.cpp updated: 1.17 -> 1.18 SparcAsmPrinter.cpp updated: 1.74 -> 1.75 --- Log message: eliminate static ctors for Statistic objects. --- Diffs of the changes: (+10 -7) DelaySlotFiller.cpp | 5 +++-- FPMover.cpp | 7 ++++--- SparcAsmPrinter.cpp | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) Index: llvm/lib/Target/Sparc/DelaySlotFiller.cpp diff -u llvm/lib/Target/Sparc/DelaySlotFiller.cpp:1.12 llvm/lib/Target/Sparc/DelaySlotFiller.cpp:1.13 --- llvm/lib/Target/Sparc/DelaySlotFiller.cpp:1.12 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Target/Sparc/DelaySlotFiller.cpp Tue Dec 19 16:59:26 2006 @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "delayslotfiller" #include "Sparc.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -19,9 +20,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic FilledSlots("delayslotfiller", "Num. of delay slots filled"); +STATISTIC(FilledSlots, "Number of delay slots filled"); +namespace { struct Filler : public MachineFunctionPass { /// Target machine description which we query for reg. names, data /// layout, etc. Index: llvm/lib/Target/Sparc/FPMover.cpp diff -u llvm/lib/Target/Sparc/FPMover.cpp:1.17 llvm/lib/Target/Sparc/FPMover.cpp:1.18 --- llvm/lib/Target/Sparc/FPMover.cpp:1.17 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/Sparc/FPMover.cpp Tue Dec 19 16:59:26 2006 @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "fpmover" #include "Sparc.h" #include "SparcSubtarget.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -21,10 +22,10 @@ #include "llvm/Support/Debug.h" using namespace llvm; -namespace { - Statistic NumFpDs("fpmover", "Number of instructions translated"); - Statistic NoopFpDs("fpmover", "Number of noop instructions removed"); +STATISTIC(NumFpDs , "Number of instructions translated"); +STATISTIC(NoopFpDs, "Number of noop instructions removed"); +namespace { struct FPMover : public MachineFunctionPass { /// Target machine description which we query for reg. names, data /// layout, etc. Index: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp diff -u llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.74 llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.75 --- llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.74 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/Sparc/SparcAsmPrinter.cpp Tue Dec 19 16:59:26 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "Sparc.h" #include "SparcInstrInfo.h" #include "llvm/Constants.h" @@ -32,9 +33,9 @@ #include using namespace llvm; -namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); +STATISTIC(EmittedInsts, "Number of machine instrs printed"); +namespace { struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter { SparcAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T) : AsmPrinter(O, TM, T) { From sabre at nondot.org Tue Dec 19 16:59:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:59:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCBranchSelector.cpp PPCISelDAGToDAG.cpp Message-ID: <200612192259.kBJMxpqN015868@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.222 -> 1.223 PPCBranchSelector.cpp updated: 1.40 -> 1.41 PPCISelDAGToDAG.cpp updated: 1.228 -> 1.229 --- Log message: eliminate static ctors for Statistic objects. --- Diffs of the changes: (+5 -7) PPCAsmPrinter.cpp | 4 ++-- PPCBranchSelector.cpp | 4 ++-- PPCISelDAGToDAG.cpp | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.222 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.223 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.222 Sun Dec 17 21:37:18 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Dec 19 16:59:26 2006 @@ -44,9 +44,9 @@ #include using namespace llvm; -namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); +STATISTIC(EmittedInsts, "Number of machine instrs printed"); +namespace { struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter { std::set FnStubs, GVStubs; const PPCSubtarget &Subtarget; Index: llvm/lib/Target/PowerPC/PPCBranchSelector.cpp diff -u llvm/lib/Target/PowerPC/PPCBranchSelector.cpp:1.40 llvm/lib/Target/PowerPC/PPCBranchSelector.cpp:1.41 --- llvm/lib/Target/PowerPC/PPCBranchSelector.cpp:1.40 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Target/PowerPC/PPCBranchSelector.cpp Tue Dec 19 16:59:26 2006 @@ -15,6 +15,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "ppc-branch-select" #include "PPC.h" #include "PPCInstrBuilder.h" #include "PPCInstrInfo.h" @@ -27,8 +28,7 @@ #include "llvm/Support/MathExtras.h" using namespace llvm; -static Statistic NumExpanded("ppc-branch-select", - "Num branches expanded to long format"); +STATISTIC(NumExpanded, "Number of branches expanded to long format"); namespace { struct VISIBILITY_HIDDEN PPCBSel : public MachineFunctionPass { Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.228 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.229 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.228 Tue Dec 12 07:23:43 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue Dec 19 16:59:26 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "ppc-codegen" #include "PPC.h" #include "PPCPredicates.h" #include "PPCTargetMachine.h" @@ -23,7 +24,6 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Constants.h" #include "llvm/GlobalValue.h" #include "llvm/Intrinsics.h" @@ -35,8 +35,6 @@ using namespace llvm; namespace { - Statistic FrameOff("ppc-codegen", "Number of frame idx offsets collapsed"); - //===--------------------------------------------------------------------===// /// PPCDAGToDAGISel - PPC specific code to select PPC machine /// instructions for SelectionDAG operations. From sabre at nondot.org Tue Dec 19 16:59:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 16:59:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp AlphaCodeEmitter.cpp AlphaISelDAGToDAG.cpp AlphaLLRP.cpp Message-ID: <200612192259.kBJMxpV6015856@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.59 -> 1.60 AlphaCodeEmitter.cpp updated: 1.20 -> 1.21 AlphaISelDAGToDAG.cpp updated: 1.63 -> 1.64 AlphaLLRP.cpp updated: 1.6 -> 1.7 --- Log message: eliminate static ctors for Statistic objects. --- Diffs of the changes: (+10 -15) AlphaAsmPrinter.cpp | 5 +++-- AlphaCodeEmitter.cpp | 7 +------ AlphaISelDAGToDAG.cpp | 1 - AlphaLLRP.cpp | 12 ++++++------ 4 files changed, 10 insertions(+), 15 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.59 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.60 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.59 Thu Dec 7 17:55:55 2006 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Tue Dec 19 16:59:25 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "asm-printer" #include "Alpha.h" #include "AlphaInstrInfo.h" #include "AlphaTargetMachine.h" @@ -26,9 +27,9 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(EmittedInsts, "Number of machine instrs printed"); + namespace { - Statistic EmittedInsts("asm-printer", "Number of machine instrs printed"); - struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter { /// Unique incrementer for label values for referencing Global values. Index: llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp diff -u llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:1.20 llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:1.21 --- llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp:1.20 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp Tue Dec 19 16:59:25 2006 @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "alpha-emitter" #include "AlphaTargetMachine.h" #include "AlphaRelocations.h" #include "Alpha.h" @@ -22,15 +23,9 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Function.h" #include "llvm/Support/Debug.h" -#include "llvm/ADT/Statistic.h" using namespace llvm; namespace { - Statistic - NumEmitted("alpha-emitter", "Number of machine instructions emitted"); -} - -namespace { class AlphaCodeEmitter : public MachineFunctionPass { const AlphaInstrInfo *II; TargetMachine &TM; Index: llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp diff -u llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.63 llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.64 --- llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.63 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Tue Dec 19 16:59:25 2006 @@ -22,7 +22,6 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/ADT/Statistic.h" #include "llvm/Constants.h" #include "llvm/GlobalValue.h" #include "llvm/Intrinsics.h" Index: llvm/lib/Target/Alpha/AlphaLLRP.cpp diff -u llvm/lib/Target/Alpha/AlphaLLRP.cpp:1.6 llvm/lib/Target/Alpha/AlphaLLRP.cpp:1.7 --- llvm/lib/Target/Alpha/AlphaLLRP.cpp:1.6 Thu Dec 7 17:55:55 2006 +++ llvm/lib/Target/Alpha/AlphaLLRP.cpp Tue Dec 19 16:59:25 2006 @@ -8,10 +8,11 @@ //===----------------------------------------------------------------------===// // // Here we check for potential replay traps introduced by the spiller -// We also align some branch targets if we can do so for free +// We also align some branch targets if we can do so for free. +// //===----------------------------------------------------------------------===// - +#define DEBUG_TYPE "alpha-nops" #include "Alpha.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -22,11 +23,10 @@ #include "llvm/Support/CommandLine.h" using namespace llvm; -namespace { - Statistic nopintro("alpha-nops", "Number of nops inserted"); - Statistic nopalign("alpha-nops-align", - "Number of nops inserted for alignment"); +STATISTIC(nopintro, "Number of nops inserted"); +STATISTIC(nopalign, "Number of nops inserted for alignment"); +namespace { cl::opt AlignAll("alpha-align-all", cl::Hidden, cl::desc("Align all blocks")); From sabre at nondot.org Tue Dec 19 17:03:56 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 17:03:56 -0600 Subject: [llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Message-ID: <200612192303.kBJN3ua0016021@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/lib/compiler: StackerCompiler.cpp updated: 1.26 -> 1.27 --- Log message: switch statistic over, remove misspelt comment. --- Diffs of the changes: (+2 -6) StackerCompiler.cpp | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.26 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.27 --- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.26 Tue Dec 12 18:47:58 2006 +++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Tue Dec 19 17:03:41 2006 @@ -12,10 +12,7 @@ // //===----------------------------------------------------------------------===// -//===----------------------------------------------------------------------===// -// Globasl - Global variables we use -//===----------------------------------------------------------------------===// - +#define DEBUG_TYPE "stacker" #include "llvm/PassManager.h" #include "llvm/Analysis/LoadValueNumbering.h" #include "llvm/Analysis/Verifier.h" @@ -38,8 +35,7 @@ StackerCompiler* StackerCompiler::TheInstance = 0; -static Statistic NumDefinitions( - "numdefs","The # of definitions encoutered while compiling Stacker"); +STATISTIC(NumDefinitions, "The number of definitions encountered"); StackerCompiler::StackerCompiler() : CurFilename("") From criswell at cs.uiuc.edu Tue Dec 19 17:05:05 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 19 Dec 2006 17:05:05 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/include/poolalloc/Config/config.h.in Message-ID: <200612192305.RAA04391@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/poolalloc/Config: config.h.in updated: 1.4 -> 1.5 --- Log message: Disable the PACKAGE_* macros. These are defined in the LLVM config.h file, and we don't really use them anyway. --- Diffs of the changes: (+2 -0) config.h.in | 2 ++ 1 files changed, 2 insertions(+) Index: llvm-poolalloc/include/poolalloc/Config/config.h.in diff -u llvm-poolalloc/include/poolalloc/Config/config.h.in:1.4 llvm-poolalloc/include/poolalloc/Config/config.h.in:1.5 --- llvm-poolalloc/include/poolalloc/Config/config.h.in:1.4 Wed Dec 13 23:51:06 2006 +++ llvm-poolalloc/include/poolalloc/Config/config.h.in Tue Dec 19 17:04:36 2006 @@ -410,6 +410,7 @@ /* Define if dlsym() requires a leading underscore in symbol names. */ #undef NEED_USCORE +#if 0 /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT @@ -424,6 +425,7 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +#endif /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE From criswell at cs.uiuc.edu Tue Dec 19 17:11:09 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 19 Dec 2006 17:11:09 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp TransformFunctionBody.cpp Message-ID: <200612192311.RAA07461@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PoolAllocate.cpp updated: 1.129 -> 1.130 TransformFunctionBody.cpp updated: 1.59 -> 1.60 --- Log message: Update to latest LLVM by updating all getCast() constant expressions. --- Diffs of the changes: (+2 -2) PoolAllocate.cpp | 2 +- TransformFunctionBody.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.129 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.130 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.129 Wed Dec 13 23:51:07 2006 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Tue Dec 19 17:10:34 2006 @@ -162,7 +162,7 @@ for (std::map::iterator I = FuncMap.begin(), E = FuncMap.end(); I != E; ++I) { Function *F = I->first; - F->replaceAllUsesWith(ConstantExpr::getCast(I->second, F->getType())); + F->replaceAllUsesWith(ConstantExpr::getPointerCast(I->second, F->getType())); } if (CurHeuristic->IsRealHeuristic()) Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.59 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.60 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.59 Wed Dec 13 23:51:07 2006 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Tue Dec 19 17:10:34 2006 @@ -717,6 +717,6 @@ for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) if (Function *clonedFunc = retCloneIfFunc(I.getOperand(i))) { Constant *CF = clonedFunc; - I.setOperand(i, ConstantExpr::getCast(CF, I.getOperand(i)->getType())); + I.setOperand(i, ConstantExpr::getPointerCast(CF, I.getOperand(i)->getType())); } } From reid at x10sys.com Tue Dec 19 17:12:25 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 19 Dec 2006 17:12:25 -0600 Subject: [llvm-commits] CVS: llvm/docs/ProgrammersManual.html Message-ID: <200612192312.kBJNCPqR016330@zion.cs.uiuc.edu> Changes in directory llvm/docs: ProgrammersManual.html updated: 1.98 -> 1.99 --- Log message: Remove documentation for isSigned and isUnsigned methods of Type class. --- Diffs of the changes: (+2 -12) ProgrammersManual.html | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-) Index: llvm/docs/ProgrammersManual.html diff -u llvm/docs/ProgrammersManual.html:1.98 llvm/docs/ProgrammersManual.html:1.99 --- llvm/docs/ProgrammersManual.html:1.98 Tue Dec 19 15:46:21 2006 +++ llvm/docs/ProgrammersManual.html Tue Dec 19 17:12:09 2006 @@ -2495,17 +2495,7 @@
      - -
    • bool isSigned() const: Returns whether an integral numeric type - is signed. This is true for SByteTy, ShortTy, IntTy, LongTy. Note that this is - not true for Float and Double.
    • - -
    • bool isUnsigned() const: Returns whether a numeric type is - unsigned. This is not quite the complement of isSigned... nonnumeric types - return false as they do with isSigned. This returns true for UByteTy, - UShortTy, UIntTy, and ULongTy.
    • - -
    • bool isInteger() const: Equivalent to isSigned() || isUnsigned().
    • +
    • bool isInteger() const: True for any integer type.
    • bool isIntegral() const: Returns true if this is an integral type, which is either Bool type or one of the Integer types.
    • @@ -2579,7 +2569,7 @@ Dinakar Dhurjati and Chris Lattner
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2006/12/19 21:46:21 $ + Last modified: $Date: 2006/12/19 23:12:09 $ From sabre at nondot.org Tue Dec 19 17:17:02 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 17:17:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Message-ID: <200612192317.kBJNH2oq016477@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: SimplifyLibCalls.cpp updated: 1.77 -> 1.78 --- Log message: switch statistics over to not use static ctors. --- Diffs of the changes: (+3 -3) SimplifyLibCalls.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.77 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.78 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.77 Tue Dec 19 16:09:18 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Tue Dec 19 17:16:47 2006 @@ -73,11 +73,11 @@ /// optimized by the subclass. /// @brief Constructor that registers the optimization. LibCallOptimization(const char *FName, const char *Description) - : FunctionName(FName) + : FunctionName(FName) { + #ifndef NDEBUG - , occurrences("simplify-libcalls", Description) + occurrences.construct("simplify-libcalls", Description); #endif - { // Register this optimizer in the list of optimizations. Next = OptList; OptList = this; From sabre at nondot.org Tue Dec 19 17:17:04 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 17:17:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200612192317.kBJNH4Yk016483@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.139 -> 1.140 --- Log message: switch statistics over to not use static ctors. --- Diffs of the changes: (+2 -2) Writer.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.139 llvm/lib/Bytecode/Writer/Writer.cpp:1.140 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.139 Sun Dec 17 05:11:10 2006 +++ llvm/lib/Bytecode/Writer/Writer.cpp Tue Dec 19 17:16:47 2006 @@ -17,6 +17,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "bytecodewriter" #include "WriterInternals.h" #include "llvm/Bytecode/WriteBytecodePass.h" #include "llvm/CallingConv.h" @@ -45,8 +46,7 @@ static RegisterPass X("emitbytecode", "Bytecode Writer"); -static Statistic -BytesWritten("bytecodewriter", "Number of bytecode bytes written"); +STATISTIC(BytesWritten, "Number of bytecode bytes written"); //===----------------------------------------------------------------------===// //=== Output Primitives ===// From sabre at nondot.org Tue Dec 19 17:17:56 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 17:17:56 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/Statistic.h Message-ID: <200612192317.kBJNHuhZ016537@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: Statistic.h updated: 1.22 -> 1.23 --- Log message: eliminate constructor from Statistic class. It is now impossible to get a static constructor for them :). Transition complete. --- Diffs of the changes: (+17 -30) Statistic.h | 47 +++++++++++++++++------------------------------ 1 files changed, 17 insertions(+), 30 deletions(-) Index: llvm/include/llvm/ADT/Statistic.h diff -u llvm/include/llvm/ADT/Statistic.h:1.22 llvm/include/llvm/ADT/Statistic.h:1.23 --- llvm/include/llvm/ADT/Statistic.h:1.22 Tue Dec 19 16:55:57 2006 +++ llvm/include/llvm/ADT/Statistic.h Tue Dec 19 17:17:40 2006 @@ -28,7 +28,7 @@ namespace llvm { -class StatisticBase { +class Statistic { public: const char *Name; const char *Desc; @@ -38,50 +38,37 @@ unsigned getValue() const { return Value; } const char *getName() const { return Name; } const char *getDesc() const { return Desc; } - + + /// construct - This should only be called for non-global statistics. + void construct(const char *name, const char *desc) { + Name = name; Desc = desc; + Value = 0; Initialized = 0; + } + // Allow use of this class as the value itself. operator unsigned() const { return Value; } - const StatisticBase &operator=(unsigned Val) { Value = Val; return init(); } - const StatisticBase &operator++() { ++Value; return init(); } + const Statistic &operator=(unsigned Val) { Value = Val; return init(); } + const Statistic &operator++() { ++Value; return init(); } unsigned operator++(int) { init(); return Value++; } - const StatisticBase &operator--() { --Value; return init(); } + const Statistic &operator--() { --Value; return init(); } unsigned operator--(int) { init(); return Value--; } - const StatisticBase &operator+=(const unsigned &V) {Value += V;return init();} - const StatisticBase &operator-=(const unsigned &V) {Value -= V;return init();} - const StatisticBase &operator*=(const unsigned &V) {Value *= V;return init();} - const StatisticBase &operator/=(const unsigned &V) {Value /= V;return init();} + const Statistic &operator+=(const unsigned &V) { Value += V; return init(); } + const Statistic &operator-=(const unsigned &V) { Value -= V; return init(); } + const Statistic &operator*=(const unsigned &V) { Value *= V; return init(); } + const Statistic &operator/=(const unsigned &V) { Value /= V; return init(); } protected: - StatisticBase &init() { + Statistic &init() { if (!Initialized) RegisterStatistic(); return *this; } void RegisterStatistic(); }; -struct Statistic : public StatisticBase { - Statistic(const char *name, const char *desc) { - Name = name; Desc = desc; Value = 0; Initialized = 0; - } - - // Allow use of this class as the value itself. - operator unsigned() const { return Value; } - const Statistic &operator=(unsigned Val) { Value = Val; init(); return *this;} - const Statistic &operator++() { ++Value; init(); return *this;} - unsigned operator++(int) { init(); return Value++; } - const Statistic &operator--() { --Value; init(); return *this;} - unsigned operator--(int) { init(); return Value--; } - const Statistic &operator+=(const unsigned &V) {Value += V;init();return *this;} - const Statistic &operator-=(const unsigned &V) {Value -= V;init();return *this;} - const Statistic &operator*=(const unsigned &V) {Value *= V;init();return *this;} - const Statistic &operator/=(const unsigned &V) {Value /= V;init();return *this;} -}; - - // STATISTIC - A macro to make definition of statistics really simple. This // automatically passes the DEBUG_TYPE of the file into the statistic. #define STATISTIC(VARNAME, DESC) \ - static StatisticBase VARNAME = { DEBUG_TYPE, DESC, 0, 0 } + static Statistic VARNAME = { DEBUG_TYPE, DESC, 0, 0 } } // End llvm namespace From sabre at nondot.org Tue Dec 19 17:17:57 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 17:17:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/Statistic.cpp Message-ID: <200612192317.kBJNHveC016542@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Statistic.cpp updated: 1.24 -> 1.25 --- Log message: eliminate constructor from Statistic class. It is now impossible to get a static constructor for them :). Transition complete. --- Diffs of the changes: (+4 -4) Statistic.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Support/Statistic.cpp diff -u llvm/lib/Support/Statistic.cpp:1.24 llvm/lib/Support/Statistic.cpp:1.25 --- llvm/lib/Support/Statistic.cpp:1.24 Tue Dec 19 15:27:47 2006 +++ llvm/lib/Support/Statistic.cpp Tue Dec 19 17:17:40 2006 @@ -45,11 +45,11 @@ /// on demand (when the first statistic is bumped) and destroyed only when /// llvm_shutdown is called. We print statistics from the destructor. class StatisticInfo { - std::vector Stats; + std::vector Stats; public: ~StatisticInfo(); - void addStatistic(const StatisticBase *S) { + void addStatistic(const Statistic *S) { Stats.push_back(S); } }; @@ -60,7 +60,7 @@ /// RegisterStatistic - The first time a statistic is bumped, this method is /// called. -void StatisticBase::RegisterStatistic() { +void Statistic::RegisterStatistic() { // If stats are enabled, inform StatInfo that this statistic should be // printed. if (Enabled) @@ -70,7 +70,7 @@ } struct NameCompare { - bool operator()(const StatisticBase *LHS, const StatisticBase *RHS) const { + bool operator()(const Statistic *LHS, const Statistic *RHS) const { int Cmp = std::strcmp(LHS->getName(), RHS->getName()); if (Cmp != 0) return Cmp < 0; From asl at math.spbu.ru Tue Dec 19 19:03:35 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 19 Dec 2006 19:03:35 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp Message-ID: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.cpp updated: 1.43 -> 1.44 X86Subtarget.h updated: 1.22 -> 1.23 X86TargetMachine.cpp updated: 1.131 -> 1.132 --- Log message: Fixed dllimported symbols support during JIT'ing. JIT on mingw32 platform should be more or less workable. At least, sim is running fine under lli :) --- Diffs of the changes: (+28 -7) X86Subtarget.cpp | 25 ++++++++++++++++++------- X86Subtarget.h | 7 +++++++ X86TargetMachine.cpp | 3 +++ 3 files changed, 28 insertions(+), 7 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.43 llvm/lib/Target/X86/X86Subtarget.cpp:1.44 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.43 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/X86/X86Subtarget.cpp Tue Dec 19 19:03:20 2006 @@ -32,13 +32,14 @@ /// or index register of the address, not the GV offset field. bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, bool isDirectCall) const { - if (isTargetDarwin()) { - return (!isDirectCall && - (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || - (GV->isExternal() && !GV->hasNotBeenReadFromBytecode()))); - } else if (isTargetCygwin() || isTargetWindows()) { - return (GV->hasDLLImportLinkage()); - } + if (GenerateExtraLoadsForGVs) + if (isTargetDarwin()) { + return (!isDirectCall && + (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || + (GV->isExternal() && !GV->hasNotBeenReadFromBytecode()))); + } else if (isTargetCygwin() || isTargetWindows()) { + return (GV->hasDLLImportLinkage()); + } return false; } @@ -206,6 +207,15 @@ } } +/// SetJITMode - This is called to inform the subtarget info that we are +/// producing code for the JIT. +void X86Subtarget::SetJITMode() { + // JIT mode doesn't want extra loads for dllimported symbols, it knows exactly + // where everything is. + if (isTargetCygwin()) + GenerateExtraLoadsForGVs = false; +} + X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit) : AsmFlavor(AsmWriterFlavor) , X86SSELevel(NoMMXSSE) @@ -214,6 +224,7 @@ // FIXME: this is a known good value for Yonah. How about others? , MinRepStrSizeThreshold(128) , Is64Bit(is64Bit) + , GenerateExtraLoadsForGVs(true) , TargetType(isELF) { // Default to ELF unless otherwise specified. // Determine default and user specified characteristics Index: llvm/lib/Target/X86/X86Subtarget.h diff -u llvm/lib/Target/X86/X86Subtarget.h:1.22 llvm/lib/Target/X86/X86Subtarget.h:1.23 --- llvm/lib/Target/X86/X86Subtarget.h:1.22 Thu Nov 30 16:42:55 2006 +++ llvm/lib/Target/X86/X86Subtarget.h Tue Dec 19 19:03:20 2006 @@ -61,6 +61,9 @@ /// pointer size is 64 bit. bool Is64Bit; + /// GenerateExtraLoadsForGVs - True if we should generate extra loads for + /// indirect symbols (e.g. dllimported symbols on windows). + bool GenerateExtraLoadsForGVs; public: enum { isELF, isCygwin, isDarwin, isWindows @@ -112,6 +115,10 @@ /// value of GV itself. This means that the GlobalAddress must be in the base /// or index register of the address, not the GV offset field. bool GVRequiresExtraLoad(const GlobalValue* GV, bool isDirectCall) const; + + /// SetJITMode - This is called to inform the subtarget info that we are + /// producing code for the JIT. + void SetJITMode(); }; namespace X86 { Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.131 llvm/lib/Target/X86/X86TargetMachine.cpp:1.132 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.131 Tue Dec 19 13:40:09 2006 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Tue Dec 19 19:03:20 2006 @@ -166,6 +166,9 @@ // JIT cannot ensure globals are placed in the lower 4G of address. if (Subtarget.is64Bit()) setCodeModel(CodeModel::Large); + + // Inform the subtarget that we are in JIT mode. + Subtarget.SetJITMode(); PM.add(createX86CodeEmitterPass(*this, MCE)); return false; From evan.cheng at apple.com Tue Dec 19 19:27:45 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 19 Dec 2006 19:27:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200612200127.kBK1RjHT018859@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.332 -> 1.333 --- Log message: getLoad() and getStore() calls missed SVOffset operand. Thanks to Dan Gohman for pointing it out! --- Diffs of the changes: (+2 -2) SelectionDAGISel.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.332 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.333 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.332 Sat Dec 16 15:14:48 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Dec 19 19:27:29 2006 @@ -1835,7 +1835,7 @@ L = DAG.getVecLoad(PTy->getNumElements(), PVT, Root, Ptr, DAG.getSrcValue(SV)); } else { - L = DAG.getLoad(TLI.getValueType(Ty), Root, Ptr, SV, isVolatile); + L = DAG.getLoad(TLI.getValueType(Ty), Root, Ptr, SV, 0, isVolatile); } if (isVolatile) @@ -1851,7 +1851,7 @@ Value *SrcV = I.getOperand(0); SDOperand Src = getValue(SrcV); SDOperand Ptr = getValue(I.getOperand(1)); - DAG.setRoot(DAG.getStore(getRoot(), Src, Ptr, I.getOperand(1), + DAG.setRoot(DAG.getStore(getRoot(), Src, Ptr, I.getOperand(1), 0, I.isVolatile())); } From evan.cheng at apple.com Tue Dec 19 20:35:34 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 19 Dec 2006 18:35:34 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp In-Reply-To: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> References: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> Message-ID: Anton, I am not sure if this patch is a good idea. It seems hacky to me. Ideally GV's should not have DLLImpoerLinkage when compiling for JIT. But I understand that the frontend cannot make that distinction. Perhaps you should set up different relocation type for static compilation / jit for Windows / Cygwin? Evan On Dec 19, 2006, at 5:03 PM, Anton Korobeynikov wrote: > > > Changes in directory llvm/lib/Target/X86: > > X86Subtarget.cpp updated: 1.43 -> 1.44 > X86Subtarget.h updated: 1.22 -> 1.23 > X86TargetMachine.cpp updated: 1.131 -> 1.132 > --- > Log message: > > Fixed dllimported symbols support during JIT'ing. JIT on mingw32 > platform should be more or less workable. At least, sim is running > fine > under lli :) > > > --- > Diffs of the changes: (+28 -7) > > X86Subtarget.cpp | 25 ++++++++++++++++++------- > X86Subtarget.h | 7 +++++++ > X86TargetMachine.cpp | 3 +++ > 3 files changed, 28 insertions(+), 7 deletions(-) > > > Index: llvm/lib/Target/X86/X86Subtarget.cpp > diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.43 llvm/lib/Target/ > X86/X86Subtarget.cpp:1.44 > --- llvm/lib/Target/X86/X86Subtarget.cpp:1.43 Thu Dec 7 16:21:48 2006 > +++ llvm/lib/Target/X86/X86Subtarget.cpp Tue Dec 19 19:03:20 2006 > @@ -32,13 +32,14 @@ > /// or index register of the address, not the GV offset field. > bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, bool > isDirectCall) const > { > - if (isTargetDarwin()) { > - return (!isDirectCall && > - (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || > - (GV->isExternal() && !GV->hasNotBeenReadFromBytecode > ()))); > - } else if (isTargetCygwin() || isTargetWindows()) { > - return (GV->hasDLLImportLinkage()); > - } > + if (GenerateExtraLoadsForGVs) > + if (isTargetDarwin()) { > + return (!isDirectCall && > + (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || > + (GV->isExternal() && !GV->hasNotBeenReadFromBytecode > ()))); > + } else if (isTargetCygwin() || isTargetWindows()) { > + return (GV->hasDLLImportLinkage()); > + } > > return false; > } > @@ -206,6 +207,15 @@ > } > } > > +/// SetJITMode - This is called to inform the subtarget info that > we are > +/// producing code for the JIT. > +void X86Subtarget::SetJITMode() { > + // JIT mode doesn't want extra loads for dllimported symbols, it > knows exactly > + // where everything is. > + if (isTargetCygwin()) > + GenerateExtraLoadsForGVs = false; > +} > + > X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, > bool is64Bit) > : AsmFlavor(AsmWriterFlavor) > , X86SSELevel(NoMMXSSE) > @@ -214,6 +224,7 @@ > // FIXME: this is a known good value for Yonah. How about others? > , MinRepStrSizeThreshold(128) > , Is64Bit(is64Bit) > + , GenerateExtraLoadsForGVs(true) > , TargetType(isELF) { // Default to ELF unless otherwise specified. > > // Determine default and user specified characteristics > > > Index: llvm/lib/Target/X86/X86Subtarget.h > diff -u llvm/lib/Target/X86/X86Subtarget.h:1.22 llvm/lib/Target/X86/ > X86Subtarget.h:1.23 > --- llvm/lib/Target/X86/X86Subtarget.h:1.22 Thu Nov 30 16:42:55 2006 > +++ llvm/lib/Target/X86/X86Subtarget.h Tue Dec 19 19:03:20 2006 > @@ -61,6 +61,9 @@ > /// pointer size is 64 bit. > bool Is64Bit; > > + /// GenerateExtraLoadsForGVs - True if we should generate extra > loads for > + /// indirect symbols (e.g. dllimported symbols on windows). > + bool GenerateExtraLoadsForGVs; > public: > enum { > isELF, isCygwin, isDarwin, isWindows > @@ -112,6 +115,10 @@ > /// value of GV itself. This means that the GlobalAddress must > be in the base > /// or index register of the address, not the GV offset field. > bool GVRequiresExtraLoad(const GlobalValue* GV, bool > isDirectCall) const; > + > + /// SetJITMode - This is called to inform the subtarget info > that we are > + /// producing code for the JIT. > + void SetJITMode(); > }; > > namespace X86 { > > > Index: llvm/lib/Target/X86/X86TargetMachine.cpp > diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.131 llvm/lib/ > Target/X86/X86TargetMachine.cpp:1.132 > --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.131 Tue Dec 19 > 13:40:09 2006 > +++ llvm/lib/Target/X86/X86TargetMachine.cpp Tue Dec 19 19:03:20 2006 > @@ -166,6 +166,9 @@ > // JIT cannot ensure globals are placed in the lower 4G of address. > if (Subtarget.is64Bit()) > setCodeModel(CodeModel::Large); > + > + // Inform the subtarget that we are in JIT mode. > + Subtarget.SetJITMode(); > > PM.add(createX86CodeEmitterPass(*this, MCE)); > return false; > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Tue Dec 19 22:23:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 19 Dec 2006 22:23:51 -0600 Subject: [llvm-commits] CVS: llvm/docs/ProgrammersManual.html Message-ID: <200612200423.kBK4Np3u021557@zion.cs.uiuc.edu> Changes in directory llvm/docs: ProgrammersManual.html updated: 1.99 -> 1.100 --- Log message: fix a typo --- Diffs of the changes: (+2 -2) ProgrammersManual.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/docs/ProgrammersManual.html diff -u llvm/docs/ProgrammersManual.html:1.99 llvm/docs/ProgrammersManual.html:1.100 --- llvm/docs/ProgrammersManual.html:1.99 Tue Dec 19 17:12:09 2006 +++ llvm/docs/ProgrammersManual.html Tue Dec 19 22:23:36 2006 @@ -1279,7 +1279,7 @@ exactly as defined in the language reference. Second an "Abstract Type" is any type which includes an opaque type as part of its type graph (for example "{ opaque, int }"). -Third, a concrete type is a type that is not an abstract type (e.g. "[ int, +Third, a concrete type is a type that is not an abstract type (e.g. "{ int, float }").

      @@ -2569,7 +2569,7 @@ Dinakar Dhurjati and Chris Lattner
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2006/12/19 23:12:09 $ + Last modified: $Date: 2006/12/20 04:23:36 $ From evan.cheng at apple.com Tue Dec 19 23:46:59 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 19 Dec 2006 21:46:59 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp In-Reply-To: References: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> Message-ID: <61D4D0B9-BDDE-475C-9EAC-C015F4576423@apple.com> Let me clarify. It's important for llc and lli to behave exactly the same up to the final code emission pass. With your patch, the two would behave differently and that means we can no longer use llc to reproduce jit codegen bug. Evan On Dec 19, 2006, at 6:35 PM, Evan Cheng wrote: > Anton, I am not sure if this patch is a good idea. It seems hacky > to me. > > Ideally GV's should not have DLLImpoerLinkage when compiling for JIT. > But I understand that the frontend cannot make that distinction. > > Perhaps you should set up different relocation type for static > compilation / jit for Windows / Cygwin? > > Evan > > On Dec 19, 2006, at 5:03 PM, Anton Korobeynikov wrote: > >> >> >> Changes in directory llvm/lib/Target/X86: >> >> X86Subtarget.cpp updated: 1.43 -> 1.44 >> X86Subtarget.h updated: 1.22 -> 1.23 >> X86TargetMachine.cpp updated: 1.131 -> 1.132 >> --- >> Log message: >> >> Fixed dllimported symbols support during JIT'ing. JIT on mingw32 >> platform should be more or less workable. At least, sim is running >> fine >> under lli :) >> >> >> --- >> Diffs of the changes: (+28 -7) >> >> X86Subtarget.cpp | 25 ++++++++++++++++++------- >> X86Subtarget.h | 7 +++++++ >> X86TargetMachine.cpp | 3 +++ >> 3 files changed, 28 insertions(+), 7 deletions(-) >> >> >> Index: llvm/lib/Target/X86/X86Subtarget.cpp >> diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.43 llvm/lib/Target/ >> X86/X86Subtarget.cpp:1.44 >> --- llvm/lib/Target/X86/X86Subtarget.cpp:1.43 Thu Dec 7 16:21:48 >> 2006 >> +++ llvm/lib/Target/X86/X86Subtarget.cpp Tue Dec 19 19:03:20 2006 >> @@ -32,13 +32,14 @@ >> /// or index register of the address, not the GV offset field. >> bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, bool >> isDirectCall) const >> { >> - if (isTargetDarwin()) { >> - return (!isDirectCall && >> - (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || >> - (GV->isExternal() && !GV->hasNotBeenReadFromBytecode >> ()))); >> - } else if (isTargetCygwin() || isTargetWindows()) { >> - return (GV->hasDLLImportLinkage()); >> - } >> + if (GenerateExtraLoadsForGVs) >> + if (isTargetDarwin()) { >> + return (!isDirectCall && >> + (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || >> + (GV->isExternal() && !GV->hasNotBeenReadFromBytecode >> ()))); >> + } else if (isTargetCygwin() || isTargetWindows()) { >> + return (GV->hasDLLImportLinkage()); >> + } >> >> return false; >> } >> @@ -206,6 +207,15 @@ >> } >> } >> >> +/// SetJITMode - This is called to inform the subtarget info that >> we are >> +/// producing code for the JIT. >> +void X86Subtarget::SetJITMode() { >> + // JIT mode doesn't want extra loads for dllimported symbols, it >> knows exactly >> + // where everything is. >> + if (isTargetCygwin()) >> + GenerateExtraLoadsForGVs = false; >> +} >> + >> X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, >> bool is64Bit) >> : AsmFlavor(AsmWriterFlavor) >> , X86SSELevel(NoMMXSSE) >> @@ -214,6 +224,7 @@ >> // FIXME: this is a known good value for Yonah. How about others? >> , MinRepStrSizeThreshold(128) >> , Is64Bit(is64Bit) >> + , GenerateExtraLoadsForGVs(true) >> , TargetType(isELF) { // Default to ELF unless otherwise >> specified. >> >> // Determine default and user specified characteristics >> >> >> Index: llvm/lib/Target/X86/X86Subtarget.h >> diff -u llvm/lib/Target/X86/X86Subtarget.h:1.22 llvm/lib/Target/X86/ >> X86Subtarget.h:1.23 >> --- llvm/lib/Target/X86/X86Subtarget.h:1.22 Thu Nov 30 16:42:55 2006 >> +++ llvm/lib/Target/X86/X86Subtarget.h Tue Dec 19 19:03:20 2006 >> @@ -61,6 +61,9 @@ >> /// pointer size is 64 bit. >> bool Is64Bit; >> >> + /// GenerateExtraLoadsForGVs - True if we should generate extra >> loads for >> + /// indirect symbols (e.g. dllimported symbols on windows). >> + bool GenerateExtraLoadsForGVs; >> public: >> enum { >> isELF, isCygwin, isDarwin, isWindows >> @@ -112,6 +115,10 @@ >> /// value of GV itself. This means that the GlobalAddress must >> be in the base >> /// or index register of the address, not the GV offset field. >> bool GVRequiresExtraLoad(const GlobalValue* GV, bool >> isDirectCall) const; >> + >> + /// SetJITMode - This is called to inform the subtarget info >> that we are >> + /// producing code for the JIT. >> + void SetJITMode(); >> }; >> >> namespace X86 { >> >> >> Index: llvm/lib/Target/X86/X86TargetMachine.cpp >> diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.131 llvm/lib/ >> Target/X86/X86TargetMachine.cpp:1.132 >> --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.131 Tue Dec 19 >> 13:40:09 2006 >> +++ llvm/lib/Target/X86/X86TargetMachine.cpp Tue Dec 19 19:03:20 2006 >> @@ -166,6 +166,9 @@ >> // JIT cannot ensure globals are placed in the lower 4G of >> address. >> if (Subtarget.is64Bit()) >> setCodeModel(CodeModel::Large); >> + >> + // Inform the subtarget that we are in JIT mode. >> + Subtarget.SetJITMode(); >> >> PM.add(createX86CodeEmitterPass(*this, MCE)); >> return false; >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Dec 19 23:59:34 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 19 Dec 2006 21:59:34 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp In-Reply-To: <61D4D0B9-BDDE-475C-9EAC-C015F4576423@apple.com> References: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> <61D4D0B9-BDDE-475C-9EAC-C015F4576423@apple.com> Message-ID: On Dec 19, 2006, at 9:46 PM, Evan Cheng wrote: > Let me clarify. It's important for llc and lli to behave exactly the > same up to the final code emission pass. With your patch, the two > would behave differently and that means we can no longer use llc to > reproduce jit codegen bug. PPC64 has a similar problem. It wants to do codegen in PIC mode, but it doesn't want the JIT to make dyld stubs. As such, it does 'JIT PIC' mode, which is like PIC but doesn't do the extra load to go through dyld stubs. An alternative approach would be to have the JIT synthesize dyld stubs, but that takes work to implement and yields slower programs. -Chris From sabre at nondot.org Wed Dec 20 00:20:38 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Dec 2006 00:20:38 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SCCP/2006-12-19-UndefBug.ll Message-ID: <200612200620.kBK6Kcrh023484@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SCCP: 2006-12-19-UndefBug.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+6 -0) 2006-12-19-UndefBug.ll | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/test/Regression/Transforms/SCCP/2006-12-19-UndefBug.ll diff -c /dev/null llvm/test/Regression/Transforms/SCCP/2006-12-19-UndefBug.ll:1.1 *** /dev/null Wed Dec 20 00:20:33 2006 --- llvm/test/Regression/Transforms/SCCP/2006-12-19-UndefBug.ll Wed Dec 20 00:20:23 2006 *************** *** 0 **** --- 1,6 ---- + ; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep 'ret bool false' + + bool %foo() { + %X = and bool false, undef + ret bool %X + } From sabre at nondot.org Wed Dec 20 00:21:48 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Dec 2006 00:21:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200612200621.kBK6LmCu023544@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SCCP.cpp updated: 1.142 -> 1.143 --- Log message: handle undef values much more carefully: generalize the resolveundefbranches code to handle instructions as well, so that we properly fold things like X & undef -> 0. This fixes Transforms/SCCP/2006-12-19-UndefBug.ll --- Diffs of the changes: (+172 -32) SCCP.cpp | 204 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 172 insertions(+), 32 deletions(-) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.142 llvm/lib/Transforms/Scalar/SCCP.cpp:1.143 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.142 Tue Dec 19 15:40:18 2006 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Wed Dec 20 00:21:33 2006 @@ -47,23 +47,33 @@ STATISTIC(IPNumArgsElimed ,"Number of arguments constant propagated by IPSCCP"); STATISTIC(IPNumGlobalConst, "Number of globals found to be constant by IPSCCP"); - - -// LatticeVal class - This class represents the different lattice values that an -// instruction may occupy. It is a simple class with value semantics. -// namespace { - +/// LatticeVal class - This class represents the different lattice values that +/// an LLVM value may occupy. It is a simple class with value semantics. +/// class LatticeVal { enum { - undefined, // This instruction has no known value - constant, // This instruction has a constant value - overdefined // This instruction has an unknown value - } LatticeValue; // The current lattice position + /// undefined - This LLVM Value has no known value yet. + undefined, + + /// constant - This LLVM Value has a specific constant value. + constant, + + /// forcedconstant - This LLVM Value was thought to be undef until + /// ResolvedUndefsIn. This is treated just like 'constant', but if merged + /// with another (different) constant, it goes to overdefined, instead of + /// asserting. + forcedconstant, + + /// overdefined - This instruction is not known to be constant, and we know + /// it has a value. + overdefined + } LatticeValue; // The current lattice position + Constant *ConstantVal; // If Constant value, the current value public: inline LatticeVal() : LatticeValue(undefined), ConstantVal(0) {} - + // markOverdefined - Return true if this is a new status to be in... inline bool markOverdefined() { if (LatticeValue != overdefined) { @@ -73,11 +83,23 @@ return false; } - // markConstant - Return true if this is a new status for us... + // markConstant - Return true if this is a new status for us. inline bool markConstant(Constant *V) { if (LatticeValue != constant) { - LatticeValue = constant; - ConstantVal = V; + if (LatticeValue == undefined) { + LatticeValue = constant; + ConstantVal = V; + } else { + assert(LatticeValue == forcedconstant && + "Cannot move from overdefined to constant!"); + // Stay at forcedconstant if the constant is the same. + if (V == ConstantVal) return false; + + // Otherwise, we go to overdefined. Assumptions made based on the + // forced value are possibly wrong. Assuming this is another constant + // could expose a contradiction. + LatticeValue = overdefined; + } return true; } else { assert(ConstantVal == V && "Marking constant with different value"); @@ -85,8 +107,16 @@ return false; } - inline bool isUndefined() const { return LatticeValue == undefined; } - inline bool isConstant() const { return LatticeValue == constant; } + inline void markForcedConstant(Constant *V) { + assert(LatticeValue == undefined && "Can't force a defined value!"); + LatticeValue = forcedconstant; + ConstantVal = V; + } + + inline bool isUndefined() const { return LatticeValue == undefined; } + inline bool isConstant() const { + return LatticeValue == constant || LatticeValue == forcedconstant; + } inline bool isOverdefined() const { return LatticeValue == overdefined; } inline Constant *getConstant() const { @@ -174,12 +204,12 @@ /// void Solve(); - /// ResolveBranchesIn - While solving the dataflow for a function, we assume + /// ResolvedUndefsIn - While solving the dataflow for a function, we assume /// that branches on undef values cannot reach any of their successors. /// However, this is not a safe assumption. After we solve dataflow, this /// method should be use to handle this. If this returns true, the solver /// should be rerun. - bool ResolveBranchesIn(Function &F); + bool ResolvedUndefsIn(Function &F); /// getExecutableBlocks - Once we have solved for constants, return the set of /// blocks that is known to be executable. @@ -217,6 +247,13 @@ InstWorkList.push_back(V); } } + + inline void markForcedConstant(LatticeVal &IV, Value *V, Constant *C) { + IV.markForcedConstant(C); + DOUT << "markForcedConstant: " << *C << ": " << *V; + InstWorkList.push_back(V); + } + inline void markConstant(Value *V, Constant *C) { markConstant(ValueState[V], V, C); } @@ -266,11 +303,11 @@ hash_map::iterator I = ValueState.find(V); if (I != ValueState.end()) return I->second; // Common case, in the map - if (Constant *CPV = dyn_cast(V)) { + if (Constant *C = dyn_cast(V)) { if (isa(V)) { // Nothing to do, remain undefined. } else { - ValueState[CPV].markConstant(CPV); // Constants are constant + ValueState[C].markConstant(C); // Constants are constant } } // All others are underdefined by default... @@ -1044,7 +1081,7 @@ } } -/// ResolveBranchesIn - While solving the dataflow for a function, we assume +/// ResolvedUndefsIn - While solving the dataflow for a function, we assume /// that branches on undef values cannot reach any of their successors. /// However, this is not a safe assumption. After we solve dataflow, this /// method should be use to handle this. If this returns true, the solver @@ -1054,13 +1091,116 @@ /// of the edges from the block as being feasible, even though the condition /// doesn't say it would otherwise be. This allows SCCP to find the rest of the /// CFG and only slightly pessimizes the analysis results (by marking one, -/// potentially unfeasible, edge feasible). This cannot usefully modify the +/// potentially infeasible, edge feasible). This cannot usefully modify the /// constraints on the condition of the branch, as that would impact other users /// of the value. -bool SCCPSolver::ResolveBranchesIn(Function &F) { +/// +/// This scan also checks for values that use undefs, whose results are actually +/// defined. For example, 'zext i8 undef to i32' should produce all zeros +/// conservatively, as "(zext i8 X -> i32) & 0xFF00" must always return zero, +/// even if X isn't defined. +bool SCCPSolver::ResolvedUndefsIn(Function &F) { for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { if (!BBExecutable.count(BB)) continue; + + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { + // Look for instructions which produce undef values. + if (I->getType() == Type::VoidTy) continue; + + LatticeVal &LV = getValueState(I); + if (!LV.isUndefined()) continue; + + // Get the lattice values of the first two operands for use below. + LatticeVal &Op0LV = getValueState(I->getOperand(0)); + LatticeVal Op1LV; + if (I->getNumOperands() == 2) { + // If this is a two-operand instruction, and if both operands are + // undefs, the result stays undef. + Op1LV = getValueState(I->getOperand(1)); + if (Op0LV.isUndefined() && Op1LV.isUndefined()) + continue; + } + + // If this is an instructions whose result is defined even if the input is + // not fully defined, propagate the information. + const Type *ITy = I->getType(); + switch (I->getOpcode()) { + default: break; // Leave the instruction as an undef. + case Instruction::ZExt: + // After a zero extend, we know the top part is zero. SExt doesn't have + // to be handled here, because we don't know whether the top part is 1's + // or 0's. + assert(Op0LV.isUndefined()); + markForcedConstant(LV, I, Constant::getNullValue(ITy)); + return true; + case Instruction::Mul: + case Instruction::And: + // undef * X -> 0. X could be zero. + // undef & X -> 0. X could be zero. + markForcedConstant(LV, I, Constant::getNullValue(ITy)); + return true; + + case Instruction::Or: + // undef | X -> -1. X could be -1. + markForcedConstant(LV, I, ConstantInt::getAllOnesValue(ITy)); + return true; + + case Instruction::SDiv: + case Instruction::UDiv: + case Instruction::SRem: + case Instruction::URem: + // X / undef -> undef. No change. + // X % undef -> undef. No change. + if (Op1LV.isUndefined()) break; + + // undef / X -> 0. X could be maxint. + // undef % X -> 0. X could be 1. + markForcedConstant(LV, I, Constant::getNullValue(ITy)); + return true; + + case Instruction::AShr: + // undef >>s X -> undef. No change. + if (Op0LV.isUndefined()) break; + + // X >>s undef -> X. X could be 0, X could have the high-bit known set. + if (Op0LV.isConstant()) + markForcedConstant(LV, I, Op0LV.getConstant()); + else + markOverdefined(LV, I); + return true; + case Instruction::LShr: + case Instruction::Shl: + // undef >> X -> undef. No change. + // undef << X -> undef. No change. + if (Op0LV.isUndefined()) break; + + // X >> undef -> 0. X could be 0. + // X << undef -> 0. X could be 0. + markForcedConstant(LV, I, Constant::getNullValue(ITy)); + return true; + case Instruction::Select: + // undef ? X : Y -> X or Y. There could be commonality between X/Y. + if (Op0LV.isUndefined()) { + if (!Op1LV.isConstant()) // Pick the constant one if there is any. + Op1LV = getValueState(I->getOperand(2)); + } else if (Op1LV.isUndefined()) { + // c ? undef : undef -> undef. No change. + Op1LV = getValueState(I->getOperand(2)); + if (Op1LV.isUndefined()) + break; + // Otherwise, c ? undef : x -> x. + } else { + // Leave Op1LV as Operand(1)'s LatticeValue. + } + + if (Op1LV.isConstant()) + markForcedConstant(LV, I, Op1LV.getConstant()); + else + markOverdefined(LV, I); + return true; + } + } TerminatorInst *TI = BB->getTerminator(); if (BranchInst *BI = dyn_cast(TI)) { @@ -1133,11 +1273,11 @@ Values[AI].markOverdefined(); // Solve for constants. - bool ResolvedBranches = true; - while (ResolvedBranches) { + bool ResolvedUndefs = true; + while (ResolvedUndefs) { Solver.Solve(); - DOUT << "RESOLVING UNDEF BRANCHES\n"; - ResolvedBranches = Solver.ResolveBranchesIn(F); + DOUT << "RESOLVING UNDEFs\n"; + ResolvedUndefs = Solver.ResolvedUndefsIn(F); } bool MadeChanges = false; @@ -1270,14 +1410,14 @@ Solver.TrackValueOfGlobalVariable(G); // Solve for constants. - bool ResolvedBranches = true; - while (ResolvedBranches) { + bool ResolvedUndefs = true; + while (ResolvedUndefs) { Solver.Solve(); - DOUT << "RESOLVING UNDEF BRANCHES\n"; - ResolvedBranches = false; + DOUT << "RESOLVING UNDEFS\n"; + ResolvedUndefs = false; for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) - ResolvedBranches |= Solver.ResolveBranchesIn(*F); + ResolvedUndefs |= Solver.ResolvedUndefsIn(*F); } bool MadeChanges = false; From evan.cheng at apple.com Wed Dec 20 02:25:40 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 20 Dec 2006 00:25:40 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp In-Reply-To: References: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> <61D4D0B9-BDDE-475C-9EAC-C015F4576423@apple.com> Message-ID: Ok. I see PPC does exactly the same thing. But this seems like a temporary solution. Could we add some kind of JIT relocation model which are target specific? Or any method that would allow llc to codegen (by specifying some command line option?) in the exact same way as the JIT would? Evan On Dec 19, 2006, at 9:59 PM, Chris Lattner wrote: > On Dec 19, 2006, at 9:46 PM, Evan Cheng wrote: >> Let me clarify. It's important for llc and lli to behave exactly the >> same up to the final code emission pass. With your patch, the two >> would behave differently and that means we can no longer use llc to >> reproduce jit codegen bug. > > PPC64 has a similar problem. It wants to do codegen in PIC mode, > but it doesn't want the JIT to make dyld stubs. As such, it does > 'JIT PIC' mode, which is like PIC but doesn't do the extra load to > go through dyld stubs. > > An alternative approach would be to have the JIT synthesize dyld > stubs, but that takes work to implement and yields slower programs. > > -Chris > > From rspencer at reidspencer.com Wed Dec 20 02:41:31 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 20 Dec 2006 00:41:31 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp In-Reply-To: References: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> <61D4D0B9-BDDE-475C-9EAC-C015F4576423@apple.com> Message-ID: <1166604091.2850.106.camel@bashful.x10sys.com> On Wed, 2006-12-20 at 00:25 -0800, Evan Cheng wrote: > Ok. I see PPC does exactly the same thing. But this seems like a > temporary solution. Could we add some kind of JIT relocation model > which are target specific? Or any method that would allow llc to > codegen (by specifying some command line option?) in the exact same > way as the JIT would? Having debugged a number of JIT failures now, I'll throw in my $0.02 worth that we *must* retain this functionality. Sometimes the only/best/easiest way to find a JIT bug is by generating code with llc and looking at it. There needs to be a way to ensure/force JIT and LLC to produce identical code (as far as possible). Reid. > > Evan > On Dec 19, 2006, at 9:59 PM, Chris Lattner wrote: > > > On Dec 19, 2006, at 9:46 PM, Evan Cheng wrote: > >> Let me clarify. It's important for llc and lli to behave exactly the > >> same up to the final code emission pass. With your patch, the two > >> would behave differently and that means we can no longer use llc to > >> reproduce jit codegen bug. > > > > PPC64 has a similar problem. It wants to do codegen in PIC mode, > > but it doesn't want the JIT to make dyld stubs. As such, it does > > 'JIT PIC' mode, which is like PIC but doesn't do the extra load to > > go through dyld stubs. > > > > An alternative approach would be to have the JIT synthesize dyld > > stubs, but that takes work to implement and yields slower programs. > > > > -Chris > > > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From asl at math.spbu.ru Wed Dec 20 04:29:17 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 20 Dec 2006 13:29:17 +0300 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp In-Reply-To: References: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> <61D4D0B9-BDDE-475C-9EAC-C015F4576423@apple.com> Message-ID: <1166610557.15300.40.camel@asl.dorms.spbu.ru> Hello, Evan. > Ok. I see PPC does exactly the same thing. But this seems like a > temporary solution. Could we add some kind of JIT relocation model > which are target specific? Or any method that would allow llc to > codegen (by specifying some command line option?) in the exact same > way as the JIT would? Well, probably yes. There is only 1 variable controlling codegen behaviour in x86 subtarget. -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From asl at math.spbu.ru Wed Dec 20 04:31:29 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 20 Dec 2006 13:31:29 +0300 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp In-Reply-To: References: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> <61D4D0B9-BDDE-475C-9EAC-C015F4576423@apple.com> Message-ID: <1166610689.15300.44.camel@asl.dorms.spbu.ru> Hello, Chris. > PPC64 has a similar problem. It wants to do codegen in PIC mode, but > it doesn't want the JIT to make dyld stubs. As such, it does 'JIT > PIC' mode, which is like PIC but doesn't do the extra load to go > through dyld stubs. Yes, It's quite the same. At codegen level we know only addres of import table entry, which will be filled by system loader with correct address of symbol. Thus, we need to perform extra load in order to get this address runtime. When we get address of symbol during JIT via libSystem we know *exact* address, so, we don't need any extra load. So, in general, dllimported GVs are just ordinary externals in JIT mode. -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From jlaskey at apple.com Wed Dec 20 09:29:59 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Dec 2006 11:29:59 -0400 Subject: [llvm-commits] [llvm-commit][llvm-gcc]Select powerpc cpu based on gcc arguments, not tuning settings. Message-ID: <9EAD80D8-67AE-4623-AF88-A4CEDCF506D6@apple.com> Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 121533) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -136,6 +136,10 @@ /* Target cpu type */ +/* APPLE LOCAL begin LLVM */ +const char *rs6000_cpu_target = "ppc"; +/* APPLE LOCAL end LLVM */ + enum processor_type rs6000_cpu; struct rs6000_cpu_select rs6000_select[3] = { @@ -1324,6 +1328,10 @@ rs6000_select[0].string = default_cpu; rs6000_cpu = TARGET_POWERPC64 ? PROCESSOR_DEFAULT64 : PROCESSOR_DEFAULT; + /* APPLE LOCAL begin LLVM */ + rs6000_cpu_target = TARGET_POWERPC64 ? "ppc64" : "ppc"; + /* APPLE LOCAL end LLVM */ + /* APPLE LOCAL begin -fast */ if (flag_fast || flag_fastf || flag_fastcp) { @@ -1355,6 +1363,10 @@ /* APPLE LOCAL begin -fast */ mcpu_cpu = processor_target_table[j].processor; /* APPLE LOCAL end -fast */ + + /* APPLE LOCAL begin LLVM */ + rs6000_cpu_target = processor_target_table[j].name; + /* APPLE LOCAL end LLVM */ } break; } Index: gcc/config/rs6000/rs6000.h =================================================================== --- gcc/config/rs6000/rs6000.h (revision 121533) +++ gcc/config/rs6000/rs6000.h (working copy) @@ -408,6 +408,10 @@ PROCESSOR_POWER5 }; +/* APPLE LOCAL begin LLVM */ +extern const char *rs6000_cpu_target; +/* APPLE LOCAL end LLVM */ + extern enum processor_type rs6000_cpu; /* Recast the processor type to the cpu attribute. */ @@ -3610,27 +3614,8 @@ /* Turn -march=xx into a CPU type. */ #define LLVM_SET_SUBTARGET_FEATURES(F) \ - { switch (rs6000_cpu) { \ - case PROCESSOR_RIOS1: \ - case PROCESSOR_RIOS2: \ - case PROCESSOR_MPCCORE: \ - case PROCESSOR_PPC403: \ - case PROCESSOR_PPC405: \ - case PROCESSOR_PPC440: F.setCPU("ppc"); break; \ - case PROCESSOR_PPC601: F.setCPU("601"); break; \ - case PROCESSOR_PPC603: F.setCPU("603"); break; \ - case PROCESSOR_PPC604: F.setCPU("604"); break; \ - case PROCESSOR_PPC604e: F.setCPU("604e"); break; \ - case PROCESSOR_PPC620: \ - case PROCESSOR_PPC630: F.setCPU("620"); break; \ - case PROCESSOR_PPC750: F.setCPU("750"); break; \ - case PROCESSOR_PPC7400: F.setCPU("7400"); break; \ - case PROCESSOR_PPC7450: F.setCPU("7450"); break; \ - case PROCESSOR_PPC8540: F.setCPU("7450"); break; \ - case PROCESSOR_RS64A: F.setCPU("ppc64"); break; \ - case PROCESSOR_POWER4: \ - case PROCESSOR_POWER5: F.setCPU("970"); break; /* FIXME: NOT RIGHT */ \ - } \ + { \ + F.setCPU(rs6000_cpu_target); \ F.AddFeature("altivec", TARGET_ALTIVEC); \ F.AddFeature("gpul", TARGET_MFCRF); \ F.AddFeature("fsqrt", TARGET_PPC_GPOPT); \ -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061220/c50793db/attachment.bin From reid at x10sys.com Wed Dec 20 11:20:29 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 20 Dec 2006 11:20:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200612201720.kBKHKTBl011184@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.289 -> 1.290 --- Log message: Allow negative constants for unsigned integers and unsigned constants greater than MAX_INT64 for signed integers. This is now valid and is just waiting for the distinction between signed and unsigned to go away. --- Diffs of the changes: (+13 -11) llvmAsmParser.y | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.289 llvm/lib/AsmParser/llvmAsmParser.y:1.290 --- llvm/lib/AsmParser/llvmAsmParser.y:1.289 Fri Dec 8 12:06:15 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Dec 20 11:20:09 2006 @@ -926,7 +926,6 @@ // EUINT64VAL - A positive number within uns. long long range %token EUINT64VAL -%type EINT64VAL %token SINTVAL // Signed 32 bit ints... %token UINTVAL // Unsigned 32 bit ints... @@ -995,15 +994,6 @@ CHECK_FOR_ERROR }; - -EINT64VAL : ESINT64VAL; // These have same type and can't cause problems... -EINT64VAL : EUINT64VAL { - if ($1 > (uint64_t)INT64_MAX) // Outside of my range! - GEN_ERROR("Value too large for type!"); - $$ = (int64_t)$1; - CHECK_FOR_ERROR -}; - // Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // @@ -1486,7 +1476,13 @@ delete $1; CHECK_FOR_ERROR } - | SIntType EINT64VAL { // integral constants + | SIntType ESINT64VAL { // integral constants + if (!ConstantInt::isValueValidForType($1, $2)) + GEN_ERROR("Constant value doesn't fit in type!"); + $$ = ConstantInt::get($1, $2); + CHECK_FOR_ERROR + } + | SIntType EUINT64VAL { // integral constants if (!ConstantInt::isValueValidForType($1, $2)) GEN_ERROR("Constant value doesn't fit in type!"); $$ = ConstantInt::get($1, $2); @@ -1498,6 +1494,12 @@ $$ = ConstantInt::get($1, $2); CHECK_FOR_ERROR } + | UIntType ESINT64VAL { + if (!ConstantInt::isValueValidForType($1, $2)) + GEN_ERROR("Constant value doesn't fit in type!"); + $$ = ConstantInt::get($1, $2); + CHECK_FOR_ERROR + } | BOOL TRUETOK { // Boolean constants $$ = ConstantBool::getTrue(); CHECK_FOR_ERROR From reid at x10sys.com Wed Dec 20 11:28:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 20 Dec 2006 11:28:13 -0600 Subject: [llvm-commits] CVS: llvm/test/Feature/testconstants.ll Message-ID: <200612201728.kBKHSD3H011312@zion.cs.uiuc.edu> Changes in directory llvm/test/Feature: testconstants.ll updated: 1.7 -> 1.8 --- Log message: Add some tests for negative constants to unsigned and large positive constants to signed. --- Diffs of the changes: (+7 -0) testconstants.ll | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/test/Feature/testconstants.ll diff -u llvm/test/Feature/testconstants.ll:1.7 llvm/test/Feature/testconstants.ll:1.8 --- llvm/test/Feature/testconstants.ll:1.7 Fri Dec 1 22:23:07 2006 +++ llvm/test/Feature/testconstants.ll Wed Dec 20 11:27:58 2006 @@ -24,3 +24,10 @@ ret sbyte* null ; Test null end +uint %negativeUnsigned() { + ret uint -1 +} + +int %largeSigned() { + ret int 3900000000 +} From evan.cheng at apple.com Wed Dec 20 11:36:27 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 20 Dec 2006 09:36:27 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp In-Reply-To: <1166610689.15300.44.camel@asl.dorms.spbu.ru> References: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> <61D4D0B9-BDDE-475C-9EAC-C015F4576423@apple.com> <1166610689.15300.44.camel@asl.dorms.spbu.ru> Message-ID: <6A83EC7C-8B35-49F9-A807-228834C38221@apple.com> I took a look at mingw related code. It seems to me for mingw that you can set relocation type to pic for llc and static for jit. No? Then GVRequiresExtraLoad can just check relocation type? Also GVRequiresExtraLoad now violates 80-col policy and its style is inconsistent with the rest of the llvm code. Please fix it. bool foo() { } vs. bool foo() { } Thanks, Evan On Dec 20, 2006, at 2:31 AM, Anton Korobeynikov wrote: > Hello, Chris. > >> PPC64 has a similar problem. It wants to do codegen in PIC mode, but >> it doesn't want the JIT to make dyld stubs. As such, it does 'JIT >> PIC' mode, which is like PIC but doesn't do the extra load to go >> through dyld stubs. > > Yes, It's quite the same. At codegen level we know only addres of > import > table entry, which will be filled by system loader with correct > address > of symbol. Thus, we need to perform extra load in order to get this > address runtime. > When we get address of symbol during JIT via libSystem we know *exact* > address, so, we don't need any extra load. So, in general, dllimported > GVs are just ordinary externals in JIT mode. > > -- > With best regards, Anton Korobeynikov. > > Faculty of Mathematics & Mechanics, Saint Petersburg State University. > > From clattner at apple.com Wed Dec 20 11:41:07 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 20 Dec 2006 09:41:07 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp In-Reply-To: References: <200612200103.kBK13ZJu018497@zion.cs.uiuc.edu> <61D4D0B9-BDDE-475C-9EAC-C015F4576423@apple.com> Message-ID: <87317C9D-94F3-4598-9E97-9E353F51276B@apple.com> On Dec 20, 2006, at 12:25 AM, Evan Cheng wrote: > Ok. I see PPC does exactly the same thing. But this seems like a > temporary solution. Could we add some kind of JIT relocation model > which are target specific? Or any method that would allow llc to > codegen (by specifying some command line option?) in the exact same > way as the JIT would? I'm not opposed to adding -relocation-model=jit. It sounds like the best solution for PPC64, but I agree with Evan that it sounds like relo=static should work for mingw. -Chris From sabre at nondot.org Wed Dec 20 13:50:30 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Dec 2006 13:50:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200612201950.kBKJoUBJ013822@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.176 -> 1.177 --- Log message: Revert the previous patch which was incorrect. This unbreaks eon, but rebreaks invoke-1.ll --- Diffs of the changes: (+2 -1) Verifier.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.176 llvm/lib/VMCore/Verifier.cpp:1.177 --- llvm/lib/VMCore/Verifier.cpp:1.176 Mon Dec 18 17:40:19 2006 +++ llvm/lib/VMCore/Verifier.cpp Wed Dec 20 13:50:15 2006 @@ -921,7 +921,8 @@ // If it is used by something non-phi, then the other case is that // 'OpBlock' dominates all of its predecessors other than the // invoke. In this case, the invoke value can still be used. - if (!Bad) { + if (Bad) { + Bad = false; for (pred_iterator PI = pred_begin(OpBlock), E = pred_end(OpBlock); PI != E; ++PI) { if (*PI != II->getParent() && !EF->dominates(OpBlock, *PI)) { From dpatel at apple.com Wed Dec 20 13:57:22 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 20 Dec 2006 13:57:22 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200612201957.kBKJvMsj013940@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.63 -> 1.64 --- Log message: Enable old pass manager. New pass manager causes CBE failures in llvm-test. --- Diffs of the changes: (+1 -1) Pass.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.63 llvm/include/llvm/Pass.h:1.64 --- llvm/include/llvm/Pass.h:1.63 Tue Dec 19 15:32:24 2006 +++ llvm/include/llvm/Pass.h Wed Dec 20 13:57:07 2006 @@ -36,7 +36,7 @@ #include #include -//#define USE_OLD_PASSMANAGER 1 +#define USE_OLD_PASSMANAGER 1 namespace llvm { From asl at math.spbu.ru Wed Dec 20 14:40:45 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 20 Dec 2006 14:40:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp Message-ID: <200612202040.kBKKej2J014759@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.cpp updated: 1.44 -> 1.45 --- Log message: Fixed 80 cols & style violation --- Diffs of the changes: (+4 -2) X86Subtarget.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.44 llvm/lib/Target/X86/X86Subtarget.cpp:1.45 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.44 Tue Dec 19 19:03:20 2006 +++ llvm/lib/Target/X86/X86Subtarget.cpp Wed Dec 20 14:40:30 2006 @@ -30,7 +30,8 @@ /// symbols are indirect, loading the value at address GV rather then the /// value of GV itself. This means that the GlobalAddress must be in the base /// or index register of the address, not the GV offset field. -bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, bool isDirectCall) const +bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, + bool isDirectCall) const { if (GenerateExtraLoadsForGVs) if (isTargetDarwin()) { @@ -209,7 +210,8 @@ /// SetJITMode - This is called to inform the subtarget info that we are /// producing code for the JIT. -void X86Subtarget::SetJITMode() { +void X86Subtarget::SetJITMode() +{ // JIT mode doesn't want extra loads for dllimported symbols, it knows exactly // where everything is. if (isTargetCygwin()) From jlaskey at apple.com Wed Dec 20 14:57:01 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Dec 2006 14:57:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200612202057.kBKKv1uT015020@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.223 -> 1.224 --- Log message: Changes to target powerpc for non-Darwin assemblers. 1. Patches from Nick Lewycky. 2. Code to filter register names and print them as numeric values on non-Darwin systems. --- Diffs of the changes: (+62 -10) PPCAsmPrinter.cpp | 72 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 62 insertions(+), 10 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.223 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.224 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.223 Tue Dec 19 16:59:26 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Dec 20 14:56:46 2006 @@ -86,12 +86,66 @@ void printMachineInstruction(const MachineInstr *MI); void printOp(const MachineOperand &MO); + + /// stripRegisterPrefix - This method strips the character prefix from a + /// register name so that only the number is left. Used by for linux asm. + void stripRegisterPrefix(std::string &Name) { + // Potential prefixes. + static const char *Prefixes[] = { "r", "f", "v", "cr" }; + unsigned NPrefixes = sizeof(Prefixes) / sizeof(const char *); + // Fetch string length. + unsigned Size = Name.size(); + // Start position of numeric portion. + unsigned Pos = 0; + + // Try each prefix. + for (unsigned i = 0; i < NPrefixes; ++i) { + const char *Prefix = Prefixes[i]; + unsigned Length = strlen(Prefix); + // Does it match the beginning? + if (Name.compare(0, Length, Prefix, Length) == 0) { + // If so, start looking beyond the prefix. + Pos = strlen(Prefix); + break; + } + } + + // If we have a match. + if (Pos) { + // Remaining characters better be digits. + for (unsigned j = Pos; j < Size; ++j) { + unsigned Ch = Name[j]; + if (Ch < '0' || '9' < Ch) return; + } + + // Pass back just the numeric portion. + Name = Name.substr(Pos, Size - Pos); + } + } + + /// printRegister - Print register according to target requirements. + /// + void printRegister(const MachineOperand &MO, bool R0AsZero) { + unsigned RegNo = MO.getReg(); + assert(MRegisterInfo::isPhysicalRegister(RegNo) && "Not physreg??"); + + // If we should use 0 for R0. + if (R0AsZero && RegNo == PPC::R0) { + O << "0"; + return; + } + + std::string Name = TM.getRegisterInfo()->get(RegNo).Name; + // Linux assembler (Others?) does not take register mnemonics. + // FIXME - What about special registers used in mfspr/mtspr? + if (!Subtarget.isDarwin()) stripRegisterPrefix(Name); + O << Name; + } void printOperand(const MachineInstr *MI, unsigned OpNo) { const MachineOperand &MO = MI->getOperand(OpNo); if (MO.isRegister()) { - assert(MRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physreg??"); - O << TM.getRegisterInfo()->get(MO.getReg()).Name; + printRegister(MO, false); } else if (MO.isImmediate()) { O << MO.getImmedValue(); } else { @@ -239,10 +293,7 @@ // the value contained in the register. For this reason, the darwin // assembler requires that we print r0 as 0 (no r) when used as the base. const MachineOperand &MO = MI->getOperand(OpNo); - if (MO.getReg() == PPC::R0) - O << '0'; - else - O << TM.getRegisterInfo()->get(MO.getReg()).Name; + printRegister(MO, true); O << ", "; printOperand(MI, OpNo+1); } @@ -616,7 +667,7 @@ SwitchToDataSection("\t.data", I); O << ".comm " << name << "," << Size; } - O << "\t\t; '" << I->getName() << "'\n"; + O << "\t\t" << TAI->getCommentString() << " '" << I->getName() << "'\n"; } else { switch (I->getLinkage()) { case GlobalValue::LinkOnceLinkage: @@ -649,7 +700,8 @@ } EmitAlignment(Align, I); - O << name << ":\t\t\t\t; '" << I->getName() << "'\n"; + O << name << ":\t\t\t\t" << TAI->getCommentString() << " '" + << I->getName() << "'\n"; // If the initializer is a extern weak symbol, remember to emit the weak // reference! @@ -751,8 +803,8 @@ -/// createDarwinCodePrinterPass - Returns a pass that prints the PPC assembly -/// code for a MachineFunction to the given output stream, in a format that the +/// createPPCAsmPrinterPass - Returns a pass that prints the PPC assembly code +/// for a MachineFunction to the given output stream, in a format that the /// Darwin assembler can deal with. /// FunctionPass *llvm::createPPCAsmPrinterPass(std::ostream &o, From sabre at nondot.org Wed Dec 20 15:20:28 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 20 Dec 2006 15:20:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200612202120.kBKLKStq015417@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.177 -> 1.178 --- Log message: Fix Regression/Verifier/invoke-1.ll --- Diffs of the changes: (+7 -2) Verifier.cpp | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.177 llvm/lib/VMCore/Verifier.cpp:1.178 --- llvm/lib/VMCore/Verifier.cpp:1.177 Wed Dec 20 13:50:15 2006 +++ llvm/lib/VMCore/Verifier.cpp Wed Dec 20 15:20:13 2006 @@ -902,6 +902,10 @@ if (InvokeInst *II = dyn_cast(Op)) { OpBlock = II->getNormalDest(); + Assert2(OpBlock != II->getUnwindDest(), + "No uses of invoke possible due to dominance structure!", + Op, II); + // If the normal successor of an invoke instruction has multiple // predecessors, then the normal edge from the invoke is critical, so // the invoke value can only be live if the destination block @@ -931,8 +935,9 @@ } } } - Assert1(!Bad, - "Invoke value defined on critical edge but not dead!", &I); + Assert2(!Bad, + "Invoke value defined on critical edge but not dead!", &I, + Op); } } else if (OpBlock == BB) { // If they are in the same basic block, make sure that the definition From jlaskey at apple.com Wed Dec 20 15:33:49 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Dec 2006 15:33:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200612202133.kBKLXnS9015616@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.224 -> 1.225 --- Log message: Original patch was overly complicated. --- Diffs of the changes: (+11 -34) PPCAsmPrinter.cpp | 45 +++++++++++---------------------------------- 1 files changed, 11 insertions(+), 34 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.224 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.225 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.224 Wed Dec 20 14:56:46 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Dec 20 15:33:34 2006 @@ -89,38 +89,15 @@ /// stripRegisterPrefix - This method strips the character prefix from a /// register name so that only the number is left. Used by for linux asm. - void stripRegisterPrefix(std::string &Name) { - // Potential prefixes. - static const char *Prefixes[] = { "r", "f", "v", "cr" }; - unsigned NPrefixes = sizeof(Prefixes) / sizeof(const char *); - // Fetch string length. - unsigned Size = Name.size(); - // Start position of numeric portion. - unsigned Pos = 0; - - // Try each prefix. - for (unsigned i = 0; i < NPrefixes; ++i) { - const char *Prefix = Prefixes[i]; - unsigned Length = strlen(Prefix); - // Does it match the beginning? - if (Name.compare(0, Length, Prefix, Length) == 0) { - // If so, start looking beyond the prefix. - Pos = strlen(Prefix); - break; - } - } - - // If we have a match. - if (Pos) { - // Remaining characters better be digits. - for (unsigned j = Pos; j < Size; ++j) { - unsigned Ch = Name[j]; - if (Ch < '0' || '9' < Ch) return; - } - - // Pass back just the numeric portion. - Name = Name.substr(Pos, Size - Pos); + const char *stripRegisterPrefix(const char *RegName) { + switch (RegName[0]) { + case 'r': + case 'f': + case 'v': return RegName + 1; + case 'c': if (RegName[0] == 'r') return RegName + 2; } + + return RegName; } /// printRegister - Print register according to target requirements. @@ -135,11 +112,11 @@ return; } - std::string Name = TM.getRegisterInfo()->get(RegNo).Name; + const char *RegName = TM.getRegisterInfo()->get(RegNo).Name; // Linux assembler (Others?) does not take register mnemonics. // FIXME - What about special registers used in mfspr/mtspr? - if (!Subtarget.isDarwin()) stripRegisterPrefix(Name); - O << Name; + if (!Subtarget.isDarwin()) RegName = stripRegisterPrefix(RegName); + O << RegName; } void printOperand(const MachineInstr *MI, unsigned OpNo) { From jlaskey at apple.com Wed Dec 20 15:35:15 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Dec 2006 15:35:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200612202135.kBKLZF76015651@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.225 -> 1.226 --- Log message: Oops. --- Diffs of the changes: (+1 -1) PPCAsmPrinter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.225 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.226 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.225 Wed Dec 20 15:33:34 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Dec 20 15:35:00 2006 @@ -94,7 +94,7 @@ case 'r': case 'f': case 'v': return RegName + 1; - case 'c': if (RegName[0] == 'r') return RegName + 2; + case 'c': if (RegName[1] == 'r') return RegName + 2; } return RegName; From rspencer at reidspencer.com Wed Dec 20 17:13:51 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 20 Dec 2006 15:13:51 -0800 Subject: [llvm-commits] [llvm-gcc] CastFixes To Make llvm-convert.cpp nearly signless (Review & Commit) Message-ID: <1166656431.4206.39.camel@bashful.x10sys.com> All, The attached patch removes all but one isSigned() calls from llvm-convert.cpp and otherwise makes it signless. This cleans up the casting patch committed yesterday and bases signedness only on TYPE_UNSIGNED(TREE_TYPE(tree)). The one exception can't be removed until the signed and unsigned integer types are unified. Although I've tested this extensively and it causes no regressions, it needs to be reviewed. In particular, in two places I have changed casts-to-bool into SetCondInst to prevent "trunc to bool" semantics which could break things. Some things to note: 1. EmitAsScalarType was just another name for a CastToType and had exactly one use so I just removed it and replaced its call with a CastToType call. 2. I've added several CastToXXType functions near the beginning of the file to assist with casting int<->int, fp<->fp, and any<->any. This just prevents a little opcode selection logic from being sprinkled throughout the source. 3. Most of the changes to llvm-types.cpp is just wrapping long lines. I noticed it so figured I'd fix it. 4. I added a tree typed argument to HandleScalarArgument so the signedness can be derived. This isn't always used, but its the only accurate way to get the signedness in a couple cases where it is used. If 0 is passed in, it defaults to unsigned. 5. In two places (1787 and 2516) I removed some casting. These were remnants from the SHIFT patch. Since shift no longer cares about the sign of its operands, there's no need to cast them to force a particular kind of shift. 6. The NOOPCastToType function is a misnomer. The casts it produces are often not BitCast (the only "noop" cast we have). It can do integer conversions and Ptr<->Int as well. I couldn't think of a better name for this so I just left it. 7. The rest of the changes are of two forms: (a) change a cast to use a specific cast opcode, or (b) change a cast to use an opcode derived from CastInst::getCastOpcode and the signedness information from the gcc tree available. One small step towards signlessness. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: CastFixes-llvmgcc.patch Type: text/x-patch Size: 47617 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061220/17b9ae14/attachment.bin From jlaskey at apple.com Wed Dec 20 18:02:03 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 20 Dec 2006 18:02:03 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2006-04-05-splat-ish.ll Frames-align.ll Frames-alloca.ll Frames-large.ll Frames-small.ll fsqrt.ll seteq-0.ll stfiwx.ll Message-ID: <200612210002.kBL023XD018193@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: 2006-04-05-splat-ish.ll updated: 1.2 -> 1.3 Frames-align.ll updated: 1.2 -> 1.3 Frames-alloca.ll updated: 1.2 -> 1.3 Frames-large.ll updated: 1.3 -> 1.4 Frames-small.ll updated: 1.3 -> 1.4 fsqrt.ll updated: 1.3 -> 1.4 seteq-0.ll updated: 1.2 -> 1.3 stfiwx.ll updated: 1.2 -> 1.3 --- Log message: These tests all rely on using register mnemonics and thus must behave in the world of darwin. --- Diffs of the changes: (+69 -69) 2006-04-05-splat-ish.ll | 2 +- Frames-align.ll | 6 +++--- Frames-alloca.ll | 32 ++++++++++++++++---------------- Frames-large.ll | 48 ++++++++++++++++++++++++------------------------ Frames-small.ll | 32 ++++++++++++++++---------------- fsqrt.ll | 8 ++++---- seteq-0.ll | 2 +- stfiwx.ll | 8 ++++---- 8 files changed, 69 insertions(+), 69 deletions(-) Index: llvm/test/Regression/CodeGen/PowerPC/2006-04-05-splat-ish.ll diff -u llvm/test/Regression/CodeGen/PowerPC/2006-04-05-splat-ish.ll:1.2 llvm/test/Regression/CodeGen/PowerPC/2006-04-05-splat-ish.ll:1.3 --- llvm/test/Regression/CodeGen/PowerPC/2006-04-05-splat-ish.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/PowerPC/2006-04-05-splat-ish.ll Wed Dec 20 18:01:42 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | grep 'vspltish v.*, 10' +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mcpu=g5 | grep 'vspltish v.*, 10' void %test(<8 x short>* %P) { %tmp = load <8 x short>* %P ; <<8 x short>> [#uses=1] Index: llvm/test/Regression/CodeGen/PowerPC/Frames-align.ll diff -u llvm/test/Regression/CodeGen/PowerPC/Frames-align.ll:1.2 llvm/test/Regression/CodeGen/PowerPC/Frames-align.ll:1.3 --- llvm/test/Regression/CodeGen/PowerPC/Frames-align.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/PowerPC/Frames-align.ll Wed Dec 20 18:01:42 2006 @@ -1,6 +1,6 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'rlwinm r0, r1, 0, 22, 31' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'subfic r0, r0, -17408' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'rldicl r0, r1, 0, 54' +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'rlwinm r0, r1, 0, 22, 31' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'subfic r0, r0, -17408' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'rldicl r0, r1, 0, 54' implementation Index: llvm/test/Regression/CodeGen/PowerPC/Frames-alloca.ll diff -u llvm/test/Regression/CodeGen/PowerPC/Frames-alloca.ll:1.2 llvm/test/Regression/CodeGen/PowerPC/Frames-alloca.ll:1.3 --- llvm/test/Regression/CodeGen/PowerPC/Frames-alloca.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/PowerPC/Frames-alloca.ll Wed Dec 20 18:01:42 2006 @@ -1,19 +1,19 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'stw r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'stwu r1, -64(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'lwz r1, 0(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'lwz r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'stw r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'stwu r1, -64(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'lwz r1, 0(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'lwz r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'std r31, 40(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'stdu r1, -112(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'ld r1, 0(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'ld r31, 40(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'std r31, 40(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'stdu r1, -112(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'ld r1, 0(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'ld r31, 40(r1)' +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'stw r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'stwu r1, -64(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'lwz r1, 0(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'lwz r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'stw r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'stwu r1, -64(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'lwz r1, 0(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'lwz r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'std r31, 40(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'stdu r1, -112(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'ld r1, 0(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'ld r31, 40(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'std r31, 40(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'stdu r1, -112(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'ld r1, 0(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'ld r31, 40(r1)' implementation Index: llvm/test/Regression/CodeGen/PowerPC/Frames-large.ll diff -u llvm/test/Regression/CodeGen/PowerPC/Frames-large.ll:1.3 llvm/test/Regression/CodeGen/PowerPC/Frames-large.ll:1.4 --- llvm/test/Regression/CodeGen/PowerPC/Frames-large.ll:1.3 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/PowerPC/Frames-large.ll Wed Dec 20 18:01:42 2006 @@ -1,27 +1,27 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep 'stw r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'lis r0, -1' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'ori r0, r0, 32704' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'stwux r1, r1, r0' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'lwz r1, 0(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep 'lwz r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'stw r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'lis r0, -1' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'ori r0, r0, 32704' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'stwux r1, r1, r0' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'lwz r1, 0(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'lwz r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep 'std r31, 40(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'lis r0, -1' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'ori r0, r0, 32656' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'stdux r1, r1, r0' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'ld r1, 0(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep 'ld r31, 40(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'std r31, 40(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'lis r0, -1' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'ori r0, r0, 32656' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'stdux r1, r1, r0' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'ld r1, 0(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'ld r31, 40(r1)' +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | not grep 'stw r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'lis r0, -1' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'ori r0, r0, 32704' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'stwux r1, r1, r0' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'lwz r1, 0(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | not grep 'lwz r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'stw r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'lis r0, -1' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'ori r0, r0, 32704' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'stwux r1, r1, r0' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'lwz r1, 0(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'lwz r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | not grep 'std r31, 40(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'lis r0, -1' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'ori r0, r0, 32656' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'stdux r1, r1, r0' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'ld r1, 0(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | not grep 'ld r31, 40(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'std r31, 40(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'lis r0, -1' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'ori r0, r0, 32656' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'stdux r1, r1, r0' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'ld r1, 0(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'ld r31, 40(r1)' implementation Index: llvm/test/Regression/CodeGen/PowerPC/Frames-small.ll diff -u llvm/test/Regression/CodeGen/PowerPC/Frames-small.ll:1.3 llvm/test/Regression/CodeGen/PowerPC/Frames-small.ll:1.4 --- llvm/test/Regression/CodeGen/PowerPC/Frames-small.ll:1.3 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/PowerPC/Frames-small.ll Wed Dec 20 18:01:42 2006 @@ -1,19 +1,19 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep 'stw r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'stwu r1, -16448(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'addi r1, r1, 16448' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep 'lwz r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'stw r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'stwu r1, -16448(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'addi r1, r1, 16448' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | grep 'lwz r31, 20(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep 'std r31, 40(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'stdu r1, -16496(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | grep 'addi r1, r1, 16496' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep 'ld r31, 40(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'std r31, 40(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'stdu r1, -16496(r1)' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'addi r1, r1, 16496' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | grep 'ld r31, 40(r1)' +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | not grep 'stw r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'stwu r1, -16448(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'addi r1, r1, 16448' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | not grep 'lwz r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'stw r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'stwu r1, -16448(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'addi r1, r1, 16448' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'lwz r31, 20(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | not grep 'std r31, 40(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'stdu r1, -16496(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | grep 'addi r1, r1, 16496' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | not grep 'ld r31, 40(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'std r31, 40(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'stdu r1, -16496(r1)' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'addi r1, r1, 16496' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | grep 'ld r31, 40(r1)' implementation Index: llvm/test/Regression/CodeGen/PowerPC/fsqrt.ll diff -u llvm/test/Regression/CodeGen/PowerPC/fsqrt.ll:1.3 llvm/test/Regression/CodeGen/PowerPC/fsqrt.ll:1.4 --- llvm/test/Regression/CodeGen/PowerPC/fsqrt.ll:1.3 Sat Dec 2 14:38:37 2006 +++ llvm/test/Regression/CodeGen/PowerPC/fsqrt.ll Wed Dec 20 18:01:42 2006 @@ -1,10 +1,10 @@ ; fsqrt should be generated when the fsqrt feature is enabled, but not ; otherwise. -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mattr=+fsqrt | grep 'fsqrt f1, f1' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | grep 'fsqrt f1, f1' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mattr=-fsqrt | not grep 'fsqrt f1, f1' && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g4 | not grep 'fsqrt f1, f1' +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mattr=+fsqrt | grep 'fsqrt f1, f1' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mcpu=g5 | grep 'fsqrt f1, f1' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mattr=-fsqrt | not grep 'fsqrt f1, f1' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mcpu=g4 | not grep 'fsqrt f1, f1' declare double %llvm.sqrt.f64(double) double %X(double %Y) { Index: llvm/test/Regression/CodeGen/PowerPC/seteq-0.ll diff -u llvm/test/Regression/CodeGen/PowerPC/seteq-0.ll:1.2 llvm/test/Regression/CodeGen/PowerPC/seteq-0.ll:1.3 --- llvm/test/Regression/CodeGen/PowerPC/seteq-0.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/PowerPC/seteq-0.ll Wed Dec 20 18:01:42 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'srwi r., r., 5' +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'srwi r., r., 5' int %eq0(int %a) { %tmp.1 = seteq int %a, 0 ; [#uses=1] Index: llvm/test/Regression/CodeGen/PowerPC/stfiwx.ll diff -u llvm/test/Regression/CodeGen/PowerPC/stfiwx.ll:1.2 llvm/test/Regression/CodeGen/PowerPC/stfiwx.ll:1.3 --- llvm/test/Regression/CodeGen/PowerPC/stfiwx.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/PowerPC/stfiwx.ll Wed Dec 20 18:01:42 2006 @@ -1,7 +1,7 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mattr=stfiwx | grep stfiwx && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mattr=stfiwx | not grep r1 && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mattr=-stfiwx | not grep stfiwx && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mattr=-stfiwx | grep r1 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mattr=stfiwx | grep stfiwx && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mattr=stfiwx | not grep r1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mattr=-stfiwx | not grep stfiwx && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mattr=-stfiwx | grep r1 void %test(float %a, int* %b) { %tmp.2 = cast float %a to int From dpatel at apple.com Wed Dec 20 18:17:06 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 20 Dec 2006 18:17:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612210017.kBL0H6pp018455@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.109 -> 1.110 --- Log message: At the beginning of run, initialize analyis info availability for _ALL_ pass managers. Otherwise, stale available analysis info, from the managers not yet run, may cause pass manager to take wrong turn. This fixes CBE test failures reported by nightly tester. --- Diffs of the changes: (+19 -5) PassManager.cpp | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.109 llvm/lib/VMCore/PassManager.cpp:1.110 --- llvm/lib/VMCore/PassManager.cpp:1.109 Tue Dec 19 14:12:38 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Dec 20 18:16:50 2006 @@ -189,6 +189,8 @@ void dumpPasses() const; void dumpArguments() const; + void initializeAllAnalysisInfo(); + protected: /// Collection of pass managers @@ -773,6 +775,21 @@ cerr << "\n"; } +void PMTopLevelManager::initializeAllAnalysisInfo() { + + for (std::vector::iterator I = PassManagers.begin(), + E = PassManagers.end(); I != E; ++I) { + PMDataManager *PMD = dynamic_cast(*I); + assert(PMD && "This is not a PassManager"); + PMD->initializeAnalysisInfo(); + } + + // Initailize other pass managers + for (std::vector::iterator I = IndirectPassManagers.begin(), + E = IndirectPassManagers.end(); I != E; ++I) + (*I)->initializeAnalysisInfo(); +} + //===----------------------------------------------------------------------===// // PMDataManager implementation @@ -1051,7 +1068,6 @@ return false; bool Changed = doInitialization(F); - initializeAnalysisInfo(); std::string Msg1 = "Executing Pass '"; std::string Msg3 = "' Made Modification '"; @@ -1240,6 +1256,7 @@ dumpArguments(); dumpPasses(); + initializeAllAnalysisInfo(); for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) { FPPassManager *FP = getContainedManager(Index); Changed |= FP->runOnFunction(F); @@ -1322,8 +1339,6 @@ if (F.isExternal()) return false; - initializeAnalysisInfo(); - std::string Msg1 = "Executing Pass '"; std::string Msg3 = "' Made Modification '"; @@ -1357,7 +1372,6 @@ bool FPPassManager::runOnModule(Module &M) { bool Changed = doInitialization(M); - initializeAnalysisInfo(); for(Module::iterator I = M.begin(), E = M.end(); I != E; ++I) this->runOnFunction(*I); @@ -1462,7 +1476,6 @@ bool MPPassManager::runOnModule(Module &M) { bool Changed = false; - initializeAnalysisInfo(); std::string Msg1 = "Executing Pass '"; std::string Msg3 = "' Made Modification '"; @@ -1528,6 +1541,7 @@ dumpArguments(); dumpPasses(); + initializeAllAnalysisInfo(); for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) { MPPassManager *MP = getContainedManager(Index); Changed |= MP->runOnModule(M); From rspencer at reidspencer.com Wed Dec 20 18:33:12 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Thu, 21 Dec 2006 00:33:12 +0000 Subject: [llvm-commits] [llvm-gcc] Removal of signedness from gcc/config/i386/i386.h Message-ID: <1166661192.4206.46.camel@bashful.x10sys.com> The attached patch removes signedness from the i386.h file, in particular the LLVM_TARGET_INTRINSIC_LOWER macro. The macro takes three additional arguments and depends on a change in the function its called from, like this: Index: gcc/llvm-convert.cpp =================================================================== --- gcc/llvm-convert.cpp (revision 230) +++ gcc/llvm-convert.cpp (working copy) @@ -3011,9 +3090,11 @@ for (tree args = TREE_OPERAND(exp, 1); args; args = TREE_CHAIN(args)) Operands.push_back(Emit(TREE_VALUE(args), 0)); + bool ResIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(fndecl))); + bool ExpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp)); unsigned FnCode = DECL_FUNCTION_CODE(fndecl); - LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, - ResultType, Operands, CurBB); + LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, ResultType, Operands, + CurBB, exp, ResIsSigned, ExpIsSigned); #endif return false; } This allows the macro to make signedness determinations based on the gcc tree codes. Although this patch removes isSigned() calls and is correct, it is not optimal. It is still using CastInst::getCastOpcode to figure out the casting opcode for it. Perhaps someone with a little more knowledge of the intrinsic functions could narrow these down to the appropriate cast opcode. Please review and commit when you can. Reid. From rspencer at reidspencer.com Wed Dec 20 18:34:21 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 20 Dec 2006 16:34:21 -0800 Subject: [llvm-commits] [llvm-gcc] Removal of signedness from gcc/config/i386/i386.h Message-ID: <1166661261.4206.48.camel@bashful.x10sys.com> (this email actually has the patch attached) The attached patch removes signedness from the i386.h file, in particular the LLVM_TARGET_INTRINSIC_LOWER macro. The macro takes three additional arguments and depends on a change in the function its called from, like this: Index: gcc/llvm-convert.cpp =================================================================== --- gcc/llvm-convert.cpp (revision 230) +++ gcc/llvm-convert.cpp (working copy) @@ -3011,9 +3090,11 @@ for (tree args = TREE_OPERAND(exp, 1); args; args = TREE_CHAIN(args)) Operands.push_back(Emit(TREE_VALUE(args), 0)); + bool ResIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(fndecl))); + bool ExpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp)); unsigned FnCode = DECL_FUNCTION_CODE(fndecl); - LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, - ResultType, Operands, CurBB); + LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, ResultType, Operands, + CurBB, exp, ResIsSigned, ExpIsSigned); #endif return false; } This allows the macro to make signedness determinations based on the gcc tree codes. Although this patch removes isSigned() calls and is correct, it is not optimal. It is still using CastInst::getCastOpcode to figure out the casting opcode for it. Perhaps someone with a little more knowledge of the intrinsic functions could narrow these down to the appropriate cast opcode. Please review and commit when you can. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: macrocall.patch Type: text/x-patch Size: 794 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061220/1535e259/attachment.bin From rspencer at reidspencer.com Wed Dec 20 18:46:12 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Thu, 21 Dec 2006 00:46:12 +0000 Subject: [llvm-commits] [llvm-gcc] Signedness patch for rs6000.h Message-ID: <1166661972.4206.51.camel@bashful.x10sys.com> Attached is a patch for the gcc/config/rs6000/rs6000.h file to remove isSigned() calls. This is analgous to the last patch I sent but for PPC instead of X86. Same comments apply. This patch has not been compiled or tested as I don't have a PPC machine. Please review and try it. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: ppc-llvmgcc.patch Type: text/x-patch Size: 5074 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/3609aae0/attachment.bin From nicholas at mxc.ca Wed Dec 20 19:14:19 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 20 Dec 2006 20:14:19 -0500 Subject: [llvm-commits] ppc linux patch 3 Message-ID: <4589DFEB.40500@mxc.ca> This is the last patch, adding the LinuxAsmPrinter and LinuxTargetAsmInfo. Most of the code is a copy of the DarwinAsmPrinter. Nick Lewycky -------------- next part -------------- A non-text attachment was scrubbed... Name: ppclinux.3.patch Type: text/x-patch Size: 16482 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061220/6178b454/attachment.bin From nicholas at mxc.ca Wed Dec 20 19:20:44 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 20 Dec 2006 20:20:44 -0500 Subject: [llvm-commits] ppc linux patch 3.1 In-Reply-To: <4589DFEB.40500@mxc.ca> References: <4589DFEB.40500@mxc.ca> Message-ID: <4589E16C.3000608@mxc.ca> The original patch had a merge error and wouldn't compile. This one has been fixed. As well, a large #if 0 has been replaced with a simple "TODO" comment. Nick -------------- next part -------------- A non-text attachment was scrubbed... Name: ppclinux.3.1.patch Type: text/x-patch Size: 13703 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061220/8426c957/attachment.bin From clattner at apple.com Wed Dec 20 19:21:08 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 20 Dec 2006 17:21:08 -0800 Subject: [llvm-commits] [llvm-gcc] CastFixes To Make llvm-convert.cpp nearly signless (Review & Commit) In-Reply-To: <1166656431.4206.39.camel@bashful.x10sys.com> References: <1166656431.4206.39.camel@bashful.x10sys.com> Message-ID: <01BE6957-9B05-4AF0-B8AB-EE36ACA411B2@apple.com> On Dec 20, 2006, at 3:13 PM, Reid Spencer wrote: > The attached patch removes all but one isSigned() calls from > llvm-convert.cpp and otherwise makes it signless. This cleans up the > casting patch committed yesterday and bases signedness only on > TYPE_UNSIGNED(TREE_TYPE(tree)). The one exception can't be removed > until > the signed and unsigned integer types are unified. Woot. > Although I've tested this extensively and it causes no regressions, it > needs to be reviewed. In particular, in two places I have changed > casts-to-bool into SetCondInst to prevent "trunc to bool" semantics > which could break things. Ok. > Some things to note: > > 1. EmitAsScalarType was just another name for a CastToType and had > exactly one use > so I just removed it and replaced its call with a CastToType call. Ok. However, please change this: @@ -1314,9 +1366,11 @@ Value *TreeToLLVM::EmitCOND_EXPR(tree exp) { + // Emit the conditional expression and trunc/bitcast to BoolTy + Value *Cond = Emit(COND_EXPR_COND(exp), 0); + Cond = new SetCondInst(Instruction::SetNE, Cond, + Constant::getNullValue(Cond->getType()), "toBool", + CurBB); tree Then = COND_EXPR_THEN(exp); tree Else = COND_EXPR_ELSE(exp); ... to only make the setne instruction if Cond->getType() != Type::BoolTy. It is common for the predicate to be bool, so we should avoid the extraneous instruction if so. Value *TreeToLLVM::EmitTRUTH_NOT_EXPR(tree exp) { Value *V = Emit(TREE_OPERAND(exp, 0), 0); + V = new SetCondInst(Instruction::SetNE, V, + Constant::getNullValue(V->getType()), "toBool", CurBB); V = BinaryOperator::createNot(V, V->getName()+"not", CurBB); + return CastToUIntType(V, ConvertType(TREE_TYPE(exp))); } Likewise. Likewise in TreeToLLVM::EmitTruthOp. > 2. I've added several CastToXXType functions near the beginning of the > file to > assist with casting int<->int, fp<->fp, and any<->any. This just > prevents a > little opcode selection logic from being sprinkled throughout the > source. Ok. Please rename CastToIntType -> CastToSIntType to make it explicit it is signed. In CastToFPType, if srcbits == dstbits, just return V. > 3. Most of the changes to llvm-types.cpp is just wrapping long > lines. I > noticed it > so figured I'd fix it. > 4. I added a tree typed argument to HandleScalarArgument so the > signedness > can be derived. This isn't always used, but its the only > accurate way to get > the signedness in a couple cases where it is used. If 0 is > passed in, it > defaults to unsigned. Are you sure? The code looks like it handles null as signed: =================================================================== --- gcc/llvm-convert.cpp (revision 230) +++ gcc/llvm-convert.cpp (working copy) @@ -214,10 +214,9 @@ // the actual impls is a short or char. assert(ArgVal->getType()->isIntegral() && LLVMTy->isIntegral () && "Lowerings don't match?"); - Instruction::CastOps opcode = CastInst::getCastOpcode( - ArgVal, ArgVal->getType()->isSigned(), LLVMTy, LLVMTy- >isSigned()); - ArgVal = - CastInst::create(opcode, ArgVal, LLVMTy, NameStack.back(), CurBB); + bool isSigned = type == 0 ? true : !TYPE_UNSIGNED(type); + ArgVal = CastInst::createIntegerCast(ArgVal, LLVMTy, isSigned, + NameStack.back(), CurBB); > 5. In two places (1787 and 2516) I removed some casting. These were > remnants from > the SHIFT patch. Since shift no longer cares about the sign of its > operands, > there's no need to cast them to force a particular kind of shift. Great. > 6. The NOOPCastToType function is a misnomer. The casts it produces > are > often > not BitCast (the only "noop" cast we have). It can do integer > conversions and > Ptr<->Int as well. I couldn't think of a better name for this so I > just left it. The only place where you call NOOPCastToType without a bitcast operand is in the "@@ -2475,8 +2544,18 @@" hunk of the patch. Why not just change that the call CastToType, and change the rest to not pass bitcast? While you're at it, you could rename NOOPCastToType to BitCastToType. You can change "CastToType(BitCast, ...)" calls to call BitCastToType instead. Doing this will also eliminate the call to isNoopCast (the ctor for bitcast does the check), which makes it dead. > 7. The rest of the changes are of two forms: (a) change a cast to > use a > specific > cast opcode, or (b) change a cast to use an opcode derived from > CastInst::getCastOpcode and the signedness information from the gcc > tree > available. This code (EmitLV_ARRAY_REF): @@ -3832,7 +3917,7 @@ IndexVal->getType() != Type::UIntTy && IndexVal->getType() != Type::LongTy && IndexVal->getType() != Type::ULongTy) - IndexVal = CastToType(IndexVal, Type::LongTy); + IndexVal = CastToType(Instruction::SExt, IndexVal, Type::LongTy); // Check for variable sized array reference. if (TREE_CODE(TREE_TYPE(Array)) == ARRAY_TYPE) { Is incorrect. We need to do two things here: If 'Index' is TREE_UNSIGNED and smaller than intptr_t, the CFE should emit a zext to intptr_t. This is because the 'gep always does sign extension' could would handle it wrong, and explicitly inserting a sext is also wrong. If the index is not TREE_UNSIGNED, and it is not 32/64 bits, inserting a sext is right. > One small step towards signlessness. Nice. Please make the minor changes above, the result will be immediately commitable. Thanks Reid, -Chris p.s. there is no need to cc me on patches, I subscribe to llvm- commits :) From clattner at apple.com Wed Dec 20 19:43:44 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 20 Dec 2006 17:43:44 -0800 Subject: [llvm-commits] [llvm-gcc] Signedness patch for rs6000.h In-Reply-To: <1166661972.4206.51.camel@bashful.x10sys.com> References: <1166661972.4206.51.camel@bashful.x10sys.com> Message-ID: <52759986-CD3D-41AA-80D9-6AB8C56B0A8A@apple.com> On Dec 20, 2006, at 4:46 PM, Reid Spencer wrote: > Attached is a patch for the gcc/config/rs6000/rs6000.h file to remove > isSigned() calls. This is analgous to the last patch I sent but for > PPC > instead of X86. Same comments > apply. > > This patch has not been compiled or tested as I don't have a PPC > machine. Please review and try it. This patch looks fine to me. Jim, please check that it works (e.g. by making a testcase that uses the modified instructions) and commit it if it looks good to you, Thanks, -Chris From clattner at apple.com Wed Dec 20 19:45:39 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 20 Dec 2006 17:45:39 -0800 Subject: [llvm-commits] [llvm-gcc] Removal of signedness from gcc/config/i386/i386.h In-Reply-To: <1166661261.4206.48.camel@bashful.x10sys.com> References: <1166661261.4206.48.camel@bashful.x10sys.com> Message-ID: <9CA5DA21-47D2-4A78-A854-6FC240F175F7@apple.com> Is there a change to i386.h that goes along with this? -Chris On Dec 20, 2006, at 4:34 PM, Reid Spencer wrote: > (this email actually has the patch attached) > > The attached patch removes signedness from the i386.h file, in > particular the LLVM_TARGET_INTRINSIC_LOWER macro. The macro takes > three > additional arguments and depends on a change in the function its > called > from, like this: > > Index: gcc/llvm-convert.cpp > =================================================================== > --- gcc/llvm-convert.cpp (revision 230) > +++ gcc/llvm-convert.cpp (working copy) > @@ -3011,9 +3090,11 @@ > for (tree args = TREE_OPERAND(exp, 1); args; args = TREE_CHAIN > (args)) > Operands.push_back(Emit(TREE_VALUE(args), 0)); > > + bool ResIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(fndecl))); > + bool ExpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp)); > unsigned FnCode = DECL_FUNCTION_CODE(fndecl); > - LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, > - ResultType, Operands, CurBB); > + LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, ResultType, > Operands, > + CurBB, exp, ResIsSigned, ExpIsSigned); > #endif > return false; > } > > This allows the macro to make signedness determinations based on > the gcc > tree codes. > > Although this patch removes isSigned() calls and is correct, it is not > optimal. It is still using CastInst::getCastOpcode to figure out the > casting opcode for it. Perhaps someone with a little more knowledge of > the intrinsic functions could narrow these down to the appropriate > cast > opcode. > > Please review and commit when you can. > > Reid. > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From rspencer at reidspencer.com Wed Dec 20 19:47:40 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Thu, 21 Dec 2006 01:47:40 +0000 Subject: [llvm-commits] [llvm-gcc] Signedness patch for rs6000.h In-Reply-To: <52759986-CD3D-41AA-80D9-6AB8C56B0A8A@apple.com> References: <1166661972.4206.51.camel@bashful.x10sys.com> <52759986-CD3D-41AA-80D9-6AB8C56B0A8A@apple.com> Message-ID: <1166665660.4206.53.camel@bashful.x10sys.com> Jim, Don't commit that! These patches are intertwined. After everything is reviewed, I'll submit the whole thing as one patch. If you commit this, it will break on i386. Reid. On Wed, 2006-12-20 at 17:43 -0800, Chris Lattner wrote: > On Dec 20, 2006, at 4:46 PM, Reid Spencer wrote: > > > Attached is a patch for the gcc/config/rs6000/rs6000.h file to remove > > isSigned() calls. This is analgous to the last patch I sent but for > > PPC > > instead of X86. Same comments > > apply. > > > > This patch has not been compiled or tested as I don't have a PPC > > machine. Please review and try it. > > This patch looks fine to me. > > Jim, please check that it works (e.g. by making a testcase that uses > the modified instructions) and commit it if it looks good to you, > > Thanks, > > -Chris > From rspencer at reidspencer.com Wed Dec 20 19:57:25 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 20 Dec 2006 17:57:25 -0800 Subject: [llvm-commits] [llvm-gcc] Removal of signedness from gcc/config/i386/i386.h In-Reply-To: <1166661261.4206.48.camel@bashful.x10sys.com> References: <1166661261.4206.48.camel@bashful.x10sys.com> Message-ID: <1166666245.4206.55.camel@bashful.x10sys.com> Okay, one more time .. On Wed, 2006-12-20 at 16:34 -0800, Reid Spencer wrote: > (this email actually has the patch attached) > > The attached patch removes signedness from the i386.h file, in > particular the LLVM_TARGET_INTRINSIC_LOWER macro. The macro takes three > additional arguments and depends on a change in the function its called > from, like this: > > Index: gcc/llvm-convert.cpp > =================================================================== > --- gcc/llvm-convert.cpp (revision 230) > +++ gcc/llvm-convert.cpp (working copy) > @@ -3011,9 +3090,11 @@ > for (tree args = TREE_OPERAND(exp, 1); args; args = TREE_CHAIN(args)) > Operands.push_back(Emit(TREE_VALUE(args), 0)); > > + bool ResIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(fndecl))); > + bool ExpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp)); > unsigned FnCode = DECL_FUNCTION_CODE(fndecl); > - LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, > - ResultType, Operands, CurBB); > + LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, ResultType, > Operands, > + CurBB, exp, ResIsSigned, ExpIsSigned); > #endif > return false; > } > > This allows the macro to make signedness determinations based on the gcc > tree codes. > > Although this patch removes isSigned() calls and is correct, it is not > optimal. It is still using CastInst::getCastOpcode to figure out the > casting opcode for it. Perhaps someone with a little more knowledge of > the intrinsic functions could narrow these down to the appropriate cast > opcode. > > Please review and commit when you can. > > Reid. > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: i386-llvmgcc.patch Type: text/x-patch Size: 19268 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061220/26e3e19f/attachment.bin From clattner at apple.com Wed Dec 20 19:59:53 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 20 Dec 2006 17:59:53 -0800 Subject: [llvm-commits] [llvm-gcc] Removal of signedness from gcc/config/i386/i386.h In-Reply-To: <1166666245.4206.55.camel@bashful.x10sys.com> References: <1166661261.4206.48.camel@bashful.x10sys.com> <1166666245.4206.55.camel@bashful.x10sys.com> Message-ID: <8CD7E052-361A-4F87-AB3A-7CBDF6D3DBF1@apple.com> >> Although this patch removes isSigned() calls and is correct, it is >> not >> optimal. It is still using CastInst::getCastOpcode to figure out the >> casting opcode for it. Perhaps someone with a little more >> knowledge of >> the intrinsic functions could narrow these down to the appropriate >> cast >> opcode. This is fine. When the whole patch lands, please ping evan. Most of those casts are obviously bitcasts (vector -> vector). -Chris From rspencer at reidspencer.com Wed Dec 20 20:19:48 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Thu, 21 Dec 2006 02:19:48 +0000 Subject: [llvm-commits] [llvm-gcc] Signlessness Patch For llvm-gcc (Please Commit) Message-ID: <1166667589.4206.60.camel@bashful.x10sys.com> Attached is a post-review, combined patch for the last three I sent. This upgrades llvm-gcc to remove all isSigned() calls except one that has to remain until the integer types are signless. PLEASE COMMIT THIS :) Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: Signlessness-llvmgcc.patch Type: text/x-patch Size: 73953 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/b9eff9c7/attachment.bin From clattner at apple.com Wed Dec 20 20:22:44 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 20 Dec 2006 18:22:44 -0800 Subject: [llvm-commits] SETCC InstructionCombining.cpp [#1/n] In-Reply-To: <1166398509.2826.12.camel@bashful.x10sys.com> References: <1166398509.2826.12.camel@bashful.x10sys.com> Message-ID: On Dec 17, 2006, at 3:35 PM, Reid Spencer wrote: > Chris, > > Attached is the patch to InstructionCombining.cpp for SETCC conversion > to ICmpInst. This passes all tests. > > All your previous feedback has been incorporated and confirmed. The > test > just completed includes all those changes as well. > > I'm looking forward to finally committing the SETCC patch so we can > finish it off and then start removing unnecessary casts and > unifying the > integer types. +// SimplifyCompare - For a CmpInst this function just orders the operands +// so that theyare listed from right (least complex) to left (most complex). +// This puts constants before unary operators before binary operators. +// +bool InstCombiner::SimplifyCompare(CmpInst &I) { Please doxygenify the comment. + bool Changed = false; + if (getComplexity(I.getOperand(0)) < getComplexity(I.getOperand (1))) { + I.swapOperands(); + Changed = true; + } + // Compare instructions are not associative so there's nothing else we can do. + return Changed; +} Why not: if (getComplexity(I.getOperand(0)) >= getComplexity(I.getOperand(1))) return false; I.swapOperands(); return true; ? // isTrueWhenEqual - Return true if the specified setcondinst instruction is // true when both operands are equal... // static bool isTrueWhenEqual(Instruction &I) { + if (ICmpInst *ICI = dyn_cast(&I)) + return ICI->getPredicate() == ICmpInst::ICMP_EQ || + ICI->getPredicate() == ICmpInst::ICMP_UGE || + ICI->getPredicate() == ICmpInst::ICMP_SGE || + ICI->getPredicate() == ICmpInst::ICMP_ULE || + ICI->getPredicate() == ICmpInst::ICMP_SLE; return I.getOpcode() == Instruction::SetEQ || I.getOpcode() == Instruction::SetGE || I.getOpcode() == Instruction::SetLE; } This should be split into two functions, one for ICmpInst and one for FCmpInst/SetCondInst. Since your touching it, plz doxygenify also. :) @@ -1580,21 +1607,31 @@ static Value *FoldOperationIntoSelectOpe // Figure out if the constant is the left or the right argument. bool ConstIsRHS = isa(I.getOperand(1)); Constant *ConstOperand = cast(I.getOperand(ConstIsRHS)); if (Constant *SOC = dyn_cast(SO)) { - if (ConstIsRHS) - return ConstantExpr::get(I.getOpcode(), SOC, ConstOperand); - return ConstantExpr::get(I.getOpcode(), ConstOperand, SOC); + if (CmpInst *CI = dyn_cast(&I)) { + unsigned short pred = CI->getPredicate(); + if (ConstIsRHS) + return ConstantExpr::getCompare(pred, SOC, ConstOperand); + return ConstantExpr::getCompare(pred, ConstOperand, SOC); This code doesn't appear to be called for compares. Is it? If so, the code is broken, you can't just swap the LHS/RHS of a compare like that without breaking things. +/// isSignBitCheck - Given an exploded icmp instruction, return true if it /// really just returns true if the most significant (sign) bit is set. +static bool isSignBitCheck(ICmpInst::Predicate pred, Value *LHS, + ConstantInt *RHS) { There is no reason to pass LHS into this function (this is an absolute statement, not a bug in your patch) please remove LHS. + case ICmpInst::ICMP_UGE: + // True if LHS u>= RHS and RHS == high-bit-mask (2^7, 2^15, 2^31, etc) + return RHS->getZExtValue() == 1ULL << + RHS->getType()->getPrimitiveSizeInBits()-1; Please add parens to make the precedence more explicit, even though it is right. More tomorrow, -Chris From reid at x10sys.com Thu Dec 21 00:44:01 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 00:44:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200612210644.kBL6i1Ce024401@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.74 -> 1.75 --- Log message: Add some comments about things that can go away once signless types are in. --- Diffs of the changes: (+8 -1) ScalarEvolution.cpp | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.74 llvm/lib/Analysis/ScalarEvolution.cpp:1.75 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.74 Tue Dec 19 16:30:33 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Thu Dec 21 00:43:46 2006 @@ -173,6 +173,8 @@ SCEVHandle SCEVConstant::get(ConstantInt *V) { // Make sure that SCEVConstant instances are all unsigned. + // FIXME:Signless. This entire if statement can be removed when integer types + // are signless. There won't be a need to bitcast then. if (V->getType()->isSigned()) { const Type *NewTy = V->getType()->getUnsignedVersion(); V = cast( @@ -459,7 +461,10 @@ C = Constant::getNullValue(Ty); else if (Ty->isFloatingPoint()) C = ConstantFP::get(Ty, Val); - else if (Ty->isSigned()) + /// FIXME:Signless. when integer types are signless, just change this to: + /// else + /// C = ConstantInt::get(Ty, Val); + else if (Ty->isSigned()) C = ConstantInt::get(Ty, Val); else { C = ConstantInt::get(Ty->getSignedVersion(), Val); @@ -1574,6 +1579,8 @@ // Now that we have it, if it's signed, convert it to an unsigned // range. + // FIXME:Signless. This entire if statement can go away when + // integers are signless. ConstantRange is already signless. if (CompRange.getLower()->getType()->isSigned()) { const Type *NewTy = RHSC->getValue()->getType(); Constant *NewL = ConstantExpr::getBitCast(CompRange.getLower(), From reid at x10sys.com Thu Dec 21 00:57:51 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 00:57:51 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.rules Message-ID: <200612210657.kBL6vpkN024603@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.rules updated: 1.20 -> 1.21 --- Log message: Restore definitions of LCC1 and LCC1PLUS to cause test programs to be dependent upon the llvm-gcc compiler components they use. --- Diffs of the changes: (+3 -0) Makefile.rules | 3 +++ 1 files changed, 3 insertions(+) Index: llvm-test/Makefile.rules diff -u llvm-test/Makefile.rules:1.20 llvm-test/Makefile.rules:1.21 --- llvm-test/Makefile.rules:1.20 Fri Dec 8 11:11:37 2006 +++ llvm-test/Makefile.rules Thu Dec 21 00:57:35 2006 @@ -774,6 +774,9 @@ endif +LCC1 := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1 +LCC1XX := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1plus +LCOLLECT2 :=$(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/collect2 #--------------------------------------------------------- From rspencer at reidspencer.com Thu Dec 21 01:13:26 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Thu, 21 Dec 2006 07:13:26 +0000 Subject: [llvm-commits] [llvm-gcc] Cast Fix In-Reply-To: <119AB276-889D-4BBE-89B6-820FE6C2C165@apple.com> References: <1166469922.2850.7.camel@bashful.x10sys.com> <1166485064.2850.39.camel@bashful.x10sys.com> <119AB276-889D-4BBE-89B6-820FE6C2C165@apple.com> Message-ID: <1166685206.4206.68.camel@bashful.x10sys.com> Chris, You asked for a case where I need to (recursively) determine the sign of a some Value. I have a case in mind: lib/Transforms/Utils/LowerSwitch.cpp. When it decides to lower this to a branch tree it is recursively calling switchConvert and passing the switch value in. The signedness is needed in order to generate the ICmpInst with either SLT or ULT for the branch tree. But that Value* being tested originates from operand 0 of the switch instruction. There's no way to determine if its signed or unsigned without starting to look at it. As I noted in my example below, it could take several steps of tracking through instructions before I come up with a definitive answer. And there may be no way to determine it statically if that search ends up at an argument, global variable, or constant. Can we just make switch staetments always use SLT for the comparison and have the issue go away? Reid. On Mon, 2006-12-18 at 23:15 -0800, Chris Lattner wrote: > >> You're basing all of the checks here on whether or not the LLVM types > >> are signed. I understand that this is the most expedient way to get > >> stuff working in the short term, but this isn't going to work long > >> term, as the ->isSigned() methods are not going to exist any more. > >> You should eventually migrate these to using TREE_UNSIGNED and > >> similar macros, checking properties from the GCC trees. > > > > Yes, I understand. I was solely working towards a) fixing the breakage > > and b) retaining current functionality. There were a lot of changes to > > make in a short time to get llvm-gcc compiling again. Many of these > > need > > some deep analysis and rather than delay the patch, I took this route. > > Yep, makes sense. > > >> > >> Further, the casts in i386.h that call getCastOpcode, should be > >> updated to use the appropriate cast. However, I'm not sure what they > >> are, you can work with Evan to figure them out. > > > > I tried a few of them as specific casts and it broke many things which > > is just an indication that I didn't fully analyze the set of types > > that > > can be passed in. The places were getCastOpcode will remain in use are > > those places where the type could be anything or close to anything > > (e.g. > > function arguments and returns). These also will be reviewed in more > > detail as I continue to remove signlessness. > > Ok. > > > FYI: my strategy here is to work from the bottom up. With the last few > > patches VMCore contains only one isSigned() call (in AsmWriter). I'm > > currently working on a fix for that. Once VMCore is clean, I'll > > move on > > to other libraries and on up the chain, removing getCastOpcode, > > isSigned, isUnsigned, getSignedVersion, getUnsignedVersion, etc. > > Nice. > > > This will take a while, many of the remaining cases require some > > significant modifications in order to figure out if the value is > > signed > > or not. Speaking of which, I was thinking of adding a method to > > Instruction, isSignedOperand(unsigned) which recursively figures > > out if > > the operand can be signed. Consider a bunch of arithmetic based on a > > ZExt or SExt, something like: > > > > bool %func(sbyte %a) { > > %b = zext sbyte %a to short > > %c = sext sbyte %a to ushort > > %d = add short %b, %b > > %e = add ushort %c, %c > > %f = bitcast short %d to ushort > > %ret = call bool %doit(ushort %f, short %d) > > ret bool %ret > > } > > > > In such a function the declared types are meaningless. %b is > > unsigned. % > > c is signed. When it comes time to check the parameters to %doit, I > > need > > to know that. About the only way I can think of is to write a function > > on Instruction that recursively calls itself following the use chain > > until it finds something that is concretely signed or not. Even this > > might not help. Suppose the zext and sext weren't in this function. I > > can't statically determine the signedness of sbyte %a which might be > > signed or not. > > I don't think this is a good idea. What specific clients would use > this? > > -Chris From reid at x10sys.com Thu Dec 21 01:16:10 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 01:16:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Message-ID: <200612210716.kBL7GA8U024876@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: SimplifyLibCalls.cpp updated: 1.78 -> 1.79 --- Log message: Get rid of a useless if statement whose then and else blocks were identical. --- Diffs of the changes: (+1 -4) SimplifyLibCalls.cpp | 5 +---- 1 files changed, 1 insertion(+), 4 deletions(-) Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.78 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.79 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.78 Tue Dec 19 17:16:47 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Thu Dec 21 01:15:54 2006 @@ -920,10 +920,7 @@ // strlen("xyz") -> 3 (for example) const Type *Ty = SLC.getTargetData()->getIntPtrType(); - if (Ty->isSigned()) - ci->replaceAllUsesWith(ConstantInt::get(Ty, len)); - else - ci->replaceAllUsesWith(ConstantInt::get(Ty, len)); + ci->replaceAllUsesWith(ConstantInt::get(Ty, len)); ci->eraseFromParent(); return true; From reid at x10sys.com Thu Dec 21 01:50:04 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 01:50:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp Message-ID: <200612210750.kBL7o4p8025348@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: ProfilingUtils.cpp updated: 1.11 -> 1.12 --- Log message: Remove isSigned calls via foreknowledge of main's argument types. --- Diffs of the changes: (+4 -7) ProfilingUtils.cpp | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.11 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.12 --- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.11 Mon Dec 18 02:47:13 2006 +++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp Thu Dec 21 01:49:49 2006 @@ -62,8 +62,8 @@ case 2: AI = MainFn->arg_begin(); ++AI; if (AI->getType() != ArgVTy) { - Instruction::CastOps opcode = CastInst::getCastOpcode(AI, - AI->getType()->isSigned(), ArgVTy, ArgVTy->isSigned()); + Instruction::CastOps opcode = CastInst::getCastOpcode(AI, false, ArgVTy, + false); InitCall->setOperand(2, CastInst::create(opcode, AI, ArgVTy, "argv.cast", InitCall)); } else { @@ -78,14 +78,11 @@ if (AI->getType() != Type::IntTy) { Instruction::CastOps opcode; if (!AI->use_empty()) { - opcode = CastInst::getCastOpcode(InitCall, - InitCall->getType()->isSigned(), AI->getType(), - AI->getType()->isSigned()); + opcode = CastInst::getCastOpcode(InitCall, true, AI->getType(), true); AI->replaceAllUsesWith( CastInst::create(opcode, InitCall, AI->getType(), "", InsertPos)); } - opcode = CastInst::getCastOpcode(AI, AI->getType()->isSigned(), - Type::IntTy, true); + opcode = CastInst::getCastOpcode(AI, true, Type::IntTy, true); InitCall->setOperand(1, CastInst::create(opcode, AI, Type::IntTy, "argc.cast", InitCall)); } else { From reid at x10sys.com Thu Dec 21 02:28:47 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 02:28:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp Message-ID: <200612210828.kBL8Sl9F001963@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.52 -> 1.53 --- Log message: Simplify all the casting business and get rid of isSigned(). --- Diffs of the changes: (+18 -64) IntrinsicLowering.cpp | 82 ++++++++++---------------------------------------- 1 files changed, 18 insertions(+), 64 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.52 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.53 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.52 Mon Dec 18 02:47:13 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Dec 21 02:28:31 2006 @@ -38,8 +38,7 @@ /// prototype doesn't match the arguments we expect to pass in. template static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI, - ArgIt ArgBegin, ArgIt ArgEnd, - const unsigned *castOpcodes, + ArgIt ArgBegin, ArgIt ArgEnd, bool isSigned, const Type *RetTy, Function *&FCache) { if (!FCache) { // If we haven't already looked up this function, check to see if the @@ -59,20 +58,15 @@ const FunctionType *FT = FCache->getFunctionType(); std::vector Operands; unsigned ArgNo = 0; - for (ArgIt I = ArgBegin; I != ArgEnd && ArgNo != FT->getNumParams(); + for (ArgIt I = ArgBegin; I != ArgEnd && ArgNo != FT->getNumParams(); ++I, ++ArgNo) { Value *Arg = *I; - if (Arg->getType() != FT->getParamType(ArgNo)) - if (castOpcodes[ArgNo]) - Arg = CastInst::create(Instruction::CastOps(castOpcodes[ArgNo]), - Arg, FT->getParamType(ArgNo), Arg->getName(), CI); - else { - Instruction::CastOps opcode = CastInst::getCastOpcode(Arg, - Arg->getType()->isSigned(), FT->getParamType(ArgNo), - FT->getParamType(ArgNo)->isSigned()); - Arg = CastInst::create(opcode, Arg, FT->getParamType(ArgNo), - Arg->getName(), CI); - } + if (Arg->getType() != FT->getParamType(ArgNo)) { + Instruction::CastOps opcode = CastInst::getCastOpcode(Arg, isSigned, + FT->getParamType(ArgNo), isSigned); + Arg = CastInst::create(opcode, Arg, FT->getParamType(ArgNo), + Arg->getName(), CI); + } Operands.push_back(Arg); } // Pass nulls into any additional arguments... @@ -85,9 +79,8 @@ if (!CI->use_empty()) { Value *V = NewCI; if (CI->getType() != NewCI->getType()) { - Instruction::CastOps opcode = CastInst::getCastOpcode(NewCI, - NewCI->getType()->isSigned(), CI->getType(), - CI->getType()->isSigned()); + Instruction::CastOps opcode = CastInst::getCastOpcode(NewCI, isSigned, + CI->getType(), isSigned); V = CastInst::create(opcode, NewCI, CI->getType(), Name, CI); } CI->replaceAllUsesWith(V); @@ -400,75 +393,38 @@ break; // Simply strip out debugging intrinsics case Intrinsic::memcpy_i32: { - // The memcpy intrinsic take an extra alignment argument that the memcpy - // libc function does not. - static unsigned opcodes[] = - { Instruction::BitCast, Instruction::BitCast, Instruction::BitCast }; - // FIXME: - // if (target_is_64_bit) opcodes[2] = Instruction::ZExt; - // else opcodes[2] = Instruction::BitCast; static Function *MemcpyFCache = 0; ReplaceCallWith("memcpy", CI, CI->op_begin()+1, CI->op_end()-1, - opcodes, (*(CI->op_begin()+1))->getType(), MemcpyFCache); + false, (*(CI->op_begin()+1))->getType(), MemcpyFCache); break; } case Intrinsic::memcpy_i64: { - static unsigned opcodes[] = - { Instruction::BitCast, Instruction::BitCast, Instruction::Trunc }; - // FIXME: - // if (target_is_64_bit) opcodes[2] = Instruction::BitCast; - // else opcodes[2] = Instruction::Trunc; static Function *MemcpyFCache = 0; ReplaceCallWith("memcpy", CI, CI->op_begin()+1, CI->op_end()-1, - opcodes, (*(CI->op_begin()+1))->getType(), MemcpyFCache); + false, (*(CI->op_begin()+1))->getType(), MemcpyFCache); break; } case Intrinsic::memmove_i32: { - // The memmove intrinsic take an extra alignment argument that the memmove - // libc function does not. - static unsigned opcodes[] = - { Instruction::BitCast, Instruction::BitCast, Instruction::BitCast }; - // FIXME: - // if (target_is_64_bit) opcodes[2] = Instruction::ZExt; - // else opcodes[2] = Instruction::BitCast; static Function *MemmoveFCache = 0; ReplaceCallWith("memmove", CI, CI->op_begin()+1, CI->op_end()-1, - opcodes, (*(CI->op_begin()+1))->getType(), MemmoveFCache); + false, (*(CI->op_begin()+1))->getType(), MemmoveFCache); break; } case Intrinsic::memmove_i64: { - // The memmove intrinsic take an extra alignment argument that the memmove - // libc function does not. - static const unsigned opcodes[] = - { Instruction::BitCast, Instruction::BitCast, Instruction::Trunc }; - // if (target_is_64_bit) opcodes[2] = Instruction::BitCast; - // else opcodes[2] = Instruction::Trunc; static Function *MemmoveFCache = 0; ReplaceCallWith("memmove", CI, CI->op_begin()+1, CI->op_end()-1, - opcodes, (*(CI->op_begin()+1))->getType(), MemmoveFCache); + false, (*(CI->op_begin()+1))->getType(), MemmoveFCache); break; } case Intrinsic::memset_i32: { - // The memset intrinsic take an extra alignment argument that the memset - // libc function does not. - static const unsigned opcodes[] = - { Instruction::BitCast, Instruction::ZExt, Instruction::ZExt, 0 }; - // if (target_is_64_bit) opcodes[2] = Instruction::BitCast; - // else opcodes[2] = Instruction::ZExt; static Function *MemsetFCache = 0; ReplaceCallWith("memset", CI, CI->op_begin()+1, CI->op_end()-1, - opcodes, (*(CI->op_begin()+1))->getType(), MemsetFCache); + true, (*(CI->op_begin()+1))->getType(), MemsetFCache); } case Intrinsic::memset_i64: { - // The memset intrinsic take an extra alignment argument that the memset - // libc function does not. - static const unsigned opcodes[] = - { Instruction::BitCast, Instruction::ZExt, Instruction::Trunc, 0 }; - // if (target_is_64_bit) opcodes[2] = Instruction::BitCast; - // else opcodes[2] = Instruction::Trunc; static Function *MemsetFCache = 0; ReplaceCallWith("memset", CI, CI->op_begin()+1, CI->op_end()-1, - opcodes, (*(CI->op_begin()+1))->getType(), MemsetFCache); + true, (*(CI->op_begin()+1))->getType(), MemsetFCache); break; } case Intrinsic::isunordered_f32: @@ -484,17 +440,15 @@ break; } case Intrinsic::sqrt_f32: { - static const unsigned opcodes[] = { 0 }; static Function *sqrtfFCache = 0; ReplaceCallWith("sqrtf", CI, CI->op_begin()+1, CI->op_end(), - opcodes, Type::FloatTy, sqrtfFCache); + false, Type::FloatTy, sqrtfFCache); break; } case Intrinsic::sqrt_f64: { - static const unsigned opcodes[] = { 0 }; static Function *sqrtFCache = 0; ReplaceCallWith("sqrt", CI, CI->op_begin()+1, CI->op_end(), - opcodes, Type::DoubleTy, sqrtFCache); + false, Type::DoubleTy, sqrtFCache); break; } } From jlaskey at apple.com Thu Dec 21 09:49:13 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Dec 2006 11:49:13 -0400 Subject: [llvm-commits] [llvm-gcc] Signedness patch for rs6000.h In-Reply-To: <52759986-CD3D-41AA-80D9-6AB8C56B0A8A@apple.com> References: <1166661972.4206.51.camel@bashful.x10sys.com> <52759986-CD3D-41AA-80D9-6AB8C56B0A8A@apple.com> Message-ID: It's a bit of a tango, but enclosed is the patch I'll check in. The i386 and ppc patches are dependent because of the change to LLVM_TARGET_INTRINSIC_LOWER. Below are additional changes to rs6000.h (marked in red). Index: gcc/config/rs6000/rs6000.h =================================================================== --- gcc/config/rs6000/rs6000.h (revision 121615) +++ gcc/config/rs6000/rs6000.h (working copy) @@ -3655,7 +3655,7 @@ Cache = M->getOrInsertFunction(NAME, FT); \ } \ Value *Offset = OPS[OPNUM], *Ptr = OPS[OPNUM +1]; \ - Ptr = CastToType(Ptr, VoidPtrTy); \ + Ptr = CastToType(Instruction::BitCast, Ptr, VoidPtrTy); \ if (!isa(Offset) || !cast(Offset)- >isNullValue()) \ Ptr = new GetElementPtrInst(Ptr, Offset, "tmp", CURBB); \ OPS.erase(OPS.begin() +OPNUM); \ @@ -3685,6 +3685,27 @@ ((TY == Type::SByteTy) ? 'b' : \ ((TY == Type::FloatTy) ? 'f' : 'x')))) +/* LLVM_TARGET_INTRINSIC_CAST_RESULT - This macro just provides a frequently + * used sequence for use inside LLVM_TARGET_INTRINSIC_LOWER. Note that this + * macro assumes it is being invoked from inside LLVM_TARGET_INTRINSC_LOWER + * (see below) because it requires the "ResIsSigned" and "ExpIsSigned" macro + * arguments in order to derive signedness for the cast. + */ +#define LLVM_TARGET_INTRINSIC_CAST_RESULT(RESULT, RESISSIGNED, DESTTY, \ + EXPISSIGNED) \ + { Instruction::CastOps opcode = CastInst::getCastOpcode (RESULT, \ + RESISSIGNED, DESTTY, EXPISSIGNED); \ + RESULT = CastInst::create(opcode, RESULT, DESTTY, "tmp", CurBB); \ + } + +/* LLVM_INTRINSIC_OP_IS_SIGNED - This macro determines if a given operand + * to the intrinsic is signed or not. Note that this macro assumes it is being + * invoked from inside LLVM_TARGET_INTRINSIC_LOWER (see below) because it + * requires the "exp" macro argument in order to determine signedness + */ +#define LLVM_INTRINSIC_OP_IS_SIGNED(EXP, OPNUM) \ + !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(EXP, (OPNUM+1)))) + /* LLVM_TARGET_INTRINSIC_LOWER - For builtins that we want to expand to normal * LLVM code, emit the code now. If we can handle the code, this macro should * emit the code, return true. Note that this would be much better as a @@ -3693,7 +3714,8 @@ * use methods it defines. */ #define LLVM_TARGET_INTRINSIC_LOWER(BUILTIN_CODE, DESTLOC, RESULT, \ - DESTTY, OPS, CURBB) \ + DESTTY, OPS, CURBB, EXP, RESISSIGNED, \ + EXPISSIGNED) \ switch (BUILTIN_CODE) { \ default: break; \ case ALTIVEC_BUILTIN_VADDFP: \ @@ -3827,34 +3849,39 @@ /* Map all of these to a shuffle. */ \ unsigned Amt = Elt->getZExtValue() & 15; \ PackedType *v16i8 = PackedType::get(Type::SByteTy, 16); \ - OPS[0] = CastToType(OPS[0], v16i8); \ - OPS[1] = CastToType(OPS[1], v16i8); \ + Value *Op0 = OPS [0]; \ + Instruction::CastOps opc = CastInst::getCastOpcode ( \ + Op0, Op0->getType()->isSigned(), DESTTY, DESTTY->isSigned ()); \ + OPS[0] = CastToType(opc, Op0, v16i8); \ + Value *Op1 = OPS [1]; \ + opc = CastInst::getCastOpcode ( \ + Op1, Op1->getType()->isSigned(), DESTTY, DESTTY->isSigned ()); \ + OPS[1] = CastToType(opc, Op1, v16i8); \ RESULT = BuildVectorShuffle(OPS[0], OPS [1], \ Amt, Amt+1, Amt+2, Amt +3, \ Amt+4, Amt+5, Amt+6, Amt +7, \ Amt+8, Amt+9, Amt+10, Amt +11, \ Amt+12, Amt+13, Amt+14, Amt +15); \ - RESULT = CastToType(RESULT, DESTTY); \ return true; \ } \ return false; \ case ALTIVEC_BUILTIN_VPKUHUM: { \ - Instruction::CastOps opc = CastInst::getCastOpcode ( \ - OPS[0], OPS[0]->getType()->isSigned(), DESTTY, DESTTY- >isSigned()); \ + Instruction::CastOps opc = CastInst::getCastOpcode(OPS [0], \ + LLVM_INTRINSIC_OP_IS_SIGNED(EXP,0), DESTTY, EXPISSIGNED); \ OPS[0] = CastInst::create(opc, OPS[0], DESTTY, OPS[0]->getName (), CurBB); \ - opc = CastInst::getCastOpcode ( \ - OPS[1], OPS[1]->getType()->isSigned(), DESTTY, DESTTY- >isSigned()); \ + opc = CastInst::getCastOpcode(OPS [1], \ + LLVM_INTRINSIC_OP_IS_SIGNED(EXP,1), DESTTY, EXPISSIGNED); \ OPS[1] = CastInst::create(opc, OPS[1], DESTTY, OPS[0]->getName (), CurBB); \ RESULT = BuildVectorShuffle(OPS[0], OPS[1], 1, 3, 5, 7, 9, 11, 13, 15, \ 17, 19, 21, 23, 25, 27, 29, 31); \ return true; \ } \ case ALTIVEC_BUILTIN_VPKUWUM: { \ - Instruction::CastOps opc = CastInst::getCastOpcode ( \ - OPS[0], OPS[0]->getType()->isSigned(), DESTTY, DESTTY- >isSigned()); \ + Instruction::CastOps opc = CastInst::getCastOpcode(OPS [0], \ + LLVM_INTRINSIC_OP_IS_SIGNED(EXP,0), DESTTY, EXPISSIGNED); \ OPS[0] = CastInst::create(opc, OPS[0], DESTTY, OPS[0]->getName (), CurBB); \ - opc = CastInst::getCastOpcode ( \ - OPS[1], OPS[1]->getType()->isSigned(), DESTTY, DESTTY- >isSigned()); \ + opc = CastInst::getCastOpcode(OPS [1], \ + LLVM_INTRINSIC_OP_IS_SIGNED(EXP,1), DESTTY, EXPISSIGNED); \ OPS[1] = CastInst::create(opc, OPS[1], DESTTY, OPS[0]->getName (), CurBB); \ RESULT = BuildVectorShuffle(OPS[0], OPS[1], 1, 3, 5, 7, 9, 11, 13, 15); \ return true; \ @@ -3888,9 +3915,7 @@ Constant *C = ConstantInt::get(Type::IntTy, 0x7FFFFFFF); \ C = ConstantPacked::get(std::vector(4, C)); \ RESULT = BinaryOperator::createAnd(OPS[0], C, "tmp", CurBB); \ - Instruction::CastOps opcode = CastInst::getCastOpcode ( \ - RESULT, RESULT->getType()->isSigned(), DESTTY, DESTTY- >isSigned()); \ - RESULT = CastInst::create(opcode, RESULT, DESTTY, "tmp", CurBB); \ + LLVM_TARGET_INTRINSIC_CAST_RESULT (RESULT,RESISSIGNED,DESTTY,EXPISSIGNED); \ return true; \ } \ Cheers, -- Jim ? On 20-Dec-06, at 09:43 PM, Chris Lattner wrote: > > On Dec 20, 2006, at 4:46 PM, Reid Spencer wrote: > >> Attached is a patch for the gcc/config/rs6000/rs6000.h file to remove >> isSigned() calls. This is analgous to the last patch I sent but >> for PPC >> instead of X86. Same comments >> apply. >> >> This patch has not been compiled or tested as I don't have a PPC >> machine. Please review and try it. > > This patch looks fine to me. > > Jim, please check that it works (e.g. by making a testcase that > uses the modified instructions) and commit it if it looks good to you, > > Thanks, > > -Chris > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/c9d99054/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: checkin.patch Type: application/octet-stream Size: 76884 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/c9d99054/attachment.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/c9d99054/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/c9d99054/attachment.bin From rspencer at reidspencer.com Thu Dec 21 11:40:07 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Thu, 21 Dec 2006 17:40:07 +0000 Subject: [llvm-commits] [llvm-gcc] Signedness patch for rs6000.h In-Reply-To: References: <1166661972.4206.51.camel@bashful.x10sys.com> <52759986-CD3D-41AA-80D9-6AB8C56B0A8A@apple.com> Message-ID: <1166722807.4206.73.camel@bashful.x10sys.com> On Thu, 2006-12-21 at 11:49 -0400, Jim Laskey wrote: > It's a bit of a tango, but enclosed is the patch I'll check in. The > i386 and ppc patches are dependent because of the change > to LLVM_TARGET_INTRINSIC_LOWER. Below are additional changes to > rs6000.h (marked in red). > > > > > Index: gcc/config/rs6000/rs6000.h > =================================================================== > --- gcc/config/rs6000/rs6000.h (revision 121615) > +++ gcc/config/rs6000/rs6000.h (working copy) > @@ -3655,7 +3655,7 @@ > Cache = M->getOrInsertFunction(NAME, FT); > \ > } > \ > Value *Offset = OPS[OPNUM], *Ptr = OPS[OPNUM+1]; > \ > - Ptr = CastToType(Ptr, VoidPtrTy); > \ > + Ptr = CastToType(Instruction::BitCast, Ptr, VoidPtrTy); > \ Okay, looks fine. > if (!isa(Offset) || ! > cast(Offset)->isNullValue()) \ > Ptr = new GetElementPtrInst(Ptr, Offset, "tmp", CURBB); > \ > OPS.erase(OPS.begin()+OPNUM); > \ > @@ -3685,6 +3685,27 @@ > ((TY == Type::SByteTy) ? 'b' : \ > ((TY == Type::FloatTy) ? 'f' : 'x')))) > > +/* LLVM_TARGET_INTRINSIC_CAST_RESULT - This macro just provides a > frequently > + * used sequence for use inside LLVM_TARGET_INTRINSIC_LOWER. Note > that this > + * macro assumes it is being invoked from inside > LLVM_TARGET_INTRINSC_LOWER > + * (see below) because it requires the "ResIsSigned" and > "ExpIsSigned" macro > + * arguments in order to derive signedness for the cast. > + */ > +#define LLVM_TARGET_INTRINSIC_CAST_RESULT(RESULT, RESISSIGNED, > DESTTY, \ > + EXPISSIGNED) > \ > + { Instruction::CastOps opcode = CastInst::getCastOpcode(RESULT, > \ > + RESISSIGNED, DESTTY, EXPISSIGNED); > \ > + RESULT = CastInst::create(opcode, RESULT, DESTTY, "tmp", CurBB); > \ > + } > + > +/* LLVM_INTRINSIC_OP_IS_SIGNED - This macro determines if a given > operand > + * to the intrinsic is signed or not. Note that this macro assumes it > is being > + * invoked from inside LLVM_TARGET_INTRINSIC_LOWER (see below) > because it > + * requires the "exp" macro argument in order to determine signedness > + */ > +#define LLVM_INTRINSIC_OP_IS_SIGNED(EXP, OPNUM) \ > + !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(EXP, (OPNUM+1)))) > + > /* LLVM_TARGET_INTRINSIC_LOWER - For builtins that we want to expand > to normal > * LLVM code, emit the code now. If we can handle the code, this > macro should > * emit the code, return true. Note that this would be much better > as a > @@ -3693,7 +3714,8 @@ > * use methods it defines. > */ > #define LLVM_TARGET_INTRINSIC_LOWER(BUILTIN_CODE, DESTLOC, RESULT, > \ > - DESTTY, OPS, CURBB) > \ > + DESTTY, OPS, CURBB, EXP, > RESISSIGNED, \ > + EXPISSIGNED) > \ > switch (BUILTIN_CODE) { > \ > default: break; > \ > case ALTIVEC_BUILTIN_VADDFP: > \ > @@ -3827,34 +3849,39 @@ > /* Map all of these to a shuffle. */ > \ > unsigned Amt = Elt->getZExtValue() & 15; > \ > PackedType *v16i8 = PackedType::get(Type::SByteTy, 16); > \ > - OPS[0] = CastToType(OPS[0], v16i8); > \ > - OPS[1] = CastToType(OPS[1], v16i8); > \ > + Value *Op0 = OPS[0]; > \ > + Instruction::CastOps opc = CastInst::getCastOpcode( > \ > + Op0, Op0->getType()->isSigned(), DESTTY, DESTTY->isSigned()); > \ This isn't right. You shouldn't add any isSigned() calls as they are going away. The signedness of Op0 needs to be determined using the LLVM_INTRINSIC_OP_IS_SIGNED macro. The signedness of DESTTY is provided in the EXPISSIGNED argument to the macro. > + OPS[0] = CastToType(opc, Op0, v16i8); > \ > + Value *Op1 = OPS[1]; > \ > + opc = CastInst::getCastOpcode( > \ > + Op1, Op1->getType()->isSigned(), DESTTY, DESTTY->isSigned()); > \ Same comment. > + OPS[1] = CastToType(opc, Op1, v16i8); > \ > RESULT = BuildVectorShuffle(OPS[0], OPS[1], > \ > Amt, Amt+1, Amt+2, Amt+3, > \ > Amt+4, Amt+5, Amt+6, Amt+7, > \ > Amt+8, Amt+9, Amt+10, Amt+11, > \ > Amt+12, Amt+13, Amt+14, Amt+15); > \ > - RESULT = CastToType(RESULT, DESTTY); > \ > return true; > \ > } > \ > return false; > \ > case ALTIVEC_BUILTIN_VPKUHUM: { > \ > - Instruction::CastOps opc = CastInst::getCastOpcode( > \ > - OPS[0], OPS[0]->getType()->isSigned(), DESTTY, > DESTTY->isSigned()); \ > + Instruction::CastOps opc = CastInst::getCastOpcode(OPS[0], > \ > + LLVM_INTRINSIC_OP_IS_SIGNED(EXP,0), DESTTY, EXPISSIGNED); > \ This one is correct. > OPS[0] = CastInst::create(opc, OPS[0], DESTTY, OPS[0]->getName(), > CurBB); \ > - opc = CastInst::getCastOpcode( > \ > - OPS[1], OPS[1]->getType()->isSigned(), DESTTY, > DESTTY->isSigned()); \ > + opc = CastInst::getCastOpcode(OPS[1], > \ > + LLVM_INTRINSIC_OP_IS_SIGNED(EXP,1), DESTTY, EXPISSIGNED); > \ > OPS[1] = CastInst::create(opc, OPS[1], DESTTY, OPS[0]->getName(), > CurBB); \ > RESULT = BuildVectorShuffle(OPS[0], OPS[1], 1, 3, 5, 7, 9, 11, > 13, 15, \ > 17, 19, 21, 23, 25, 27, 29, 31); > \ > return true; > \ > } > \ > case ALTIVEC_BUILTIN_VPKUWUM: { > \ > - Instruction::CastOps opc = CastInst::getCastOpcode( > \ > - OPS[0], OPS[0]->getType()->isSigned(), DESTTY, > DESTTY->isSigned()); \ > + Instruction::CastOps opc = CastInst::getCastOpcode(OPS[0], > \ > + LLVM_INTRINSIC_OP_IS_SIGNED(EXP,0), DESTTY, EXPISSIGNED); > \ > OPS[0] = CastInst::create(opc, OPS[0], DESTTY, OPS[0]->getName(), > CurBB); \ > - opc = CastInst::getCastOpcode( > \ > - OPS[1], OPS[1]->getType()->isSigned(), DESTTY, > DESTTY->isSigned()); \ > + opc = CastInst::getCastOpcode(OPS[1], > \ > + LLVM_INTRINSIC_OP_IS_SIGNED(EXP,1), DESTTY, EXPISSIGNED); > \ > OPS[1] = CastInst::create(opc, OPS[1], DESTTY, OPS[0]->getName(), > CurBB); \ > RESULT = BuildVectorShuffle(OPS[0], OPS[1], 1, 3, 5, 7, 9, 11, > 13, 15); \ > return true; > \ > @@ -3888,9 +3915,7 @@ > Constant *C = ConstantInt::get(Type::IntTy, 0x7FFFFFFF); > \ > C = ConstantPacked::get(std::vector(4, C)); > \ > RESULT = BinaryOperator::createAnd(OPS[0], C, "tmp", CurBB); > \ > - Instruction::CastOps opcode = CastInst::getCastOpcode( > \ > - RESULT, RESULT->getType()->isSigned(), DESTTY, > DESTTY->isSigned()); \ > - RESULT = CastInst::create(opcode, RESULT, DESTTY, "tmp", CurBB); > \ > + > LLVM_TARGET_INTRINSIC_CAST_RESULT(RESULT,RESISSIGNED,DESTTY,EXPISSIGNED); \ > return true; > \ > } > \ > > > Cheers, > > > -- Jim > > > > > > > > > > > > > > On 20-Dec-06, at 09:43 PM, Chris Lattner wrote: > > > > > > > On Dec 20, 2006, at 4:46 PM, Reid Spencer wrote: > > > > > > > Attached is a patch for the gcc/config/rs6000/rs6000.h file to > > > remove > > > isSigned() calls. This is analgous to the last patch I sent but > > > for PPC > > > instead of X86. Same comments > > > apply. > > > > > > > > > This patch has not been compiled or tested as I don't have a PPC > > > machine. Please review and try it. > > > > > > This patch looks fine to me. > > > > > > Jim, please check that it works (e.g. by making a testcase that uses > > the modified instructions) and commit it if it looks good to you, > > > > > > Thanks, > > > > > > -Chris > > > > > From reid at x10sys.com Thu Dec 21 12:59:31 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 12:59:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200612211859.kBLIxVKQ012214@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.75 -> 1.76 --- Log message: Add a FIXME about signedness. --- Diffs of the changes: (+2 -0) ScalarEvolution.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.75 llvm/lib/Analysis/ScalarEvolution.cpp:1.76 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.75 Thu Dec 21 00:43:46 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Thu Dec 21 12:59:16 2006 @@ -2151,6 +2151,8 @@ Constant *TwoA = ConstantExpr::getMul(A, Two); // The divisions must be performed as signed divisions. + // FIXME:Signedness. These casts can all go away once integer types are + // signless. const Type *SignedTy = NegB->getType()->getSignedVersion(); NegB = ConstantExpr::getBitCast(NegB, SignedTy); TwoA = ConstantExpr::getBitCast(TwoA, SignedTy); From reid at x10sys.com Thu Dec 21 13:04:39 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 13:04:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200612211904.kBLJ4dR9012315@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.127 -> 1.128 --- Log message: Just print integer constants as signed values. The actual signedness doesn't matter as it is determined in the way the constant is used. --- Diffs of the changes: (+1 -7) AsmPrinter.cpp | 8 +------- 1 files changed, 1 insertion(+), 7 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.127 llvm/lib/CodeGen/AsmPrinter.cpp:1.128 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.127 Tue Dec 19 15:04:20 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Thu Dec 21 13:04:23 2006 @@ -392,13 +392,7 @@ assert(CB->getValue()); O << "1"; } else if (const ConstantInt *CI = dyn_cast(CV)) { - if (CI->getType()->isSigned()) { - if (((CI->getSExtValue() << 32) >> 32) == CI->getSExtValue()) - O << CI->getSExtValue(); - else - O << (uint64_t)CI->getSExtValue(); - } else - O << CI->getZExtValue(); + O << CI->getSExtValue(); } else if (const GlobalValue *GV = dyn_cast(CV)) { // This is a constant address for a global variable or function. Use the // name of the variable or function as the address value, possibly From reid at x10sys.com Thu Dec 21 13:15:04 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 13:15:04 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-07-28-AsmPrint-Long-As-Pointer.ll Message-ID: <200612211915.kBLJF4n0012527@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: 2006-07-28-AsmPrint-Long-As-Pointer.ll updated: 1.2 -> 1.3 --- Log message: Integer constants now print out as signed values in the assembly, regardless of the signedness of the associated type. --- Diffs of the changes: (+1 -1) 2006-07-28-AsmPrint-Long-As-Pointer.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/X86/2006-07-28-AsmPrint-Long-As-Pointer.ll diff -u llvm/test/Regression/CodeGen/X86/2006-07-28-AsmPrint-Long-As-Pointer.ll:1.2 llvm/test/Regression/CodeGen/X86/2006-07-28-AsmPrint-Long-As-Pointer.ll:1.3 --- llvm/test/Regression/CodeGen/X86/2006-07-28-AsmPrint-Long-As-Pointer.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/X86/2006-07-28-AsmPrint-Long-As-Pointer.ll Thu Dec 21 13:14:49 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep 4294967240 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep -- -56 ; PR853 %X = global int* cast (ulong 18446744073709551560 to int*) From jlaskey at apple.com Thu Dec 21 14:22:16 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Dec 2006 16:22:16 -0400 Subject: [llvm-commits] ppc linux patch 3.1 In-Reply-To: <4589E16C.3000608@mxc.ca> References: <4589DFEB.40500@mxc.ca> <4589E16C.3000608@mxc.ca> Message-ID: <7D656114-EFBC-426E-AC38-8C0E918CB555@apple.com> Nick, I'm working on this merges. They look pretty good and I'm only going to tweak them a little. One general question. You moved r2 out of the allocation list. Are you using a TOC on linux? If so, you may run into some issues with respect to use of the save TOC area in ABI linkage area and we should come to some compromise. Cheers, -- Jim On 20-Dec-06, at 09:20 PM, Nick Lewycky wrote: > The original patch had a merge error and wouldn't compile. This one > has > been fixed. As well, a large #if 0 has been replaced with a simple > "TODO" comment. > > Nick > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/edaf3dab/attachment.bin From jlaskey at apple.com Thu Dec 21 14:26:25 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Dec 2006 14:26:25 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h Message-ID: <200612212026.kBLKQP0T013838@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.16 -> 1.17 --- Log message: Changes from Nick Lewycky with a simplified PPCTargetAsmInfo. --- Diffs of the changes: (+3 -2) TargetAsmInfo.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.16 llvm/include/llvm/Target/TargetAsmInfo.h:1.17 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.16 Fri Dec 1 15:50:17 2006 +++ llvm/include/llvm/Target/TargetAsmInfo.h Thu Dec 21 14:26:09 2006 @@ -26,10 +26,11 @@ /// TargetAsmInfo - This class is intended to be used as a base class for asm /// properties and features specific to the target. class TargetAsmInfo { - protected: + public: //===------------------------------------------------------------------===// // Properties to be set by the target writer, used to configure asm printer. - // + // Should not be accessed by anything but a subclass of TargetAsmInfo. Use + // accessor functions. /// TextSection - Section directive for standard text. /// From jlaskey at apple.com Thu Dec 21 14:26:26 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Dec 2006 14:26:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCRegisterInfo.td PPCTargetAsmInfo.cpp PPCTargetAsmInfo.h PPCTargetMachine.cpp Message-ID: <200612212026.kBLKQQQh013851@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.226 -> 1.227 PPCRegisterInfo.td updated: 1.42 -> 1.43 PPCTargetAsmInfo.cpp updated: 1.9 -> 1.10 PPCTargetAsmInfo.h updated: 1.3 -> 1.4 PPCTargetMachine.cpp updated: 1.110 -> 1.111 --- Log message: Changes from Nick Lewycky with a simplified PPCTargetAsmInfo. --- Diffs of the changes: (+274 -18) PPCAsmPrinter.cpp | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++- PPCRegisterInfo.td | 8 + PPCTargetAsmInfo.cpp | 43 +++++++-- PPCTargetAsmInfo.h | 10 ++ PPCTargetMachine.cpp | 7 + 5 files changed, 274 insertions(+), 18 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.226 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.227 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.226 Wed Dec 20 15:35:00 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Thu Dec 21 14:26:09 2006 @@ -282,6 +282,35 @@ virtual bool doFinalization(Module &M) = 0; }; + /// LinuxAsmPrinter - PowerPC assembly printer, customized for Linux + struct VISIBILITY_HIDDEN LinuxAsmPrinter : public PPCAsmPrinter { + + DwarfWriter DW; + + LinuxAsmPrinter(std::ostream &O, PPCTargetMachine &TM, + const TargetAsmInfo *T) + : PPCAsmPrinter(O, TM, T), DW(O, this, T) { + } + + virtual const char *getPassName() const { + return "Linux PPC Assembly Printer"; + } + + bool runOnMachineFunction(MachineFunction &F); + bool doInitialization(Module &M); + bool doFinalization(Module &M); + + void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addRequired(); + PPCAsmPrinter::getAnalysisUsage(AU); + } + + /// getSectionForFunction - Return the section that we should emit the + /// specified function body into. + virtual std::string getSectionForFunction(const Function &F) const; + }; + /// DarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac OS /// X struct VISIBILITY_HIDDEN DarwinAsmPrinter : public PPCAsmPrinter { @@ -491,7 +520,194 @@ return; } +/// runOnMachineFunction - This uses the printMachineInstruction() +/// method to print assembly for each instruction. +/// +bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) { + DW.SetDebugInfo(&getAnalysis()); + + SetupMachineFunction(MF); + O << "\n\n"; + + // Print out constants referenced by the function + EmitConstantPool(MF.getConstantPool()); + + // Print out labels for the function. + const Function *F = MF.getFunction(); + SwitchToTextSection(getSectionForFunction(*F).c_str(), F); + + switch (F->getLinkage()) { + default: assert(0 && "Unknown linkage type!"); + case Function::InternalLinkage: // Symbols default to internal. + break; + case Function::ExternalLinkage: + O << "\t.global\t" << CurrentFnName << '\n' + << "\t.type\t" << CurrentFnName << ", @function\n"; + break; + case Function::WeakLinkage: + case Function::LinkOnceLinkage: + O << "\t.global\t" << CurrentFnName << '\n'; + O << "\t.weak\t" << CurrentFnName << '\n'; + break; + } + EmitAlignment(2, F); + O << CurrentFnName << ":\n"; + + // Emit pre-function debug information. + DW.BeginFunction(&MF); + + // Print out code for the function. + for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); + I != E; ++I) { + // Print a label for the basic block. + if (I != MF.begin()) { + printBasicBlockLabel(I, true); + O << '\n'; + } + for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); + II != E; ++II) { + // Print the assembly for the instruction. + O << "\t"; + printMachineInstruction(II); + } + } + + O << "\t.size\t" << CurrentFnName << ",.-" << CurrentFnName << "\n"; + + // Print out jump tables referenced by the function. + EmitJumpTableInfo(MF.getJumpTableInfo(), MF); + + // Emit post-function debug information. + DW.EndFunction(); + + // We didn't modify anything. + return false; +} + +bool LinuxAsmPrinter::doInitialization(Module &M) { + AsmPrinter::doInitialization(M); + + // GNU as handles section names wrapped in quotes + Mang->setUseQuotes(true); + + SwitchToTextSection(TAI->getTextSection()); + + // Emit initial debug information. + DW.BeginModule(&M); + return false; +} + +bool LinuxAsmPrinter::doFinalization(Module &M) { + const TargetData *TD = TM.getTargetData(); + // Print out module-level global variables here. + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) { + if (!I->hasInitializer()) continue; // External global require no code + + // Check to see if this is a special global used by LLVM, if so, emit it. + if (EmitSpecialLLVMGlobal(I)) + continue; + + std::string name = Mang->getValueName(I); + Constant *C = I->getInitializer(); + unsigned Size = TD->getTypeSize(C->getType()); + unsigned Align = TD->getPreferredAlignmentLog(I); + + if (C->isNullValue() && /* FIXME: Verify correct */ + (I->hasInternalLinkage() || I->hasWeakLinkage() || + I->hasLinkOnceLinkage() || + (I->hasExternalLinkage() && !I->hasSection()))) { + if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. + if (I->hasExternalLinkage()) { + O << "\t.global " << name << '\n'; + O << "\t.type " << name << ", @object\n"; + //O << "\t.zerofill __DATA, __common, " << name << ", " + // << Size << ", " << Align; + } else if (I->hasInternalLinkage()) { + SwitchToDataSection("\t.data", I); + O << TAI->getLCOMMDirective() << name << "," << Size; + } else { + SwitchToDataSection("\t.data", I); + O << ".comm " << name << "," << Size; + } + O << "\t\t" << TAI->getCommentString() << " '" << I->getName() << "'\n"; + } else { + switch (I->getLinkage()) { + case GlobalValue::LinkOnceLinkage: + case GlobalValue::WeakLinkage: + O << "\t.global " << name << '\n' + << "\t.type " << name << ", @object\n" + << "\t.weak " << name << '\n'; + SwitchToDataSection("\t.data", I); + break; + case GlobalValue::AppendingLinkage: + // FIXME: appending linkage variables should go into a section of + // their name or something. For now, just emit them as external. + case GlobalValue::ExternalLinkage: + // If external or appending, declare as a global symbol + O << "\t.global " << name << "\n" + << "\t.type " << name << ", @object\n"; + // FALL THROUGH + case GlobalValue::InternalLinkage: + if (I->isConstant()) { + const ConstantArray *CVA = dyn_cast(C); + if (TAI->getCStringSection() && CVA && CVA->isCString()) { + SwitchToDataSection(TAI->getCStringSection(), I); + break; + } + } + + // FIXME: special handling for ".ctors" & ".dtors" sections + if (I->hasSection() && + (I->getSection() == ".ctors" || + I->getSection() == ".dtors")) { + std::string SectionName = ".section " + I->getSection() + + ",\"aw\", at progbits"; + SwitchToDataSection(SectionName.c_str()); + } else { + SwitchToDataSection(TAI->getDataSection(), I); + } + break; + default: + cerr << "Unknown linkage type!"; + abort(); + } + + EmitAlignment(Align, I); + O << name << ":\t\t\t\t" << TAI->getCommentString() << " '" + << I->getName() << "'\n"; + + // If the initializer is a extern weak symbol, remember to emit the weak + // reference! + if (const GlobalValue *GV = dyn_cast(C)) + if (GV->hasExternalWeakLinkage()) + ExtWeakSymbols.insert(GV); + + EmitGlobalConstant(C); + O << '\n'; + } + } + + // TODO + + // Emit initial debug information. + DW.EndModule(); + + AsmPrinter::doFinalization(M); + return false; // success +} + +std::string LinuxAsmPrinter::getSectionForFunction(const Function &F) const { + switch (F.getLinkage()) { + default: assert(0 && "Unknown linkage type!"); + case Function::ExternalLinkage: + case Function::InternalLinkage: return TAI->getTextSection(); + case Function::WeakLinkage: + case Function::LinkOnceLinkage: + return ".text"; + } +} std::string DarwinAsmPrinter::getSectionForFunction(const Function &F) const { switch (F.getLinkage()) { @@ -786,6 +1002,12 @@ /// FunctionPass *llvm::createPPCAsmPrinterPass(std::ostream &o, PPCTargetMachine &tm) { - return new DarwinAsmPrinter(o, tm, tm.getTargetAsmInfo()); + const PPCSubtarget *Subtarget = &tm.getSubtarget(); + + if (Subtarget->isDarwin()) { + return new DarwinAsmPrinter(o, tm, tm.getTargetAsmInfo()); + } else { + return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo()); + } } Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.td diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.td:1.42 llvm/lib/Target/PowerPC/PPCRegisterInfo.td:1.43 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.td:1.42 Mon Nov 20 14:48:05 2006 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.td Thu Dec 21 14:26:09 2006 @@ -209,9 +209,9 @@ // Allocate volatiles first // then nonvolatiles in reverse order since stmw/lmw save from rN to r31 def GPRC : RegisterClass<"PPC", [i32], 32, - [R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, + [R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R30, R29, R28, R27, R26, R25, R24, R23, R22, R21, R20, R19, R18, R17, - R16, R15, R14, R13, R31, R0, R1, LR]> + R16, R15, R14, R2, R13, R31, R0, R1, LR]> { let MethodProtos = [{ iterator allocation_order_begin(const MachineFunction &MF) const; @@ -224,6 +224,10 @@ } GPRCClass::iterator GPRCClass::allocation_order_end(const MachineFunction &MF) const { + // In Linux, r2 is reserved for the OS. + if (!MF.getTarget().getSubtarget().isDarwin()) + return end()-6; + // On PPC64, r13 is the thread pointer. Never allocate this register. // Note that this is overconservative, as it also prevents allocation of // R31 when the FP is not needed. Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.9 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.10 --- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.9 Fri Dec 1 14:47:11 2006 +++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Thu Dec 21 14:26:09 2006 @@ -16,24 +16,14 @@ #include "llvm/Function.h" using namespace llvm; -DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) { +PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) { bool isPPC64 = TM.getSubtargetImpl()->isPPC64(); - - CommentString = ";"; - GlobalPrefix = "_"; - PrivateGlobalPrefix = "L"; + ZeroDirective = "\t.space\t"; SetDirective = "\t.set"; Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0; AlignmentIsInBytes = false; - ConstantPoolSection = "\t.const\t"; - JumpTableDataSection = ".const"; - CStringSection = "\t.cstring"; LCOMMDirective = "\t.lcomm\t"; - StaticCtorsSection = ".mod_init_func"; - StaticDtorsSection = ".mod_term_func"; - UsedDirective = "\t.no_dead_strip\t"; - WeakRefDirective = "\t.weak_reference\t"; InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; @@ -52,3 +42,32 @@ DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug"; } +DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) +: PPCTargetAsmInfo(TM) +{ + CommentString = ";"; + GlobalPrefix = "_"; + PrivateGlobalPrefix = "L"; + ConstantPoolSection = "\t.const\t"; + JumpTableDataSection = ".const"; + CStringSection = "\t.cstring"; + StaticCtorsSection = ".mod_init_func"; + StaticDtorsSection = ".mod_term_func"; + UsedDirective = "\t.no_dead_strip\t"; + WeakRefDirective = "\t.weak_reference\t"; +} + +LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) +: PPCTargetAsmInfo(TM) +{ + CommentString = "#"; + GlobalPrefix = ""; + PrivateGlobalPrefix = ""; + ConstantPoolSection = "\t.section .rodata.cst4\t"; + JumpTableDataSection = ".section .rodata.cst4"; + CStringSection = "\t.section\t.rodata"; + StaticCtorsSection = ".section\t.ctors,\"aw\", at progbits"; + StaticDtorsSection = ".section\t.dtors,\"aw\", at progbits"; + UsedDirective = "\t# .no_dead_strip\t"; + WeakRefDirective = "\t.weak\t"; +} Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h:1.3 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h:1.4 --- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h:1.3 Wed Oct 4 21:42:20 2006 +++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h Thu Dec 21 14:26:09 2006 @@ -20,11 +20,19 @@ // Forward declaration. class PPCTargetMachine; + + struct PPCTargetAsmInfo : public TargetAsmInfo { + PPCTargetAsmInfo(const PPCTargetMachine &TM); + }; - struct DarwinTargetAsmInfo : public TargetAsmInfo { + struct DarwinTargetAsmInfo : public PPCTargetAsmInfo { DarwinTargetAsmInfo(const PPCTargetMachine &TM); }; + struct LinuxTargetAsmInfo : public PPCTargetAsmInfo { + LinuxTargetAsmInfo(const PPCTargetMachine &TM); + }; + } // namespace llvm #endif Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.110 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.111 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.110 Mon Dec 11 17:22:45 2006 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Thu Dec 21 14:26:09 2006 @@ -28,7 +28,10 @@ } const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const { - return new DarwinTargetAsmInfo(*this); + if (Subtarget.isDarwin()) + return new DarwinTargetAsmInfo(*this); + else + return new LinuxTargetAsmInfo(*this); } unsigned PPC32TargetMachine::getJITMatchQuality() { @@ -90,7 +93,7 @@ if (Subtarget.isDarwin()) setRelocationModel(Reloc::DynamicNoPIC); else - setRelocationModel(Reloc::PIC_); + setRelocationModel(Reloc::Static); } PPC32TargetMachine::PPC32TargetMachine(const Module &M, const std::string &FS) From jlaskey at apple.com Thu Dec 21 14:32:50 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Dec 2006 16:32:50 -0400 Subject: [llvm-commits] ppc linux patch 3.1 In-Reply-To: <4589E16C.3000608@mxc.ca> References: <4589DFEB.40500@mxc.ca> <4589E16C.3000608@mxc.ca> Message-ID: <35B060E5-A8FC-45DB-95E6-BE0989D3F5FE@apple.com> Nick, Changes are in. A couple of things you can focus on future changes. If you find yourself duplicating sections of code, factor out the common bits and move them up into the common PPC class - it's not forbidden to do so. :) Second, now that you have a proper subclass, you should be able to remove cases of !IsDarwin. Cheers, -- Jim On 20-Dec-06, at 09:20 PM, Nick Lewycky wrote: > The original patch had a merge error and wouldn't compile. This one > has > been fixed. As well, a large #if 0 has been replaced with a simple > "TODO" comment. > > Nick > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/4a23bd73/attachment.bin From jlaskey at apple.com Thu Dec 21 15:23:46 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Dec 2006 17:23:46 -0400 Subject: [llvm-commits] [llvm-commit][llvm-gcc]Remove uses of is signed from llvm-gcc4. Message-ID: <156BC2A0-5286-44FB-A288-355DCEC8FD1C@apple.com> A non-text attachment was scrubbed... Name: checkin.patch Type: application/octet-stream Size: 77828 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/a6df0286/attachment.obj -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/a6df0286/attachment.bin From jlaskey at apple.com Thu Dec 21 15:24:50 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Dec 2006 15:24:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h Message-ID: <200612212124.kBLLOoG1014745@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.17 -> 1.18 --- Log message: Grandchildren are covered by protect. --- Diffs of the changes: (+2 -3) TargetAsmInfo.h | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.17 llvm/include/llvm/Target/TargetAsmInfo.h:1.18 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.17 Thu Dec 21 14:26:09 2006 +++ llvm/include/llvm/Target/TargetAsmInfo.h Thu Dec 21 15:24:35 2006 @@ -26,11 +26,10 @@ /// TargetAsmInfo - This class is intended to be used as a base class for asm /// properties and features specific to the target. class TargetAsmInfo { - public: + protected: //===------------------------------------------------------------------===// // Properties to be set by the target writer, used to configure asm printer. - // Should not be accessed by anything but a subclass of TargetAsmInfo. Use - // accessor functions. + // /// TextSection - Section directive for standard text. /// From clattner at apple.com Thu Dec 21 16:15:04 2006 From: clattner at apple.com (Chris Lattner) Date: Thu, 21 Dec 2006 14:15:04 -0800 Subject: [llvm-commits] [llvm-gcc] Cast Fix In-Reply-To: <1166685206.4206.68.camel@bashful.x10sys.com> References: <1166469922.2850.7.camel@bashful.x10sys.com> <1166485064.2850.39.camel@bashful.x10sys.com> <119AB276-889D-4BBE-89B6-820FE6C2C165@apple.com> <1166685206.4206.68.camel@bashful.x10sys.com> Message-ID: > You asked for a case where I need to (recursively) determine the > sign of > a some Value. I have a case in mind: > lib/Transforms/Utils/LowerSwitch.cpp. When it decides to lower > this to > a branch tree it is recursively calling switchConvert and passing the > switch value in. The signedness is needed in order to generate the > ICmpInst with either SLT or ULT for the branch tree. But that Value* > being tested originates from operand 0 of the switch instruction. > There's no way to determine if its signed or unsigned without starting > to look at it. As I noted in my example below, it could take several > steps of tracking through instructions before I come up with a > definitive answer. And there may be no way to determine it > statically if > that search ends up at an argument, global variable, or constant. > > Can we just make switch staetments always use SLT for the > comparison and > have the issue go away? Switch lowering can use either slt or ult, as long as it is consistent. Please use ULT. -Chris From reid at x10sys.com Thu Dec 21 16:20:42 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 16:20:42 -0600 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/2003-05-31-LongShifts.c Message-ID: <200612212220.kBLMKg6q015613@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests: 2003-05-31-LongShifts.c updated: 1.2 -> 1.3 --- Log message: Update to new mnemonics for shift operators. --- Diffs of the changes: (+1 -1) 2003-05-31-LongShifts.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/SingleSource/UnitTests/2003-05-31-LongShifts.c diff -u llvm-test/SingleSource/UnitTests/2003-05-31-LongShifts.c:1.2 llvm-test/SingleSource/UnitTests/2003-05-31-LongShifts.c:1.3 --- llvm-test/SingleSource/UnitTests/2003-05-31-LongShifts.c:1.2 Wed Aug 31 14:07:59 2005 +++ llvm-test/SingleSource/UnitTests/2003-05-31-LongShifts.c Thu Dec 21 16:20:26 2006 @@ -1,7 +1,7 @@ void Test(long long Val, int Amt) { printf("0x%llx op %d:\n", Val, Amt); - printf(" sar: 0x%llx\n shr: 0x%llx\n shl: 0x%llx\n", Val >> Amt, + printf(" ashr: 0x%llx\n lshr: 0x%llx\n shl: 0x%llx\n", Val >> Amt, (unsigned long long)Val >> Amt, Val << Amt); } From evan.cheng at apple.com Thu Dec 21 16:28:30 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 21 Dec 2006 14:28:30 -0800 Subject: [llvm-commits] CVS: llvm-test/Makefile.rules In-Reply-To: <200612210657.kBL6vpkN024603@zion.cs.uiuc.edu> References: <200612210657.kBL6vpkN024603@zion.cs.uiuc.edu> Message-ID: Hi Reid, I am not sure what this does. But this completely broken tests on my Mac. For example, if I just do make under MultiSource/Benchmarks/ Olden/bh. I get make: *** No rule to make target `Output/args.rbc', needed by `Output/ bh.linked.rbc'. Stop. I get this even with fresh tot check out. Any ideas? Evan On Dec 20, 2006, at 10:57 PM, Reid Spencer wrote: > > > Changes in directory llvm-test: > > Makefile.rules updated: 1.20 -> 1.21 > --- > Log message: > > Restore definitions of LCC1 and LCC1PLUS to cause test programs to be > dependent upon the llvm-gcc compiler components they use. > > > --- > Diffs of the changes: (+3 -0) > > Makefile.rules | 3 +++ > 1 files changed, 3 insertions(+) > > > Index: llvm-test/Makefile.rules > diff -u llvm-test/Makefile.rules:1.20 llvm-test/Makefile.rules:1.21 > --- llvm-test/Makefile.rules:1.20 Fri Dec 8 11:11:37 2006 > +++ llvm-test/Makefile.rules Thu Dec 21 00:57:35 2006 > @@ -774,6 +774,9 @@ > > endif > > +LCC1 := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1 > +LCC1XX := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1plus > +LCOLLECT2 :=$(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/collect2 > > > #--------------------------------------------------------- > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From reid at x10sys.com Thu Dec 21 16:56:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 16:56:00 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200612212256.kBLMu0tW016204@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.256 -> 1.257 --- Log message: Add a new variable, LLVMGCCLIBEXEC to get the libexec directory where the cc1 and cc1plus executables live. --- Diffs of the changes: (+2 -0) configure.ac | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.256 llvm/autoconf/configure.ac:1.257 --- llvm/autoconf/configure.ac:1.256 Sat Dec 16 16:07:52 2006 +++ llvm/autoconf/configure.ac Thu Dec 21 16:55:41 2006 @@ -743,6 +743,8 @@ AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath) llvmgccdir=`echo "$llvmcc1path" | sed 's,/libexec/.*,,'` AC_SUBST(LLVMGCCDIR,$llvmgccdir) + llvmgcclibexec=`echo "$llvmcc1path" | sed 's,/cc1,,'` + AC_SUBST(LLVMGCCLIBEXEC,$llvmgcclibexec) llvmgccversion=[`"$LLVMGCC" -dumpversion 2>&1 | sed 's/^\([0-9.]*\).*/\1/'`] llvmgccmajvers=[`echo $llvmgccversion | sed 's/^\([0-9]\).*/\1/'`] AC_SUBST(LLVMGCC_VERSION,$llvmgccversion) From reid at x10sys.com Thu Dec 21 16:56:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 16:56:00 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.config.in configure Message-ID: <200612212256.kBLMu0Tl016211@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.config.in updated: 1.72 -> 1.73 configure updated: 1.261 -> 1.262 --- Log message: Add a new variable, LLVMGCCLIBEXEC to get the libexec directory where the cc1 and cc1plus executables live. --- Diffs of the changes: (+33 -25) Makefile.config.in | 3 ++ configure | 55 ++++++++++++++++++++++++++++------------------------- 2 files changed, 33 insertions(+), 25 deletions(-) Index: llvm/Makefile.config.in diff -u llvm/Makefile.config.in:1.72 llvm/Makefile.config.in:1.73 --- llvm/Makefile.config.in:1.72 Sat Dec 16 16:07:52 2006 +++ llvm/Makefile.config.in Thu Dec 21 16:55:41 2006 @@ -182,6 +182,9 @@ LLVMGCCARCH := @target@/@LLVMGCC_VERSION@ endif +# Determine the path where the library executables are +LLVMGCCLIBEXEC := @LLVMGCCLIBEXEC@ + # Full pathnames of LLVM C/C++ front-end 'cc1' and 'cc1plus' binaries: LLVMGCC := @LLVMGCC@ LLVMGXX := @LLVMGXX@ Index: llvm/configure diff -u llvm/configure:1.261 llvm/configure:1.262 --- llvm/configure:1.261 Sat Dec 16 16:07:52 2006 +++ llvm/configure Thu Dec 21 16:55:41 2006 @@ -904,6 +904,7 @@ LLVMCC1 LLVMCC1PLUS LLVMGCCDIR +LLVMGCCLIBEXEC LLVMGCC_VERSION LLVMGCC_MAJVERS SHLIBEXT @@ -10326,7 +10327,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 12474 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14188,11 +14189,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14191: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14192: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14195: \$? = $ac_status" >&5 + echo "$as_me:14196: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14456,11 +14457,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14459: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14460: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14463: \$? = $ac_status" >&5 + echo "$as_me:14464: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14560,11 +14561,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14563: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14564: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14567: \$? = $ac_status" >&5 + echo "$as_me:14568: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17012,7 +17013,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19484: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19487: \$? = $ac_status" >&5 + echo "$as_me:19488: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19584,11 +19585,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19587: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19588: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19591: \$? = $ac_status" >&5 + echo "$as_me:19592: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21154,11 +21155,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21157: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21158: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21161: \$? = $ac_status" >&5 + echo "$as_me:21162: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -21258,11 +21259,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21261: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21262: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21265: \$? = $ac_status" >&5 + echo "$as_me:21266: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23493,11 +23494,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23496: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23497: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23500: \$? = $ac_status" >&5 + echo "$as_me:23501: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -23761,11 +23762,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23764: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23765: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23768: \$? = $ac_status" >&5 + echo "$as_me:23769: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -23865,11 +23866,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23868: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23869: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:23872: \$? = $ac_status" >&5 + echo "$as_me:23873: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -33325,6 +33326,9 @@ llvmgccdir=`echo "$llvmcc1path" | sed 's,/libexec/.*,,'` LLVMGCCDIR=$llvmgccdir + llvmgcclibexec=`echo "$llvmcc1path" | sed 's,/cc1,,'` + LLVMGCCLIBEXEC=$llvmgcclibexec + llvmgccversion=`"$LLVMGCC" -dumpversion 2>&1 | sed 's/^\([0-9.]*\).*/\1/'` llvmgccmajvers=`echo $llvmgccversion | sed 's/^\([0-9]\).*/\1/'` LLVMGCC_VERSION=$llvmgccversion @@ -34307,6 +34311,7 @@ LLVMCC1!$LLVMCC1$ac_delim LLVMCC1PLUS!$LLVMCC1PLUS$ac_delim LLVMGCCDIR!$LLVMGCCDIR$ac_delim +LLVMGCCLIBEXEC!$LLVMGCCLIBEXEC$ac_delim LLVMGCC_VERSION!$LLVMGCC_VERSION$ac_delim LLVMGCC_MAJVERS!$LLVMGCC_MAJVERS$ac_delim SHLIBEXT!$SHLIBEXT$ac_delim @@ -34324,7 +34329,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 67; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 From reid at x10sys.com Thu Dec 21 16:57:25 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 16:57:25 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.rules Message-ID: <200612212257.kBLMvPC3016243@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.rules updated: 1.21 -> 1.22 --- Log message: Use the LLVMGCCLIBEXEC variable to get the paths for cc1 and cc1plus instead of trying to hack it together from other variables. --- Diffs of the changes: (+3 -3) Makefile.rules | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-test/Makefile.rules diff -u llvm-test/Makefile.rules:1.21 llvm-test/Makefile.rules:1.22 --- llvm-test/Makefile.rules:1.21 Thu Dec 21 00:57:35 2006 +++ llvm-test/Makefile.rules Thu Dec 21 16:57:10 2006 @@ -774,9 +774,9 @@ endif -LCC1 := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1 -LCC1XX := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1plus -LCOLLECT2 :=$(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/collect2 +LCC1 := $(LLVMGCCLIBEXEC)/cc1 +LCC1XX := $(LLVMGCCLIBEXEC)/cc1plus +LCOLLECT2 :=$(LLVMGCCLIBEXEC)/collect2 #--------------------------------------------------------- From sabre at nondot.org Thu Dec 21 17:00:14 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Dec 2006 17:00:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMAsmPrinter.cpp Message-ID: <200612212300.kBLN0ENU016344@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMAsmPrinter.cpp updated: 1.41 -> 1.42 --- Log message: Fix for ARM weak symbols, patch by Lauro Ramos Venancio! --- Diffs of the changes: (+14 -0) ARMAsmPrinter.cpp | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.41 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.42 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.41 Tue Dec 19 16:59:25 2006 +++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp Thu Dec 21 16:59:58 2006 @@ -111,6 +111,20 @@ // Print out constants referenced by the function EmitConstantPool(MF.getConstantPool()); + const std::vector + &CP = MF.getConstantPool()->getConstants(); + for (unsigned i = 0, e = CP.size(); i != e; ++i) { + MachineConstantPoolEntry CPE = CP[i]; + if (!CPE.isMachineConstantPoolEntry()){ + Constant *CV = CPE.Val.ConstVal; + if (const GlobalValue *GV = dyn_cast(CV)) { + if (GV->hasExternalWeakLinkage()) { + ExtWeakSymbols.insert(GV); + } + } + } + } + // Print out jump tables referenced by the function EmitJumpTableInfo(MF.getJumpTableInfo(), MF); From jlaskey at apple.com Thu Dec 21 17:20:26 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 21 Dec 2006 19:20:26 -0400 Subject: [llvm-commits] [llvm-gcc4]Types were not being qualified properly (const and volatile) Message-ID: <2B2DEBA6-B868-4554-BF49-3333EEC7E20F@apple.com> Index: gcc/llvm-debug.cpp =================================================================== --- gcc/llvm-debug.cpp (revision 121615) +++ gcc/llvm-debug.cpp (working copy) @@ -451,11 +451,13 @@ /// getOrCreateType - Get the type from the cache or create a new type if /// necessary. /// FIXME - I hate jumbo methods - split up. -TypeDesc *DebugInfo::getOrCreateType(tree_node *type, CompileUnitDesc *Unit) { - DEBUGASSERT(type != NULL_TREE && type != error_mark_node && "Not a type."); - if (type == NULL_TREE || type == error_mark_node) return NULL; +TypeDesc *DebugInfo::getOrCreateType(tree_node *origtype, CompileUnitDesc *Unit) +{ + DEBUGASSERT(origtype != NULL_TREE && origtype != error_mark_node && + "Not a type."); + if (origtype == NULL_TREE || origtype == error_mark_node) return NULL; - type = TYPE_MAIN_VARIANT(type); + tree type = TYPE_MAIN_VARIANT(origtype); // Should only be void if a pointer/reference/return type. Returning NULL // allows the caller to produce a non-derived type. @@ -513,7 +515,7 @@ Ty = DerivedTy; // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, DerivedTy); + Slot = AddTypeQualifiers(origtype, Unit, DerivedTy); // Handle the derived type. TypeDesc *FromTy = getOrCreateType(TREE_TYPE(type), Unit); DerivedTy->setFromType(FromTy); @@ -535,7 +537,7 @@ Ty = SubrTy; // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, SubrTy); + Slot = AddTypeQualifiers(origtype, Unit, SubrTy); // Prepare to add the arguments for the subroutine. std::vector &Elements = SubrTy->getElements(); @@ -570,14 +572,14 @@ Ty = ArrayTy = new CompositeTypeDesc(DW_TAG_vector_type); // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, ArrayTy); + Slot = AddTypeQualifiers(origtype, Unit, ArrayTy); // Use the element type of the from this point. type = TREE_TYPE(TYPE_FIELDS(TYPE_DEBUG_REPRESENTATION_TYPE (type))); } else { Ty = ArrayTy = new CompositeTypeDesc(DW_TAG_array_type); // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, ArrayTy); + Slot = AddTypeQualifiers(origtype, Unit, ArrayTy); } // Prepare to add the dimensions of the array. @@ -614,7 +616,7 @@ CompositeTypeDesc *Enum = new CompositeTypeDesc (DW_TAG_enumeration_type); Ty = Enum; // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, Enum); + Slot = AddTypeQualifiers(origtype, Unit, Enum); // Prepare to add the enumeration values. std::vector &Elements = Enum->getElements(); @@ -645,7 +647,7 @@ Ty = StructTy; // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, StructTy); + Slot = AddTypeQualifiers(origtype, Unit, StructTy); // Prepare to add the fields. std::vector &Elements = StructTy->getElements (); @@ -770,7 +772,7 @@ BasicTypeDesc *BTy = new BasicTypeDesc(); Ty = BTy; // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, BTy); + Slot = AddTypeQualifiers(origtype, Unit, BTy); // The encoding specific to the type. unsigned Encoding = 0; Index: gcc/llvm-debug.h =================================================================== --- gcc/llvm-debug.h (revision 121615) +++ gcc/llvm-debug.h (working copy) @@ -121,7 +121,7 @@ /// getOrCreateType - Get the type from the cache or create a new type if /// necessary. - TypeDesc *getOrCreateType(tree_node *type, CompileUnitDesc *Unit); + TypeDesc *getOrCreateType(tree_node *origtype, CompileUnitDesc *Unit); /// getOrCreateCompileUnit - Get the compile unit from the cache or create a /// new one if necessary. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061221/9aa3f4b1/attachment.bin From sabre at nondot.org Thu Dec 21 19:03:38 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 21 Dec 2006 19:03:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200612220103.kBM13cHM018268@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.147 -> 1.148 --- Log message: add a note --- Diffs of the changes: (+9 -0) README.txt | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.147 llvm/lib/Target/X86/README.txt:1.148 --- llvm/lib/Target/X86/README.txt:1.147 Sun Dec 10 19:20:25 2006 +++ llvm/lib/Target/X86/README.txt Thu Dec 21 19:03:22 2006 @@ -751,3 +751,12 @@ //===---------------------------------------------------------------------===// In c99 mode, the preprocessor doesn't like assembly comments like #TRUNCATE. + +//===---------------------------------------------------------------------===// + +This could be a single 16-bit load. +int f(char *p) { + if (p[0] == 1 && p[1] == 2) return 1; + return 0; +} + From reid at x10sys.com Thu Dec 21 20:03:01 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 21 Dec 2006 20:03:01 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-config/.cvsignore Message-ID: <200612220203.kBM231sH019151@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-config: .cvsignore updated: 1.2 -> 1.3 --- Log message: Ignore the LibDeps.txt.tmp file. --- Diffs of the changes: (+1 -0) .cvsignore | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-config/.cvsignore diff -u llvm/tools/llvm-config/.cvsignore:1.2 llvm/tools/llvm-config/.cvsignore:1.3 --- llvm/tools/llvm-config/.cvsignore:1.2 Thu Jun 1 19:23:15 2006 +++ llvm/tools/llvm-config/.cvsignore Thu Dec 21 20:02:45 2006 @@ -1,6 +1,7 @@ FinalLibDeps.txt GenLibDeps.out LibDeps.txt +LibDeps.txt.tmp libdeps.gif llvm-config.in objdeps.gif From evan.cheng at apple.com Thu Dec 21 20:04:20 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 21 Dec 2006 20:04:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp Message-ID: <200612220204.kBM24KdN019194@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.106 -> 1.107 --- Log message: Debug dump error. --- Diffs of the changes: (+1 -1) MachineFunction.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.106 llvm/lib/CodeGen/MachineFunction.cpp:1.107 --- llvm/lib/CodeGen/MachineFunction.cpp:1.106 Thu Dec 14 13:17:33 2006 +++ llvm/lib/CodeGen/MachineFunction.cpp Thu Dec 21 20:04:05 2006 @@ -466,7 +466,7 @@ Constants[i].Val.MachineCPVal->print(OS); else OS << *(Value*)Constants[i].Val.ConstVal; - OS << " , offset=" << Constants[i].Offset; + OS << " , offset=" << Constants[i].getOffset(); OS << "\n"; } } From jlaskey at apple.com Fri Dec 22 14:03:57 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 22 Dec 2006 14:03:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200612222003.kBMK3vlT012286@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.108 -> 1.109 --- Log message: Need to walk the derived chain of typedefs to get actual size. --- Diffs of the changes: (+13 -4) DwarfWriter.cpp | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.108 llvm/lib/CodeGen/DwarfWriter.cpp:1.109 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.108 Sat Dec 16 23:15:12 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Fri Dec 22 14:03:42 2006 @@ -1539,10 +1539,19 @@ uint64_t FieldAlign = Align; uint64_t FieldOffset = Offset; - if (TypeDesc *FromTy = MemberDesc->getFromType()) { - AddType(Member, FromTy, Unit); - FieldSize = FromTy->getSize(); - FieldAlign = FromTy->getSize(); + // Set the member type. + TypeDesc *FromTy = MemberDesc->getFromType(); + AddType(Member, FromTy, Unit); + + // Walk up typedefs until a real size is found. + while (FromTy) { + if (FromTy->getTag() != DW_TAG_typedef) { + FieldSize = FromTy->getSize(); + FieldAlign = FromTy->getSize(); + break; + } + + FromTy = dyn_cast(FromTy)->getFromType(); } // Unless we have a bit field. From jlaskey at apple.com Fri Dec 22 14:08:04 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 22 Dec 2006 16:08:04 -0400 Subject: [llvm-commits] [llvm-commit][llvm-gcc4]There's never a good reason to use TYPE_MAIN_VARIANT. Message-ID: Index: gcc/llvm-debug.cpp =================================================================== --- gcc/llvm-debug.cpp (revision 121659) +++ gcc/llvm-debug.cpp (working copy) @@ -451,14 +451,11 @@ /// getOrCreateType - Get the type from the cache or create a new type if /// necessary. /// FIXME - I hate jumbo methods - split up. -TypeDesc *DebugInfo::getOrCreateType(tree_node *origtype, CompileUnitDesc *Unit) -{ - DEBUGASSERT(origtype != NULL_TREE && origtype != error_mark_node && +TypeDesc *DebugInfo::getOrCreateType(tree_node *type, CompileUnitDesc *Unit) { + DEBUGASSERT(type != NULL_TREE && type != error_mark_node && "Not a type."); - if (origtype == NULL_TREE || origtype == error_mark_node) return NULL; + if (type == NULL_TREE || type == error_mark_node) return NULL; - tree type = TYPE_MAIN_VARIANT(origtype); - // Should only be void if a pointer/reference/return type. Returning NULL // allows the caller to produce a non-derived type. if (TREE_CODE(type) == VOID_TYPE) return NULL; @@ -515,7 +512,7 @@ Ty = DerivedTy; // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(origtype, Unit, DerivedTy); + Slot = AddTypeQualifiers(type, Unit, DerivedTy); // Handle the derived type. TypeDesc *FromTy = getOrCreateType(TREE_TYPE(type), Unit); DerivedTy->setFromType(FromTy); @@ -537,7 +534,7 @@ Ty = SubrTy; // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(origtype, Unit, SubrTy); + Slot = AddTypeQualifiers(type, Unit, SubrTy); // Prepare to add the arguments for the subroutine. std::vector &Elements = SubrTy->getElements(); @@ -572,14 +569,14 @@ Ty = ArrayTy = new CompositeTypeDesc(DW_TAG_vector_type); // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(origtype, Unit, ArrayTy); + Slot = AddTypeQualifiers(type, Unit, ArrayTy); // Use the element type of the from this point. type = TREE_TYPE(TYPE_FIELDS(TYPE_DEBUG_REPRESENTATION_TYPE (type))); } else { Ty = ArrayTy = new CompositeTypeDesc(DW_TAG_array_type); // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(origtype, Unit, ArrayTy); + Slot = AddTypeQualifiers(type, Unit, ArrayTy); } // Prepare to add the dimensions of the array. @@ -616,7 +613,7 @@ CompositeTypeDesc *Enum = new CompositeTypeDesc (DW_TAG_enumeration_type); Ty = Enum; // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(origtype, Unit, Enum); + Slot = AddTypeQualifiers(type, Unit, Enum); // Prepare to add the enumeration values. std::vector &Elements = Enum->getElements(); @@ -647,7 +644,7 @@ Ty = StructTy; // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(origtype, Unit, StructTy); + Slot = AddTypeQualifiers(type, Unit, StructTy); // Prepare to add the fields. std::vector &Elements = StructTy->getElements (); @@ -772,7 +769,7 @@ BasicTypeDesc *BTy = new BasicTypeDesc(); Ty = BTy; // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(origtype, Unit, BTy); + Slot = AddTypeQualifiers(type, Unit, BTy); // The encoding specific to the type. unsigned Encoding = 0; Index: gcc/llvm-debug.h =================================================================== --- gcc/llvm-debug.h (revision 121659) +++ gcc/llvm-debug.h (working copy) @@ -121,7 +121,7 @@ /// getOrCreateType - Get the type from the cache or create a new type if /// necessary. - TypeDesc *getOrCreateType(tree_node *origtype, CompileUnitDesc *Unit); + TypeDesc *getOrCreateType(tree_node *type, CompileUnitDesc *Unit); /// getOrCreateCompileUnit - Get the compile unit from the cache or create a /// new one if necessary. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061222/96de4b9d/attachment.bin From clattner at apple.com Fri Dec 22 14:08:31 2006 From: clattner at apple.com (Chris Lattner) Date: Fri, 22 Dec 2006 12:08:31 -0800 Subject: [llvm-commits] SETCC InstructionCombining.cpp [#2/3] In-Reply-To: <1166398509.2826.12.camel@bashful.x10sys.com> References: <1166398509.2826.12.camel@bashful.x10sys.com> Message-ID: <0E37677C-8E3C-4E5F-B7FA-C6496A05CFA8@apple.com> On Dec 17, 2006, at 3:35 PM, Reid Spencer wrote: > Chris, > > Attached is the patch to InstructionCombining.cpp for SETCC conversion > to ICmpInst. This passes all tests. > > All your previous feedback has been incorporated and confirmed. The > test > just completed includes all those changes as well. > > I'm looking forward to finally committing the SETCC patch so we can > finish it off and then start removing unnecessary casts and > unifying the > integer types. Onward. There are some serious bugs here that need to be addressed. Overall the patch is looking good though, I'll get you 3/3 in the next few hours. -Chris @@ -2177,18 +2225,18 @@ Instruction *InstCombiner::visitMul(Bina if (isa(SCIOp1) && - isSignBitCheck(SCI->getOpcode(), SCIOp0, cast (SCIOp1))) { + isSignBitCheck(SCI->getPredicate(), SCIOp0, cast(SCIOp1))) { // Shift the X value right to turn it into "all signbits". Beware 80 columns. +/// S<=> Definition S<=> Definition +/// 0000 Always false 1000 Alwasy false typo alwasy +/// Four bits are used to represent the condition, as follows: +/// 0 A > B +/// 1 A == B +/// 2 A < B +/// 3 A and B are signed +/// +/// S<=> Definition S<=> Definition +/// 0000 Always false 1000 Alwasy false +/// 0001 A u> B 1001 A s> B +/// 0010 A == B 1010 A == B +/// 0011 A u>= B 1011 A s>= B +/// 0100 A u< B 1100 A s< B +/// 0101 A != B 1101 A != B +/// 0110 A u<= B 1110 A s<= B +/// 0111 Always true 1111 Always true +/// +static unsigned getICmpCode(const ICmpInst *ICI) { This table (and it's use) is not correct. It will miscompile: (a , u<, u>. In this case, you'd detect that the merged comparison can't be done with a single compare, so you give up. +/// getICmpValue - This is the complement of getICmpCode, which turns an /// opcode and two operands into either a constant true or false, or a brand new +/// ICmp instruction. +static Value *getICmpValue(unsigned Opcode, Value *LHS, Value *RHS) { switch (Opcode) { + case 0: + case 8: return ConstantBool::getFalse(); + case 1: return new ICmpInst(ICmpInst::ICMP_UGT, LHS, RHS); + case 9: return new ICmpInst(ICmpInst::ICMP_SGT, LHS, RHS); + case 10: + case 2: return new ICmpInst(ICmpInst::ICMP_EQ, LHS, RHS); + case 3: return new ICmpInst(ICmpInst::ICMP_UGE, LHS, RHS); + case 11: return new ICmpInst(ICmpInst::ICMP_SGE, LHS, RHS); + case 4: return new ICmpInst(ICmpInst::ICMP_ULT, LHS, RHS); + case 12: return new ICmpInst(ICmpInst::ICMP_SLT, LHS, RHS); + case 13: + case 5: return new ICmpInst(ICmpInst::ICMP_NE, LHS, RHS); + case 6: return new ICmpInst(ICmpInst::ICMP_ULE, LHS, RHS); + case 14: return new ICmpInst(ICmpInst::ICMP_SLE, LHS, RHS); + case 7: + case 15: return ConstantBool::getTrue(); + default: assert(0 && "Illegal ICmp code!"); return 0; Please move the default case to the top and drop the 'return 0'. That way in release-assert builds, the default case will fall into the first case, which will produce slightly more efficient code. Instruction *InstCombiner::InsertRangeTest(Value *V, Constant *Lo, Constant *Hi, + bool isSigned, bool Inside, + Instruction &IB) { Your changes to the callers of InsertRangeTest are not correct. You will fold things like: 'x >= -14 (ConstantExpr::getICmp(pred, Lo, Hi))- >getValue() && "Lo is not <= Hi in range emission code!"); Please sink 'pred' into the assert. I don't care how you write it, but I don't want 'pred' to be a long-lived variable like this. This makes it clear that the value of pred isn't retained, which makes the code easier to read. + pred = (isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT); + // V >= Min && V < Hi --> V < Hi + if (cast(Lo)->isMinValue(isSigned)) + return new ICmpInst(pred, V, Hi); Likewise, this should be something like: + // V >= Min && V < Hi --> V < Hi + if (cast(Lo)->isMinValue(isSigned)) { + Predicate pred = (isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT); + return new ICmpInst(pred, V, Hi); } Likewise with the third definition of 'pred'. @@ -3022,11 +3094,11 @@ Instruction *InstCombiner::visitAnd(Bina uint64_t AndRHSMask = AndRHS->getZExtValue(); uint64_t TypeMask = Op0->getType()->getIntegralTypeMask(); uint64_t NotAndRHS = AndRHSMask^TypeMask; // Optimize a variety of ((val OP C1) & C2) combinations... - if (isa(Op0) || isa(Op0)) { + if (isa(Op0) || isa(Op0) || isa(Op0)) { The switch inside this 'if' doesn't handle compares, drop the extra isa. @@ -4129,88 +4240,235 @@ Instruction *InstCombiner::visitSetCondI ... + // Test to see if the operands of the setcc are casted versions of other + // values. If the cast can be stripped off both arguments, we do so now. + if (CastInst *CI = dyn_cast(Op0)) { + Value *CastOp0 = CI->getOperand(0); + if (CI->isLosslessCast() && I.isEquality() && + (isa(Op1) || isa(Op1))) { This transformation doesn't apply to FP icmp, because there are no lossless FP casts. + if (I.isEquality()) { + Value *A, *B; + if (match(Op0, m_Sub(m_Value(A), m_Value(B))) && A == Op1) { + // (A-B) == A -> B == 0 + return BinaryOperator::create(I.getOpcode(), B, + Constant::getNullValue(B->getType ())); + } else if (match(Op1, m_Sub(m_Value(A), m_Value(B))) && A == Op0) { + // A == (A-B) -> B == 0 + return BinaryOperator::create(I.getOpcode(), B, + Constant::getNullValue(B->getType ())); + } + } This xform is unsafe for FP, don't do it. + // icmp's with boolean values can always be turned into bitwise operations if (Ty == Type::BoolTy) { This code is not correct for signed comparisons of bools. Rememember that true true, but true false @@ -4552,15 +4801,12 @@ Instruction *InstCombiner::visitSetCondI // vice versa). This is because (x /s C1) getType(); - unsigned DivOpCode = LHSI->getOpcode(); - if (I.isEquality() && - ((DivOpCode == Instruction::SDiv && DivRHSTy- >isUnsigned()) || - (DivOpCode == Instruction::UDiv && DivRHSTy->isSigned ()))) + bool DivIsSigned = LHSI->getOpcode() == Instruction::SDiv; + if (I.isEquality() && DivIsSigned != DivRHS->getType()- >isSigned()) break; This was wrong before your patch. It should be something like: if (!I.isEquality() && DivIsSigned != isSignedComparison (I.getPredicate())) break; - // Replace (and X, (1 << size(X)-1) != 0) with x < 0, converting X - // to be a signed value as appropriate. + // Replace (and X, (1 << size(X)-1) != 0) with x < 0 Please make the comment read 'x X < 8 if (CI->isNullValue() && isHighOnes(BOC)) { Value *X = BO->getOperand(0); Constant *NegX = ConstantExpr::getNeg(BOC); + // If 'NegX' is signed, insert a cast now. if (NegX->getType()->isSigned()) { const Type *DestTy = NegX->getType()- >getUnsignedVersion(); X = InsertCastBefore(Instruction::BitCast, X, DestTy, I); NegX = ConstantExpr::getBitCast(NegX, DestTy); } This cast can be removed. + // If this is a signed comparison, check for comparisons in the + // vicinity of zero. + switch (I.getPredicate()) { + default: break; + case ICmpInst::ICMP_SLT: // X < 0 => x > 127 + if (CI->isNullValue()) + return new ICmpInst(ICmpInst::ICMP_UGT, CastOp, + ConstantInt::get(SrcTy, (1ULL << (SrcTySize-1))-1)); + break; + case ICmpInst::ICMP_SGT: // X > -1 => x < 128 + if (cast(CI)->getSExtValue() == -1) + return new ICmpInst(ICmpInst::ICMP_ULT, CastOp, + ConstantInt::get(SrcTy, 1ULL << (SrcTySize-1))); + break; + case ICmpInst::ICMP_ULT: { // X < 128 => X > -1 + ConstantInt *CUI = cast(CI); + if (CUI->getZExtValue() == 1ULL << (SrcTySize-1)) + return new ICmpInst(ICmpInst::ICMP_SGT, CastOp, + ConstantInt::get(SrcTy, -1)); + break; + } + case ICmpInst::ICMP_UGT: { // X > 127 => X < 0 + ConstantInt *CUI = cast(CI); + if (CUI->getZExtValue() == (1ULL << (SrcTySize-1))-1) + return new ICmpInst(ICmpInst::ICMP_SLT, CastOp, + Constant::getNullValue(SrcTy)); + break; + } These transformations are no longer needed, please remove: "X < 0 => x > 127" and "X > -1 => x < 128". The two we keep are useful to canonicalize comparisons against constants to use smaller constants. In their place, please add a transformation that changes: icmp pred (bitcast X), cst to: icmp pred X, (bitcast cst) Make sure to check that X is integral, to prevent fp<->int bitcasts. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061222/e3d56192/attachment.html From clattner at apple.com Fri Dec 22 15:31:33 2006 From: clattner at apple.com (Chris Lattner) Date: Fri, 22 Dec 2006 13:31:33 -0800 Subject: [llvm-commits] SETCC InstructionCombining.cpp [3/3] In-Reply-To: <1166398509.2826.12.camel@bashful.x10sys.com> References: <1166398509.2826.12.camel@bashful.x10sys.com> Message-ID: <6CF87779-7C5F-4787-9440-BF83A47C373E@apple.com> On Dec 17, 2006, at 3:35 PM, Reid Spencer wrote: > Chris, > > Attached is the patch to InstructionCombining.cpp for SETCC conversion > to ICmpInst. This passes all tests. > > All your previous feedback has been incorporated and confirmed. The > test > just completed includes all those changes as well. > > I'm looking forward to finally committing the SETCC patch so we can > finish it off and then start removing unnecessary casts and > unifying the > integer types. This was the easiest of the three. woo! -Chris - // Handle the special case of: setcc (cast bool to X), + // Handle the special case of: icmp (cast bool to X), // This comes up when you have code like // int X = A < B; // if (X) ... // For generality, we handle any zero-extension of any operand comparison // with a constant or another cast from the same type. if (isa(Op1) || isa(Op1)) - if (Instruction *R = visitSetCondInstWithCastAndCast(I)) + if (Instruction *R = visitICmpInstWithCastAndCast(I)) return R; } Should this be checking for zext/sext(Op1) instead of castinst(op1) ? +Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { ... - if (CastInst *CI = dyn_cast(SCI.getOperand(1))) { + if (CastInst *CI = dyn_cast(ICI.getOperand(1))) { // Not an extension from the same type? RHSCIOp = CI->getOperand(0); - if (RHSCIOp->getType() != LHSCIOp->getType()) return 0; - } else if (ConstantInt *CI = dyn_cast(SCI.getOperand (1))) { This should presumably only allow zext or sext, not any cast. + if (Res2 == CI) { + // Make sure that sign of the Cmp and the sign of the Cast are the same. + // For example, we might have: + // %A = sext short %X to uint + // %B = icmp ugt uint %A, 1330 + // It is incorrect to transform this into + // %B = icmp ugt short %X, 1330 + // because %A may have negative value. + // + // However, it is OK if SrcTy is bool (See cast-set.ll testcase) + // OR operation is EQ/NE. + if (isSignedExt == isSignedCmp || SrcTy == Type::BoolTy || ICI.isEquality()) + return new ICmpInst(ICI.getPredicate(), LHSCIOp, Res1); + else + return 0; + } Can you explain why srcty == bool is a special case? + // First, handle some easy cases. We no the result cannot be equal at this + // point so handle the ICI.isEquality() cases we no -> we know? + // We're performing a signed comparison. + if (isSignedExt) { + // Signed extend and signed comparison. + if (cast(CI)->getSExtValue() < 0)// X < (small) -- > false + Result = ConstantBool::getFalse(); + else + Result = ConstantBool::getTrue(); // X < (large) -- > true + } else { + // Zero extend and signed comparison. + if (cast(CI)->getSExtValue() < 0) + Result = ConstantBool::getFalse(); + else + Result = ConstantBool::getTrue(); } My reading of this code says that you can eliminate the 'if issignedext' test, as the if/then cases are the same. Is this a bug or just code duplication? @@ -5933,13 +6195,12 @@ Instruction *InstCombiner::commonIntCast return new ShiftInst(Instruction::LShr, Op0, Op1); } } break; - case Instruction::SetEQ: - case Instruction::SetNE: - // If we are just checking for a seteq of a single bit and casting it + case Instruction::ICmp: + // If we are just checking for a icmp_eq of a single bit and casting it // to an integer. If so, shift the bit to the appropriate place then This code needs to accept and correctly ignore the icmp cases that aren't ==/!=. Currently anything not != is treated as == due to: if (isPowerOf2_64(KnownZero^TypeMask)) { // Exactly 1 possible 1? - bool isSetNE = SrcI->getOpcode() == Instruction::SetNE; + bool isNE = + cast(SrcI)->getPredicate() == ICmpInst::ICMP_NE; @@ -6313,10 +6581,17 @@ Instruction *InstCombiner::FoldSelectOpO if (BinaryOperator *BO = dyn_cast(TI)) { if (MatchIsOpZero) return BinaryOperator::create(BO->getOpcode(), MatchOp, NewSI); else return BinaryOperator::create(BO->getOpcode(), NewSI, MatchOp); + } else if (CmpInst *CI = dyn_cast(TI)) { + if (MatchIsOpZero) + return CmpInst::create(CI->getOpcode(), CI->getPredicate(), + MatchOp, NewSI); + else + return CmpInst::create(CI->getOpcode(), CI->getPredicate(), + NewSI, MatchOp); This doesn't seem right to me, you can't just swap operands like this. Is FoldSelectOpOp even called for compares? If not, plz remove this code and the other changes you made. + // (x ashr x, 31 + // (x >u 2147483647) ? -1 : 0 -> ashr x, 31 if (TrueValC->isAllOnesValue() && FalseValC->isNullValue()) if (ConstantInt *CmpCst = dyn_cast(IC- >getOperand(1))) { bool CanXForm = false; - if (CmpCst->getType()->isSigned()) + if (IC->isSignedPredicate()) CanXForm = CmpCst->isNullValue() && - IC->getOpcode() == Instruction::SetLT; + IC->getPredicate() == ICmpInst::ICMP_SLT; else { unsigned Bits = CmpCst->getType()- >getPrimitiveSizeInBits(); CanXForm = (CmpCst->getZExtValue() == ~0ULL >> (64- Bits+1)) && - IC->getOpcode() == Instruction::SetGT; + IC->getPredicate() == ICmpInst::ICMP_UGT; } If other parts of instcombine canonicalize (x >u 2147483647) -> (x u 2147483647) case here. @@ -6550,10 +6847,12 @@ Instruction *InstCombiner::visitSelectIn new SelectInst(SI.getCondition(), TVI->getOperand(2- OpToFold), C, Name); InsertNewInstBefore(NewSel, SI); if (BinaryOperator *BO = dyn_cast(TVI)) return BinaryOperator::create(BO->getOpcode(), FalseVal, NewSel); + else if (ICmpInst *ICI = dyn_cast(TVI)) + return new ICmpInst(ICI->getPredicate(), FalseVal, NewSel); This code is dead, please remove. @@ -6578,10 +6877,12 @@ Instruction *InstCombiner::visitSelectIn new SelectInst(SI.getCondition(), C, FVI->getOperand (2-OpToFold), Name); InsertNewInstBefore(NewSel, SI); if (BinaryOperator *BO = dyn_cast(FVI)) return BinaryOperator::create(BO->getOpcode(), TrueVal, NewSel); + else if (ICmpInst *ICI = dyn_cast(FVI)) + return new ICmpInst(ICI->getPredicate(), TrueVal, NewSel); Likewise. @@ -6985,11 +7286,11 @@ bool InstCombiner::transformConstExprCas const Type *ActTy = (*AI)->getType(); ConstantInt *c = dyn_cast(*AI); //Either we can cast directly, or we can upconvert the argument bool isConvertible = ActTy->canLosslesslyBitCastTo(ParamTy) || (ParamTy->isIntegral() && ActTy->isIntegral() && - ParamTy->isSigned() == ActTy->isSigned() && +// ParamTy->isSigned() == ActTy->isSigned() && ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize()) || (c && ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize () && c->getSExtValue() > 0); if (Callee->isExternal() && !isConvertible) return false; } This is still needed. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061222/c3e1ac5b/attachment.html From asl at math.spbu.ru Fri Dec 22 16:29:20 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 22 Dec 2006 16:29:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86Subtarget.cpp X86Subtarget.h X86TargetMachine.cpp Message-ID: <200612222229.kBMMTKJT014518@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.306 -> 1.307 X86Subtarget.cpp updated: 1.45 -> 1.46 X86Subtarget.h updated: 1.23 -> 1.24 X86TargetMachine.cpp updated: 1.132 -> 1.133 --- Log message: Refactored JIT codegen for mingw32. Now we're using standart relocation type for distinguish JIT & non-JIT instead of "dirty" hacks :) --- Diffs of the changes: (+32 -44) X86ISelLowering.cpp | 46 +++++++++++++++++++++++++--------------------- X86Subtarget.cpp | 15 +++------------ X86Subtarget.h | 10 +++------- X86TargetMachine.cpp | 5 +---- 4 files changed, 32 insertions(+), 44 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.306 llvm/lib/Target/X86/X86ISelLowering.cpp:1.307 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.306 Thu Dec 14 15:55:39 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Dec 22 16:29:05 2006 @@ -664,8 +664,10 @@ // If the callee is a GlobalAddress node (quite common, every direct call is) // turn it into a TargetGlobalAddress node so that legalize doesn't hack it. if (GlobalAddressSDNode *G = dyn_cast(Callee)) { - // We should use extra load for direct calls to dllimported functions - if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(), true)) + // We should use extra load for direct calls to dllimported functions in + // non-JIT mode. + if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(), + getTargetMachine(), true)) Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy()); } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy()); @@ -1201,8 +1203,10 @@ // If the callee is a GlobalAddress node (quite common, every direct call is) // turn it into a TargetGlobalAddress node so that legalize doesn't hack it. if (GlobalAddressSDNode *G = dyn_cast(Callee)) { - // We should use extra load for direct calls to dllimported functions - if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(), true)) + // We should use extra load for direct calls to dllimported functions in + // non-JIT mode. + if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(), + getTargetMachine(), true)) Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy()); } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy()); @@ -1698,8 +1702,10 @@ // If the callee is a GlobalAddress node (quite common, every direct call is) // turn it into a TargetGlobalAddress node so that legalize doesn't hack it. if (GlobalAddressSDNode *G = dyn_cast(Callee)) { - // We should use extra load for direct calls to dllimported functions - if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(), true)) + // We should use extra load for direct calls to dllimported functions in + // non-JIT mode. + if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(), + getTargetMachine(), true)) Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy()); } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy()); @@ -1996,8 +2002,10 @@ // If the callee is a GlobalAddress node (quite common, every direct call is) // turn it into a TargetGlobalAddress node so that legalize doesn't hack it. if (GlobalAddressSDNode *G = dyn_cast(Callee)) { - // We should use extra load for direct calls to dllimported functions - if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(), true)) + // We should use extra load for direct calls to dllimported functions in + // non-JIT mode. + if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(), + getTargetMachine(), true)) Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy()); } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy()); @@ -3868,17 +3876,14 @@ Result = DAG.getNode(ISD::ADD, getPointerTy(), DAG.getNode(X86ISD::GlobalBaseReg, getPointerTy()), Result); - - // For Darwin, external and weak symbols are indirect, so we want to load - // the value at address GV, not the value of GV itself. This means that - // the GlobalAddress must be in the base or index register of the address, - // not the GV offset field. - if (getTargetMachine().getRelocationModel() != Reloc::Static && - Subtarget->GVRequiresExtraLoad(GV, false)) - Result = DAG.getLoad(getPointerTy(), DAG.getEntryNode(), Result, NULL, 0); - } else if (Subtarget->GVRequiresExtraLoad(GV, false)) { - Result = DAG.getLoad(getPointerTy(), DAG.getEntryNode(), Result, NULL, 0); } + + // For Darwin & Mingw32, external and weak symbols are indirect, so we want to + // load the value at address GV, not the value of GV itself. This means that + // the GlobalAddress must be in the base or index register of the address, not + // the GV offset field. Platform check is inside GVRequiresExtraLoad() call + if (Subtarget->GVRequiresExtraLoad(GV, getTargetMachine(), false)) + Result = DAG.getLoad(getPointerTy(), DAG.getEntryNode(), Result, NULL, 0); return Result; } @@ -5010,9 +5015,8 @@ if (Subtarget->is64Bit() && getTargetMachine().getCodeModel() != CodeModel::Small) return false; - Reloc::Model RModel = getTargetMachine().getRelocationModel(); - return (RModel == Reloc::Static) || - !Subtarget->GVRequiresExtraLoad(GV, false); + + return (!Subtarget->GVRequiresExtraLoad(GV, getTargetMachine(), false)); } /// isShuffleMaskLegal - Targets can use this to indicate that they only Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.45 llvm/lib/Target/X86/X86Subtarget.cpp:1.46 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.45 Wed Dec 20 14:40:30 2006 +++ llvm/lib/Target/X86/X86Subtarget.cpp Fri Dec 22 16:29:05 2006 @@ -15,6 +15,7 @@ #include "X86GenSubtarget.inc" #include "llvm/Module.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Target/TargetMachine.h" using namespace llvm; cl::opt @@ -31,9 +32,10 @@ /// value of GV itself. This means that the GlobalAddress must be in the base /// or index register of the address, not the GV offset field. bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, + const TargetMachine& TM, bool isDirectCall) const { - if (GenerateExtraLoadsForGVs) + if (TM.getRelocationModel() != Reloc::Static) if (isTargetDarwin()) { return (!isDirectCall && (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || @@ -208,16 +210,6 @@ } } -/// SetJITMode - This is called to inform the subtarget info that we are -/// producing code for the JIT. -void X86Subtarget::SetJITMode() -{ - // JIT mode doesn't want extra loads for dllimported symbols, it knows exactly - // where everything is. - if (isTargetCygwin()) - GenerateExtraLoadsForGVs = false; -} - X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit) : AsmFlavor(AsmWriterFlavor) , X86SSELevel(NoMMXSSE) @@ -226,7 +218,6 @@ // FIXME: this is a known good value for Yonah. How about others? , MinRepStrSizeThreshold(128) , Is64Bit(is64Bit) - , GenerateExtraLoadsForGVs(true) , TargetType(isELF) { // Default to ELF unless otherwise specified. // Determine default and user specified characteristics Index: llvm/lib/Target/X86/X86Subtarget.h diff -u llvm/lib/Target/X86/X86Subtarget.h:1.23 llvm/lib/Target/X86/X86Subtarget.h:1.24 --- llvm/lib/Target/X86/X86Subtarget.h:1.23 Tue Dec 19 19:03:20 2006 +++ llvm/lib/Target/X86/X86Subtarget.h Fri Dec 22 16:29:05 2006 @@ -21,6 +21,7 @@ namespace llvm { class Module; class GlobalValue; +class TargetMachine; class X86Subtarget : public TargetSubtarget { public: @@ -61,9 +62,6 @@ /// pointer size is 64 bit. bool Is64Bit; - /// GenerateExtraLoadsForGVs - True if we should generate extra loads for - /// indirect symbols (e.g. dllimported symbols on windows). - bool GenerateExtraLoadsForGVs; public: enum { isELF, isCygwin, isDarwin, isWindows @@ -114,11 +112,9 @@ /// symbols are indirect, loading the value at address GV rather then the /// value of GV itself. This means that the GlobalAddress must be in the base /// or index register of the address, not the GV offset field. - bool GVRequiresExtraLoad(const GlobalValue* GV, bool isDirectCall) const; + bool GVRequiresExtraLoad(const GlobalValue* GV, const TargetMachine& TM, + bool isDirectCall) const; - /// SetJITMode - This is called to inform the subtarget info that we are - /// producing code for the JIT. - void SetJITMode(); }; namespace X86 { Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.132 llvm/lib/Target/X86/X86TargetMachine.cpp:1.133 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.132 Tue Dec 19 19:03:20 2006 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Fri Dec 22 16:29:05 2006 @@ -115,7 +115,7 @@ Subtarget.getStackAlignment(), Subtarget.is64Bit() ? -8 : -4), InstrInfo(*this), JITInfo(*this), TLInfo(*this) { if (getRelocationModel() == Reloc::Default) - if (Subtarget.isTargetDarwin()) + if (Subtarget.isTargetDarwin() || Subtarget.isTargetCygwin()) setRelocationModel(Reloc::DynamicNoPIC); else setRelocationModel(Reloc::Static); @@ -167,9 +167,6 @@ if (Subtarget.is64Bit()) setCodeModel(CodeModel::Large); - // Inform the subtarget that we are in JIT mode. - Subtarget.SetJITMode(); - PM.add(createX86CodeEmitterPass(*this, MCE)); return false; } From sabre at nondot.org Fri Dec 22 16:38:53 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 22 Dec 2006 16:38:53 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll Message-ID: <200612222238.kBMMcrA9014858@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: vector-identity-shuffle.ll updated: 1.2 -> 1.3 --- Log message: let this pass for ppc/linux --- Diffs of the changes: (+1 -1) vector-identity-shuffle.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll diff -u llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll:1.2 llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll:1.3 --- llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll Fri Dec 22 16:38:38 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | grep _test && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | grep test: && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | not grep vperm void %test(<4 x float> *%tmp2.i) { From sabre at nondot.org Fri Dec 22 16:48:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 22 Dec 2006 16:48:59 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll Message-ID: <200612222248.kBMMmxQa015054@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: vector-identity-shuffle.ll updated: 1.3 -> 1.4 --- Log message: add a generic component to this test --- Diffs of the changes: (+2 -1) vector-identity-shuffle.ll | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll diff -u llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll:1.3 llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll:1.4 --- llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll:1.3 Fri Dec 22 16:38:38 2006 +++ llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll Fri Dec 22 16:48:44 2006 @@ -1,5 +1,6 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | grep test: && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | not grep vperm +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | not grep vperm && +; RUN: llvm-upgrade < %s | llvm-as | llc void %test(<4 x float> *%tmp2.i) { %tmp2.i = load <4x float>* %tmp2.i From dpatel at apple.com Fri Dec 22 16:49:18 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 22 Dec 2006 16:49:18 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200612222249.kBMMnI7w015074@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.64 -> 1.65 --- Log message: ModulePass and ImmutablePass. Force out of line virtual method. --- Diffs of the changes: (+6 -0) Pass.h | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.64 llvm/include/llvm/Pass.h:1.65 --- llvm/include/llvm/Pass.h:1.64 Wed Dec 20 13:57:07 2006 +++ llvm/include/llvm/Pass.h Fri Dec 22 16:49:00 2006 @@ -205,6 +205,9 @@ #ifdef USE_OLD_PASSMANAGER virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU); +#else + // Force out-of-line virtual method. + virtual ~ModulePass(); #endif }; @@ -233,6 +236,9 @@ template friend class PassManagerT; friend class ModulePassManager; virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU); +#else + // Force out-of-line virtual method. + virtual ~ImmutablePass(); #endif }; From dpatel at apple.com Fri Dec 22 16:49:18 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 22 Dec 2006 16:49:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp Message-ID: <200612222249.kBMMnI34015080@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Pass.cpp updated: 1.80 -> 1.81 --- Log message: ModulePass and ImmutablePass. Force out of line virtual method. --- Diffs of the changes: (+6 -0) Pass.cpp | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.80 llvm/lib/VMCore/Pass.cpp:1.81 --- llvm/lib/VMCore/Pass.cpp:1.80 Wed Dec 13 15:13:31 2006 +++ llvm/lib/VMCore/Pass.cpp Fri Dec 22 16:49:00 2006 @@ -171,6 +171,9 @@ void ModulePass::addToPassManager(ModulePassManager *PM, AnalysisUsage &AU) { PM->addPass(this, AU); } +#else +// Force out-of-line virtual method. +ModulePass::~ModulePass() { } #endif bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const { @@ -215,6 +218,9 @@ AnalysisUsage &AU) { PM->addPass(this, AU); } +#else +// Force out-of-line virtual method. +ImmutablePass::~ImmutablePass() { } #endif //===----------------------------------------------------------------------===// From dpatel at apple.com Fri Dec 22 16:55:45 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 22 Dec 2006 16:55:45 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200612222255.kBMMtjap015187@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.65 -> 1.66 --- Log message: Enable new pass manager. 2nd attempt. --- Diffs of the changes: (+1 -1) Pass.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.65 llvm/include/llvm/Pass.h:1.66 --- llvm/include/llvm/Pass.h:1.65 Fri Dec 22 16:49:00 2006 +++ llvm/include/llvm/Pass.h Fri Dec 22 16:55:30 2006 @@ -36,7 +36,7 @@ #include #include -#define USE_OLD_PASSMANAGER 1 +//#define USE_OLD_PASSMANAGER 1 namespace llvm { From rspencer at reidspencer.com Fri Dec 22 16:57:56 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Fri, 22 Dec 2006 14:57:56 -0800 Subject: [llvm-commits] SETCC InstructionCombining.cpp [#1/n] In-Reply-To: References: <1166398509.2826.12.camel@bashful.x10sys.com> Message-ID: <1166828276.18862.0.camel@bashful.x10sys.com> Just confirming .. all changes incorporated. Reid. On Wed, 2006-12-20 at 18:22 -0800, Chris Lattner wrote: > On Dec 17, 2006, at 3:35 PM, Reid Spencer wrote: > > > Chris, > > > > Attached is the patch to InstructionCombining.cpp for SETCC conversion > > to ICmpInst. This passes all tests. > > > > All your previous feedback has been incorporated and confirmed. The > > test > > just completed includes all those changes as well. > > > > I'm looking forward to finally committing the SETCC patch so we can > > finish it off and then start removing unnecessary casts and > > unifying the > > integer types. > > +// SimplifyCompare - For a CmpInst this function just orders the > operands > +// so that theyare listed from right (least complex) to left (most > complex). > +// This puts constants before unary operators before binary operators. > +// > +bool InstCombiner::SimplifyCompare(CmpInst &I) { > > Please doxygenify the comment. > > + bool Changed = false; > + if (getComplexity(I.getOperand(0)) < getComplexity(I.getOperand > (1))) { > + I.swapOperands(); > + Changed = true; > + } > + // Compare instructions are not associative so there's nothing > else we can do. > + return Changed; > +} > > Why not: > > if (getComplexity(I.getOperand(0)) >= getComplexity(I.getOperand(1))) > return false; > I.swapOperands(); > return true; > > ? > > > > // isTrueWhenEqual - Return true if the specified setcondinst > instruction is > // true when both operands are equal... > // > static bool isTrueWhenEqual(Instruction &I) { > + if (ICmpInst *ICI = dyn_cast(&I)) > + return ICI->getPredicate() == ICmpInst::ICMP_EQ || > + ICI->getPredicate() == ICmpInst::ICMP_UGE || > + ICI->getPredicate() == ICmpInst::ICMP_SGE || > + ICI->getPredicate() == ICmpInst::ICMP_ULE || > + ICI->getPredicate() == ICmpInst::ICMP_SLE; > return I.getOpcode() == Instruction::SetEQ || > I.getOpcode() == Instruction::SetGE || > I.getOpcode() == Instruction::SetLE; > } > > This should be split into two functions, one for ICmpInst and one for > FCmpInst/SetCondInst. Since your touching it, plz doxygenify also. :) > > > > @@ -1580,21 +1607,31 @@ static Value *FoldOperationIntoSelectOpe > // Figure out if the constant is the left or the right argument. > bool ConstIsRHS = isa(I.getOperand(1)); > Constant *ConstOperand = cast(I.getOperand(ConstIsRHS)); > > if (Constant *SOC = dyn_cast(SO)) { > - if (ConstIsRHS) > - return ConstantExpr::get(I.getOpcode(), SOC, ConstOperand); > - return ConstantExpr::get(I.getOpcode(), ConstOperand, SOC); > + if (CmpInst *CI = dyn_cast(&I)) { > + unsigned short pred = CI->getPredicate(); > + if (ConstIsRHS) > + return ConstantExpr::getCompare(pred, SOC, ConstOperand); > + return ConstantExpr::getCompare(pred, ConstOperand, SOC); > > This code doesn't appear to be called for compares. Is it? If so, > the code is broken, you can't just swap the LHS/RHS of a compare like > that without breaking things. > > > +/// isSignBitCheck - Given an exploded icmp instruction, return true > if it > /// really just returns true if the most significant (sign) bit is > set. > +static bool isSignBitCheck(ICmpInst::Predicate pred, Value *LHS, > + ConstantInt *RHS) { > > There is no reason to pass LHS into this function (this is an > absolute statement, not a bug in your patch) please remove LHS. > > > + case ICmpInst::ICMP_UGE: > + // True if LHS u>= RHS and RHS == high-bit-mask (2^7, 2^15, > 2^31, etc) > + return RHS->getZExtValue() == 1ULL << > + RHS->getType()->getPrimitiveSizeInBits()-1; > > Please add parens to make the precedence more explicit, even though > it is right. > > > More tomorrow, > > -Chris > > From rspencer at reidspencer.com Fri Dec 22 17:08:52 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Fri, 22 Dec 2006 15:08:52 -0800 Subject: [llvm-commits] SETCC InstructionCombining.cpp [#2/3] In-Reply-To: <0E37677C-8E3C-4E5F-B7FA-C6496A05CFA8@apple.com> References: <1166398509.2826.12.camel@bashful.x10sys.com> <0E37677C-8E3C-4E5F-B7FA-C6496A05CFA8@apple.com> Message-ID: <1166828932.18862.4.camel@bashful.x10sys.com> On Fri, 2006-12-22 at 12:08 -0800, Chris Lattner wrote: > > +/// Four bits are used to represent the condition, as follows: > +/// 0 A > B > +/// 1 A == B > +/// 2 A < B > +/// 3 A and B are signed > +/// > +/// S<=> Definition S<=> Definition > +/// 0000 Always false 1000 Alwasy false > +/// 0001 A u> B 1001 A s> B > +/// 0010 A == B 1010 A == B > +/// 0011 A u>= B 1011 A s>= B > +/// 0100 A u< B 1100 A s< B > +/// 0101 A != B 1101 A != B > +/// 0110 A u<= B 1110 A s<= B > +/// 0111 Always true 1111 Always true > +/// > +static unsigned getICmpCode(const ICmpInst *ICI) { > > > This table (and it's use) is not correct. It will miscompile: > > > (a > > You really want separate bits for s<, s>, u<, u>. In this case, you'd > detect that the merged comparison can't be done with a single compare, > so you give up. I don't understand. There are separate bits for each of those. s< = 1100 s> = 1001 u< = 0100 u> = 0001 > From sabre at nondot.org Fri Dec 22 17:14:57 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 22 Dec 2006 17:14:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200612222314.kBMNEvKA015537@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.59 -> 1.60 --- Log message: add a simple fast-path for dead allocas --- Diffs of the changes: (+8 -1) ScalarReplAggregates.cpp | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.59 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.60 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.59 Tue Dec 19 15:40:18 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Fri Dec 22 17:14:42 2006 @@ -139,6 +139,13 @@ AllocationInst *AI = WorkList.back(); WorkList.pop_back(); + // Handle dead allocas trivially. These can be formed by SROA'ing arrays + // with unused elements. + if (AI->use_empty()) { + AI->eraseFromParent(); + continue; + } + // If we can turn this aggregate value (potentially with casts) into a // simple scalar value that can be mem2reg'd into a register value. bool IsNotTrivial = false; @@ -232,7 +239,7 @@ } // Finally, delete the Alloca instruction - AI->getParent()->getInstList().erase(AI); + AI->eraseFromParent(); NumReplaced++; } From clattner at apple.com Fri Dec 22 19:27:00 2006 From: clattner at apple.com (Chris Lattner) Date: Fri, 22 Dec 2006 17:27:00 -0800 Subject: [llvm-commits] SETCC InstructionCombining.cpp [#2/3] In-Reply-To: <1166828932.18862.4.camel@bashful.x10sys.com> References: <1166398509.2826.12.camel@bashful.x10sys.com> <0E37677C-8E3C-4E5F-B7FA-C6496A05CFA8@apple.com> <1166828932.18862.4.camel@bashful.x10sys.com> Message-ID: <7F987159-CF63-4DF8-ABCD-9FEDD04E6CB8@apple.com> On Dec 22, 2006, at 3:08 PM, Reid Spencer wrote: > On Fri, 2006-12-22 at 12:08 -0800, Chris Lattner wrote: > >> >> +/// Four bits are used to represent the condition, as follows: >> +/// 0 A > B >> +/// 1 A == B >> +/// 2 A < B >> +/// 3 A and B are signed >> +/// >> +/// S<=> Definition S<=> Definition >> +/// 0000 Always false 1000 Alwasy false >> +/// 0001 A u> B 1001 A s> B >> +/// 0010 A == B 1010 A == B >> +/// 0011 A u>= B 1011 A s>= B >> +/// 0100 A u< B 1100 A s< B >> +/// 0101 A != B 1101 A != B >> +/// 0110 A u<= B 1110 A s<= B >> +/// 0111 Always true 1111 Always true >> +/// >> +static unsigned getICmpCode(const ICmpInst *ICI) { >> >> >> This table (and it's use) is not correct. It will miscompile: >> >> >> (a > >> >> You really want separate bits for s<, s>, u<, u>. In this case, >> you'd >> detect that the merged comparison can't be done with a single >> compare, >> so you give up. > > I don't understand. There are separate bits for each of those. > > s< = 1100 > s> = 1001 > u< = 0100 > u> = 0001 If you or together s< and u< you get 1100, which is thought to be s<. This is not valid. You want == -> 00001 s< -> 00010 s> -> 00100 u< -> 01000 u> -> 10000 or something -Chris From rspencer at reidspencer.com Fri Dec 22 20:45:41 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Fri, 22 Dec 2006 18:45:41 -0800 Subject: [llvm-commits] SETCC InstructionCombining.cpp [3/3] In-Reply-To: <6CF87779-7C5F-4787-9440-BF83A47C373E@apple.com> References: <1166398509.2826.12.camel@bashful.x10sys.com> <6CF87779-7C5F-4787-9440-BF83A47C373E@apple.com> Message-ID: <1166841941.18862.8.camel@bashful.x10sys.com> On Fri, 2006-12-22 at 13:31 -0800, Chris Lattner wrote: > > + // We're performing a signed comparison. > + if (isSignedExt) { > + // Signed extend and signed comparison. > + if (cast(CI)->getSExtValue() < 0)// X < (small) > --> false > + Result = ConstantBool::getFalse(); > + else > + Result = ConstantBool::getTrue(); // X < (large) > --> true > + } else { > + // Zero extend and signed comparison. > + if (cast(CI)->getSExtValue() < 0) > + Result = ConstantBool::getFalse(); > + else > + Result = ConstantBool::getTrue(); > } > > > My reading of this code says that you can eliminate the 'if > issignedext' test, as the if/then cases are the same. Is this a bug > or just code duplication? I'm not Sure. The original (before any signless types changes, rev 1.525) looks like this: if (DestTy->isSigned()) { // We're performing a signed comparison. if (isSignSrc) { // Signed extend and signed comparison. if (cast(CI)->getValue() < 0) // X < (small) --> false Result = ConstantBool::getFalse(); else Result = ConstantBool::getTrue(); // X < (large) --> true } else { // Unsigned extend and signed comparison. if (cast(CI)->getValue() < 0) Result = ConstantBool::getFalse(); else Result = ConstantBool::getTrue(); } Clearly getting the ZExt value and comparing with < 0 is just silly (unsigned is never less than zero). I'm inclined to think this is either a long-standing bug or just some code duplication. I'll eliminate the redundancy because it is clearly generating the same results in either case. However, I'm not convinced this isn't a bug. Reid. > From rspencer at reidspencer.com Fri Dec 22 21:54:25 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Fri, 22 Dec 2006 19:54:25 -0800 Subject: [llvm-commits] SETCC InstructionCombining.cpp [3/3] In-Reply-To: <6CF87779-7C5F-4787-9440-BF83A47C373E@apple.com> References: <1166398509.2826.12.camel@bashful.x10sys.com> <6CF87779-7C5F-4787-9440-BF83A47C373E@apple.com> Message-ID: <1166846065.18862.14.camel@bashful.x10sys.com> On Fri, 2006-12-22 at 13:31 -0800, Chris Lattner wrote: > > + if (Res2 == CI) { > + // Make sure that sign of the Cmp and the sign of the Cast are > the same. > + // For example, we might have: > + // %A = sext short %X to uint > + // %B = icmp ugt uint %A, 1330 > + // It is incorrect to transform this into > + // %B = icmp ugt short %X, 1330 > + // because %A may have negative value. > + // > + // However, it is OK if SrcTy is bool (See cast-set.ll testcase) > + // OR operation is EQ/NE. > + if (isSignedExt == isSignedCmp || SrcTy == Type::BoolTy || > ICI.isEquality()) > + return new ICmpInst(ICI.getPredicate(), LHSCIOp, Res1); > + else > + return 0; > + } > > > Can you explain why srcty == bool is a special case? 1. test/Regression/Transforms/InstCombine/JavaCompare.ll fails without it. 2. Since Res1 is truncated to SrcTy, if the source of the LHS cast is also bool, the compare is fine, type wise. 3. Since Res2 is Res1 casted back to the Cast's destination type and Res2 is equal to the RHS constant. Without this we miss optimization opportunities. Reid. From reid at x10sys.com Sat Dec 23 00:06:59 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:59 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/Miscompilation.cpp Message-ID: <200612230606.kBN66xdB022050@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: Miscompilation.cpp updated: 1.81 -> 1.82 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+2 -2) Miscompilation.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.81 llvm/tools/bugpoint/Miscompilation.cpp:1.82 --- llvm/tools/bugpoint/Miscompilation.cpp:1.81 Sun Nov 26 19:05:10 2006 +++ llvm/tools/bugpoint/Miscompilation.cpp Sat Dec 23 00:05:41 2006 @@ -724,8 +724,8 @@ // Check to see if we already looked up the value. Value *CachedVal = new LoadInst(Cache, "fpcache", EntryBB); - Value *IsNull = new SetCondInst(Instruction::SetEQ, CachedVal, - NullPtr, "isNull", EntryBB); + Value *IsNull = new ICmpInst(ICmpInst::ICMP_EQ, CachedVal, + NullPtr, "isNull", EntryBB); new BranchInst(LookupBB, DoCallBB, IsNull, EntryBB); // Resolve the call to function F via the JIT API: From reid at x10sys.com Sat Dec 23 00:06:59 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Makefile Writer.cpp Message-ID: <200612230606.kBN66xlL022060@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Makefile updated: 1.8 -> 1.9 Writer.cpp updated: 1.300 -> 1.301 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+289 -114) Makefile | 2 Writer.cpp | 401 +++++++++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 289 insertions(+), 114 deletions(-) Index: llvm/lib/Target/CBackend/Makefile diff -u llvm/lib/Target/CBackend/Makefile:1.8 llvm/lib/Target/CBackend/Makefile:1.9 --- llvm/lib/Target/CBackend/Makefile:1.8 Thu Nov 2 18:00:57 2006 +++ llvm/lib/Target/CBackend/Makefile Sat Dec 23 00:05:41 2006 @@ -11,4 +11,4 @@ LIBRARYNAME = LLVMCBackend include $(LEVEL)/Makefile.common -CompileCommonOpts := $(CompileCommonOpts) -Wno-format +CompileCommonOpts += -Wno-format Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.300 llvm/lib/Target/CBackend/Writer.cpp:1.301 --- llvm/lib/Target/CBackend/Writer.cpp:1.300 Sun Dec 17 14:24:50 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Sat Dec 23 00:05:41 2006 @@ -116,6 +116,9 @@ std::ostream &printType(std::ostream &Out, const Type *Ty, const std::string &VariableName = "", bool IgnoreName = false); + std::ostream &printPrimitiveType(std::ostream &Out, const Type *Ty, + bool isSigned, + const std::string &NameSoFar = ""); void printStructReturnPointerFunctionType(std::ostream &Out, const PointerType *Ty); @@ -124,6 +127,7 @@ void writeOperandRaw(Value *Operand); void writeOperandInternal(Value *Operand); void writeOperandWithCast(Value* Operand, unsigned Opcode); + void writeOperandWithCast(Value* Operand, ICmpInst::Predicate predicate); bool writeInstructionCast(const Instruction &I); private : @@ -154,9 +158,10 @@ // printed and an extra copy of the expr is not emitted. // static bool isInlinableInst(const Instruction &I) { - // Always inline setcc instructions, even if they are shared by multiple + // Always inline cmp instructions, even if they are shared by multiple // expressions. GCC generates horrible code if we don't. - if (isa(I)) return true; + if (isa(I)) + return true; // Must be an expression, must be used exactly once. If it is dead, we // emit it inline where it would go. @@ -211,6 +216,8 @@ void visitPHINode(PHINode &I); void visitBinaryOperator(Instruction &I); + void visitICmpInst(ICmpInst &I); + void visitFCmpInst(FCmpInst &I); void visitCastInst (CastInst &I); void visitSelectInst(SelectInst &I); @@ -351,6 +358,32 @@ printType(Out, RetTy, tstr); } +std::ostream & +CWriter::printPrimitiveType(std::ostream &Out, const Type *Ty, bool isSigned, + const std::string &NameSoFar) { + assert(Ty->isPrimitiveType() && "Invalid type for printPrimitiveType"); + switch (Ty->getTypeID()) { + case Type::VoidTyID: return Out << "void " << NameSoFar; + case Type::BoolTyID: return Out << "bool " << NameSoFar; + case Type::UByteTyID: + case Type::SByteTyID: + return Out << (isSigned?"signed":"unsigned") << " char " << NameSoFar; + case Type::UShortTyID: + case Type::ShortTyID: + return Out << (isSigned?"signed":"unsigned") << " short " << NameSoFar; + case Type::UIntTyID: + case Type::IntTyID: + return Out << (isSigned?"signed":"unsigned") << " int " << NameSoFar; + case Type::ULongTyID: + case Type::LongTyID: + return Out << (isSigned?"signed":"unsigned") << " long long " << NameSoFar; + case Type::FloatTyID: return Out << "float " << NameSoFar; + case Type::DoubleTyID: return Out << "double " << NameSoFar; + default : + cerr << "Unknown primitive type: " << *Ty << "\n"; + abort(); + } +} // Pass the Type* and the variable name and this prints out the variable // declaration. @@ -358,24 +391,13 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, const std::string &NameSoFar, bool IgnoreName) { - if (Ty->isPrimitiveType()) - 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; - case Type::SByteTyID: return Out << "signed char " << NameSoFar; - case Type::UShortTyID: return Out << "unsigned short " << NameSoFar; - case Type::ShortTyID: return Out << "short " << NameSoFar; - case Type::UIntTyID: return Out << "unsigned " << NameSoFar; - case Type::IntTyID: return Out << "int " << NameSoFar; - case Type::ULongTyID: return Out << "unsigned long long " << NameSoFar; - case Type::LongTyID: return Out << "signed long long " << NameSoFar; - case Type::FloatTyID: return Out << "float " << NameSoFar; - case Type::DoubleTyID: return Out << "double " << NameSoFar; - default : - cerr << "Unknown primitive type: " << *Ty << "\n"; - abort(); - } + if (Ty->isPrimitiveType()) { + // FIXME:Signedness. When integer types are signless, this should just + // always pass "false" for the sign of the primitive type. The instructions + // will figure out how the value is to be interpreted. + printPrimitiveType(Out, Ty, true, NameSoFar); + return Out; + } // Check to see if the type is named. if (!IgnoreName || isa(Ty)) { @@ -578,41 +600,66 @@ /// Print out the casting for a cast operation. This does the double casting /// necessary for conversion to the destination type, if necessary. -/// @returns true if a closing paren is necessary /// @brief Print a cast void CWriter::printCast(unsigned opc, const Type *SrcTy, const Type *DstTy) { - Out << '('; - printType(Out, DstTy); - Out << ')'; + // Print the destination type cast + switch (opc) { + case Instruction::UIToFP: + case Instruction::SIToFP: + case Instruction::IntToPtr: + case Instruction::Trunc: + case Instruction::BitCast: + case Instruction::FPExt: + case Instruction::FPTrunc: // For these the DstTy sign doesn't matter + Out << '('; + printType(Out, DstTy); + Out << ')'; + break; + case Instruction::ZExt: + case Instruction::PtrToInt: + case Instruction::FPToUI: // For these, make sure we get an unsigned dest + Out << '('; + printPrimitiveType(Out, DstTy, false); + Out << ')'; + break; + case Instruction::SExt: + case Instruction::FPToSI: // For these, make sure we get a signed dest + Out << '('; + printPrimitiveType(Out, DstTy, true); + Out << ')'; + break; + default: + assert(0 && "Invalid cast opcode"); + } + + // Print the source type cast switch (opc) { case Instruction::UIToFP: case Instruction::ZExt: - if (SrcTy->isSigned()) { - Out << '('; - printType(Out, SrcTy->getUnsignedVersion()); - Out << ')'; - } + Out << '('; + printPrimitiveType(Out, SrcTy, false); + Out << ')'; break; case Instruction::SIToFP: case Instruction::SExt: - if (SrcTy->isUnsigned()) { - Out << '('; - printType(Out, SrcTy->getSignedVersion()); - Out << ')'; - } + Out << '('; + printPrimitiveType(Out, SrcTy, true); + Out << ')'; break; case Instruction::IntToPtr: case Instruction::PtrToInt: - // Avoid "cast to pointer from integer of different size" warnings - Out << "(unsigned long)"; - break; + // Avoid "cast to pointer from integer of different size" warnings + Out << "(unsigned long)"; + break; case Instruction::Trunc: case Instruction::BitCast: case Instruction::FPExt: case Instruction::FPTrunc: case Instruction::FPToSI: case Instruction::FPToUI: + break; // These don't need a source cast. default: + assert(0 && "Invalid cast opcode"); break; } } @@ -679,12 +726,8 @@ case Instruction::And: case Instruction::Or: case Instruction::Xor: - case Instruction::SetEQ: - case Instruction::SetNE: - case Instruction::SetLT: - case Instruction::SetLE: - case Instruction::SetGT: - case Instruction::SetGE: + case Instruction::ICmp: + case Instruction::FCmp: case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: @@ -705,15 +748,43 @@ case Instruction::And: Out << " & "; break; case Instruction::Or: Out << " | "; break; case Instruction::Xor: Out << " ^ "; break; - case Instruction::SetEQ: Out << " == "; break; - case Instruction::SetNE: Out << " != "; break; - case Instruction::SetLT: Out << " < "; break; - case Instruction::SetLE: Out << " <= "; break; - case Instruction::SetGT: Out << " > "; break; - case Instruction::SetGE: Out << " >= "; break; case Instruction::Shl: Out << " << "; break; case Instruction::LShr: case Instruction::AShr: Out << " >> "; break; + case Instruction::ICmp: + switch (CE->getPredicate()) { + case ICmpInst::ICMP_EQ: Out << " == "; break; + case ICmpInst::ICMP_NE: Out << " != "; break; + case ICmpInst::ICMP_SLT: + case ICmpInst::ICMP_ULT: Out << " < "; break; + case ICmpInst::ICMP_SLE: + case ICmpInst::ICMP_ULE: Out << " <= "; break; + case ICmpInst::ICMP_SGT: + case ICmpInst::ICMP_UGT: Out << " > "; break; + case ICmpInst::ICMP_SGE: + case ICmpInst::ICMP_UGE: Out << " >= "; break; + default: assert(0 && "Illegal ICmp predicate"); + } + break; + case Instruction::FCmp: + switch (CE->getPredicate()) { + case FCmpInst::FCMP_ORD: + case FCmpInst::FCMP_UEQ: + case FCmpInst::FCMP_OEQ: Out << " == "; break; + case FCmpInst::FCMP_UNO: + case FCmpInst::FCMP_UNE: + case FCmpInst::FCMP_ONE: Out << " != "; break; + case FCmpInst::FCMP_OLT: + case FCmpInst::FCMP_ULT: Out << " < "; break; + case FCmpInst::FCMP_OLE: + case FCmpInst::FCMP_ULE: Out << " <= "; break; + case FCmpInst::FCMP_OGT: + case FCmpInst::FCMP_UGT: Out << " > "; break; + case FCmpInst::FCMP_OGE: + case FCmpInst::FCMP_UGE: Out << " >= "; break; + default: assert(0 && "Illegal FCmp predicate"); + } + break; default: assert(0 && "Illegal opcode here!"); } printConstantWithCast(CE->getOperand(1), CE->getOpcode()); @@ -730,7 +801,7 @@ } } else if (isa(CPV) && CPV->getType()->isFirstClassType()) { Out << "(("; - printType(Out, CPV->getType()); + printType(Out, CPV->getType()); // sign doesn't matter Out << ")/*UNDEF*/0)"; return; } @@ -740,9 +811,23 @@ Out << (cast(CPV)->getValue() ? '1' : '0'); break; case Type::SByteTyID: + case Type::UByteTyID: + Out << "((char)" << cast(CPV)->getSExtValue() << ")"; + break; case Type::ShortTyID: - Out << cast(CPV)->getSExtValue(); + case Type::UShortTyID: + Out << "((short)" << cast(CPV)->getSExtValue() << ")"; + break; + case Type::IntTyID: + case Type::UIntTyID: + Out << "((int)" << cast(CPV)->getSExtValue() << ")"; + break; + case Type::LongTyID: + case Type::ULongTyID: + Out << "((long long)" << cast(CPV)->getSExtValue() << "ll)"; break; + +#if 0 case Type::IntTyID: if ((int)cast(CPV)->getSExtValue() == (int)0x80000000) Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning @@ -767,6 +852,7 @@ case Type::ULongTyID: Out << cast(CPV)->getZExtValue() << "ull"; break; +#endif case Type::FloatTyID: case Type::DoubleTyID: { @@ -890,7 +976,7 @@ case Type::PointerTyID: if (isa(CPV)) { Out << "(("; - printType(Out, CPV->getType()); + printType(Out, CPV->getType()); // sign doesn't matter Out << ")/*NULL*/0)"; break; } else if (GlobalValue *GV = dyn_cast(CPV)) { @@ -910,17 +996,20 @@ bool CWriter::printConstExprCast(const ConstantExpr* CE) { bool NeedsExplicitCast = false; const Type *Ty = CE->getOperand(0)->getType(); + bool TypeIsSigned = false; switch (CE->getOpcode()) { case Instruction::LShr: case Instruction::URem: - case Instruction::UDiv: - NeedsExplicitCast = Ty->isSigned(); break; + case Instruction::UDiv: NeedsExplicitCast = true; break; case Instruction::AShr: case Instruction::SRem: - case Instruction::SDiv: - NeedsExplicitCast = Ty->isUnsigned(); break; - case Instruction::ZExt: + case Instruction::SDiv: NeedsExplicitCast = true; TypeIsSigned = true; break; case Instruction::SExt: + Ty = CE->getType(); + NeedsExplicitCast = true; + TypeIsSigned = true; + break; + case Instruction::ZExt: case Instruction::Trunc: case Instruction::FPTrunc: case Instruction::FPExt: @@ -938,7 +1027,10 @@ } if (NeedsExplicitCast) { Out << "(("; - printType(Out, Ty); + if (Ty->isPrimitiveType()) + printPrimitiveType(Out, Ty, TypeIsSigned); + else + printType(Out, Ty); Out << ")("; } return NeedsExplicitCast; @@ -954,6 +1046,7 @@ // Indicate whether to do the cast or not. bool shouldCast = false; + bool typeIsSigned = false; // Based on the Opcode for which this Constant is being written, determine // the new type to which the operand should be casted by setting the value @@ -966,20 +1059,13 @@ case Instruction::LShr: case Instruction::UDiv: case Instruction::URem: - // For UDiv/URem get correct type - if (OpTy->isSigned()) { - OpTy = OpTy->getUnsignedVersion(); - shouldCast = true; - } + shouldCast = true; break; case Instruction::AShr: case Instruction::SDiv: case Instruction::SRem: - // For SDiv/SRem get correct type - if (OpTy->isUnsigned()) { - OpTy = OpTy->getSignedVersion(); - shouldCast = true; - } + shouldCast = true; + typeIsSigned = true; break; } @@ -987,13 +1073,12 @@ // operand. if (shouldCast) { Out << "(("; - printType(Out, OpTy); + printPrimitiveType(Out, OpTy, typeIsSigned); Out << ")"; printConstant(CPV); Out << ")"; } else - writeOperand(CPV); - + printConstant(CPV); } void CWriter::writeOperandInternal(Value *Operand) { @@ -1038,40 +1123,25 @@ // This function takes care of detecting that case and printing the cast // for the Instruction. bool CWriter::writeInstructionCast(const Instruction &I) { - bool NeedsExplicitCast = false; const Type *Ty = I.getOperand(0)->getType(); switch (I.getOpcode()) { case Instruction::LShr: case Instruction::URem: case Instruction::UDiv: - NeedsExplicitCast = Ty->isSigned(); break; + Out << "(("; + printPrimitiveType(Out, Ty, false); + Out << ")("; + return true; case Instruction::AShr: case Instruction::SRem: case Instruction::SDiv: - NeedsExplicitCast = Ty->isUnsigned(); break; - case Instruction::ZExt: - case Instruction::SExt: - case Instruction::Trunc: - case Instruction::FPTrunc: - case Instruction::FPExt: - case Instruction::UIToFP: - case Instruction::SIToFP: - case Instruction::FPToUI: - case Instruction::FPToSI: - case Instruction::PtrToInt: - case Instruction::IntToPtr: - case Instruction::BitCast: - Ty = I.getType(); - NeedsExplicitCast = true; - break; - default: break; - } - if (NeedsExplicitCast) { Out << "(("; - printType(Out, Ty); + printPrimitiveType(Out, Ty, true); Out << ")("; + return true; + default: break; } - return NeedsExplicitCast; + return false; } // Write the operand with a cast to another type based on the Opcode being used. @@ -1085,6 +1155,9 @@ // Indicate whether to do the cast or not. bool shouldCast = false; + // Indicate whether the cast should be to a signed type or not. + bool castIsSigned = false; + // Based on the Opcode for which this Operand is being written, determine // the new type to which the operand should be casted by setting the value // of OpTy. If we change OpTy, also set shouldCast to true. @@ -1094,20 +1167,15 @@ break; case Instruction::LShr: case Instruction::UDiv: - case Instruction::URem: - // For UDiv to have unsigned operands - if (OpTy->isSigned()) { - OpTy = OpTy->getUnsignedVersion(); - shouldCast = true; - } + case Instruction::URem: // Cast to unsigned first + shouldCast = true; + castIsSigned = false; break; case Instruction::AShr: case Instruction::SDiv: - case Instruction::SRem: - if (OpTy->isUnsigned()) { - OpTy = OpTy->getSignedVersion(); - shouldCast = true; - } + case Instruction::SRem: // Cast to signed first + shouldCast = true; + castIsSigned = true; break; } @@ -1115,13 +1183,62 @@ // operand. if (shouldCast) { Out << "(("; - printType(Out, OpTy); + printPrimitiveType(Out, OpTy, castIsSigned); Out << ")"; writeOperand(Operand); Out << ")"; } else writeOperand(Operand); +} + +// Write the operand with a cast to another type based on the icmp predicate +// being used. +void CWriter::writeOperandWithCast(Value* Operand, ICmpInst::Predicate predicate) { + + // Extract the operand's type, we'll need it. + const Type* OpTy = Operand->getType(); + + // Indicate whether to do the cast or not. + bool shouldCast = false; + // Indicate whether the cast should be to a signed type or not. + bool castIsSigned = false; + + // Based on the Opcode for which this Operand is being written, determine + // the new type to which the operand should be casted by setting the value + // of OpTy. If we change OpTy, also set shouldCast to true. + switch (predicate) { + default: + // for eq and ne, it doesn't matter + break; + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_ULE: + shouldCast = true; + break; + case ICmpInst::ICMP_SGT: + case ICmpInst::ICMP_SGE: + case ICmpInst::ICMP_SLT: + case ICmpInst::ICMP_SLE: + shouldCast = true; + castIsSigned = true; + break; + } + + // Write out the casted operand if we should, otherwise just write the + // operand. + if (shouldCast) { + Out << "(("; + if (OpTy->isPrimitiveType()) + printPrimitiveType(Out, OpTy, castIsSigned); + else + printType(Out, OpTy); + Out << ")"; + writeOperand(Operand); + Out << ")"; + } else + writeOperand(Operand); } // generateCompilerSpecificCode - This is where we add conditional compilation @@ -1725,7 +1842,7 @@ PrintedVar = true; } // We need a temporary for the BitCast to use so it can pluck a value out - // of a uniont to do the BitCast. This is separate from the need for a + // of a union to do the BitCast. This is separate from the need for a // variable to hold the result of the BitCast. if (isFPIntBitCast(*I)) { Out << " llvmBitCastUnion " << Mang->getValueName(&*I) @@ -1992,12 +2109,6 @@ case Instruction::And: Out << " & "; break; case Instruction::Or: Out << " | "; break; case Instruction::Xor: Out << " ^ "; break; - case Instruction::SetEQ: Out << " == "; break; - case Instruction::SetNE: Out << " != "; break; - case Instruction::SetLE: Out << " <= "; break; - case Instruction::SetGE: Out << " >= "; break; - case Instruction::SetLT: Out << " < "; break; - case Instruction::SetGT: Out << " > "; break; case Instruction::Shl : Out << " << "; break; case Instruction::LShr: case Instruction::AShr: Out << " >> "; break; @@ -2014,6 +2125,70 @@ } } +void CWriter::visitICmpInst(ICmpInst &I) { + // We must cast the results of icmp which might be promoted. + bool needsCast = false; + + // Write out the cast of the instruction's value back to the proper type + // if necessary. + bool NeedsClosingParens = writeInstructionCast(I); + + // Certain icmp predicate require the operand to be forced to a specific type + // so we use writeOperandWithCast here instead of writeOperand. Similarly + // below for operand 1 + writeOperandWithCast(I.getOperand(0), I.getPredicate()); + + switch (I.getPredicate()) { + case ICmpInst::ICMP_EQ: Out << " == "; break; + case ICmpInst::ICMP_NE: Out << " != "; break; + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: Out << " <= "; break; + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: Out << " >= "; break; + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: Out << " < "; break; + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: Out << " > "; break; + default: cerr << "Invalid icmp predicate!" << I; abort(); + } + + writeOperandWithCast(I.getOperand(1), I.getPredicate()); + if (NeedsClosingParens) + Out << "))"; + + if (needsCast) { + Out << "))"; + } +} + +void CWriter::visitFCmpInst(FCmpInst &I) { + // Write the first operand + writeOperand(I.getOperand(0)); + + // Write the predicate + switch (I.getPredicate()) { + case FCmpInst::FCMP_FALSE: Out << " 0 "; break; + case FCmpInst::FCMP_ORD: + case FCmpInst::FCMP_OEQ: + case FCmpInst::FCMP_UEQ: Out << " == "; break; + case FCmpInst::FCMP_UNO: + case FCmpInst::FCMP_ONE: + case FCmpInst::FCMP_UNE: Out << " != "; break; + case FCmpInst::FCMP_ULE: + case FCmpInst::FCMP_OLE: Out << " <= "; break; + case FCmpInst::FCMP_UGE: + case FCmpInst::FCMP_OGE: Out << " >= "; break; + case FCmpInst::FCMP_ULT: + case FCmpInst::FCMP_OLT: Out << " < "; break; + case FCmpInst::FCMP_UGT: + case FCmpInst::FCMP_OGT: Out << " > "; break; + case FCmpInst::FCMP_TRUE: Out << " 1 "; break; + default: cerr << "Invalid fcmp predicate!" << I; abort(); + } + // Write the second operand + writeOperand(I.getOperand(1)); +} + static const char * getFloatBitCastField(const Type *Ty) { switch (Ty->getTypeID()) { default: assert(0 && "Invalid Type"); From reid at x10sys.com Sat Dec 23 00:06:58 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200612230606.kBN66wcD022037@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.333 -> 1.334 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+89 -104) SelectionDAGISel.cpp | 193 +++++++++++++++++++++++---------------------------- 1 files changed, 89 insertions(+), 104 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.333 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.334 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.333 Tue Dec 19 19:27:29 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Dec 23 00:05:40 2006 @@ -541,20 +541,6 @@ void visitAShr(User &I) { visitShift(I, ISD::SRA); } void visitICmp(User &I); void visitFCmp(User &I); - void visitSetCC(User &I, ISD::CondCode SignedOpc, ISD::CondCode UnsignedOpc, - ISD::CondCode FPOpc); - void visitSetEQ(User &I) { visitSetCC(I, ISD::SETEQ, ISD::SETEQ, - ISD::SETOEQ); } - void visitSetNE(User &I) { visitSetCC(I, ISD::SETNE, ISD::SETNE, - ISD::SETUNE); } - void visitSetLE(User &I) { visitSetCC(I, ISD::SETLE, ISD::SETULE, - ISD::SETOLE); } - void visitSetGE(User &I) { visitSetCC(I, ISD::SETGE, ISD::SETUGE, - ISD::SETOGE); } - void visitSetLT(User &I) { visitSetCC(I, ISD::SETLT, ISD::SETULT, - ISD::SETOLT); } - void visitSetGT(User &I) { visitSetCC(I, ISD::SETGT, ISD::SETUGT, - ISD::SETOGT); } // Visit the conversion instructions void visitTrunc(User &I); void visitZExt(User &I); @@ -851,9 +837,10 @@ MachineBasicBlock *CurBB, unsigned Opc) { // If this node is not part of the or/and tree, emit it as a branch. - BinaryOperator *BOp = dyn_cast(Cond); + Instruction *BOp = dyn_cast(Cond); - if (!BOp || (unsigned)BOp->getOpcode() != Opc || !BOp->hasOneUse() || + if (!BOp || !(isa(BOp) || isa(BOp)) || + (unsigned)BOp->getOpcode() != Opc || !BOp->hasOneUse() || BOp->getParent() != CurBB->getBasicBlock() || !InBlock(BOp->getOperand(0), CurBB->getBasicBlock()) || !InBlock(BOp->getOperand(1), CurBB->getBasicBlock())) { @@ -875,61 +862,60 @@ } - // If the leaf of the tree is a setcond inst, merge the condition into the - // caseblock. - if (BOp && isa(BOp) && - // The operands of the setcc have to be in this block. We don't know + // If the leaf of the tree is a comparison, merge the condition into + // the caseblock. + if ((isa(Cond) || isa(Cond)) && + // The operands of the cmp have to be in this block. We don't know // how to export them from some other block. If this is the first block // of the sequence, no exporting is needed. (CurBB == CurMBB || (isExportableFromCurrentBlock(BOp->getOperand(0), BB) && isExportableFromCurrentBlock(BOp->getOperand(1), BB)))) { - ISD::CondCode SignCond, UnsCond, FPCond, Condition; - switch (BOp->getOpcode()) { - default: assert(0 && "Unknown setcc opcode!"); - case Instruction::SetEQ: - SignCond = ISD::SETEQ; - UnsCond = ISD::SETEQ; - FPCond = ISD::SETOEQ; - break; - case Instruction::SetNE: - SignCond = ISD::SETNE; - UnsCond = ISD::SETNE; - FPCond = ISD::SETUNE; - break; - case Instruction::SetLE: - SignCond = ISD::SETLE; - UnsCond = ISD::SETULE; - FPCond = ISD::SETOLE; - break; - case Instruction::SetGE: - SignCond = ISD::SETGE; - UnsCond = ISD::SETUGE; - FPCond = ISD::SETOGE; - break; - case Instruction::SetLT: - SignCond = ISD::SETLT; - UnsCond = ISD::SETULT; - FPCond = ISD::SETOLT; - break; - case Instruction::SetGT: - SignCond = ISD::SETGT; - UnsCond = ISD::SETUGT; - FPCond = ISD::SETOGT; - break; + BOp = cast(Cond); + ISD::CondCode Condition; + if (ICmpInst *IC = dyn_cast(Cond)) { + switch (IC->getPredicate()) { + default: assert(0 && "Unknown icmp predicate opcode!"); + case ICmpInst::ICMP_EQ: Condition = ISD::SETEQ; break; + case ICmpInst::ICMP_NE: Condition = ISD::SETNE; break; + case ICmpInst::ICMP_SLE: Condition = ISD::SETLE; break; + case ICmpInst::ICMP_ULE: Condition = ISD::SETULE; break; + case ICmpInst::ICMP_SGE: Condition = ISD::SETGE; break; + case ICmpInst::ICMP_UGE: Condition = ISD::SETUGE; break; + case ICmpInst::ICMP_SLT: Condition = ISD::SETLT; break; + case ICmpInst::ICMP_ULT: Condition = ISD::SETULT; break; + case ICmpInst::ICMP_SGT: Condition = ISD::SETGT; break; + case ICmpInst::ICMP_UGT: Condition = ISD::SETUGT; break; + } + } else if (FCmpInst *FC = dyn_cast(Cond)) { + ISD::CondCode FPC, FOC; + switch (FC->getPredicate()) { + default: assert(0 && "Unknown fcmp predicate opcode!"); + case FCmpInst::FCMP_FALSE: FOC = FPC = ISD::SETFALSE; break; + case FCmpInst::FCMP_OEQ: FOC = ISD::SETEQ; FPC = ISD::SETOEQ; break; + case FCmpInst::FCMP_OGT: FOC = ISD::SETGT; FPC = ISD::SETOGT; break; + case FCmpInst::FCMP_OGE: FOC = ISD::SETGE; FPC = ISD::SETOGE; break; + case FCmpInst::FCMP_OLT: FOC = ISD::SETLT; FPC = ISD::SETOLT; break; + case FCmpInst::FCMP_OLE: FOC = ISD::SETLE; FPC = ISD::SETOLE; break; + case FCmpInst::FCMP_ONE: FOC = ISD::SETNE; FPC = ISD::SETONE; break; + case FCmpInst::FCMP_ORD: FOC = ISD::SETEQ; FPC = ISD::SETO; break; + case FCmpInst::FCMP_UNO: FOC = ISD::SETNE; FPC = ISD::SETUO; break; + case FCmpInst::FCMP_UEQ: FOC = ISD::SETEQ; FPC = ISD::SETUEQ; break; + case FCmpInst::FCMP_UGT: FOC = ISD::SETGT; FPC = ISD::SETUGT; break; + case FCmpInst::FCMP_UGE: FOC = ISD::SETGE; FPC = ISD::SETUGE; break; + case FCmpInst::FCMP_ULT: FOC = ISD::SETLT; FPC = ISD::SETULT; break; + case FCmpInst::FCMP_ULE: FOC = ISD::SETLE; FPC = ISD::SETULE; break; + case FCmpInst::FCMP_UNE: FOC = ISD::SETNE; FPC = ISD::SETUNE; break; + case FCmpInst::FCMP_TRUE: FOC = FPC = ISD::SETTRUE; break; + } + if (FiniteOnlyFPMath()) + Condition = FOC; + else + Condition = FPC; + } else { + assert(0 && "Unknown compare instruction"); } - const Type *OpType = BOp->getOperand(0)->getType(); - if (const PackedType *PTy = dyn_cast(OpType)) - OpType = PTy->getElementType(); - - if (!FiniteOnlyFPMath() && OpType->isFloatingPoint()) - Condition = FPCond; - else if (OpType->isUnsigned()) - Condition = UnsCond; - else - Condition = SignCond; - SelectionDAGISel::CaseBlock CB(Condition, BOp->getOperand(0), BOp->getOperand(1), TBB, FBB, CurBB); SwitchCases.push_back(CB); @@ -1462,11 +1448,15 @@ } void SelectionDAGLowering::visitICmp(User &I) { - ICmpInst *IC = cast(&I); - SDOperand Op1 = getValue(IC->getOperand(0)); - SDOperand Op2 = getValue(IC->getOperand(1)); + ICmpInst::Predicate predicate = ICmpInst::BAD_ICMP_PREDICATE; + if (ICmpInst *IC = dyn_cast(&I)) + predicate = IC->getPredicate(); + else if (ConstantExpr *IC = dyn_cast(&I)) + predicate = ICmpInst::Predicate(IC->getPredicate()); + SDOperand Op1 = getValue(I.getOperand(0)); + SDOperand Op2 = getValue(I.getOperand(1)); ISD::CondCode Opcode; - switch (IC->getPredicate()) { + switch (predicate) { case ICmpInst::ICMP_EQ : Opcode = ISD::SETEQ; break; case ICmpInst::ICMP_NE : Opcode = ISD::SETNE; break; case ICmpInst::ICMP_UGT : Opcode = ISD::SETUGT; break; @@ -1486,46 +1476,41 @@ } void SelectionDAGLowering::visitFCmp(User &I) { - FCmpInst *FC = cast(&I); - SDOperand Op1 = getValue(FC->getOperand(0)); - SDOperand Op2 = getValue(FC->getOperand(1)); - ISD::CondCode Opcode; - switch (FC->getPredicate()) { - case FCmpInst::FCMP_FALSE : Opcode = ISD::SETFALSE; - case FCmpInst::FCMP_OEQ : Opcode = ISD::SETOEQ; - case FCmpInst::FCMP_OGT : Opcode = ISD::SETOGT; - case FCmpInst::FCMP_OGE : Opcode = ISD::SETOGE; - case FCmpInst::FCMP_OLT : Opcode = ISD::SETOLT; - case FCmpInst::FCMP_OLE : Opcode = ISD::SETOLE; - case FCmpInst::FCMP_ONE : Opcode = ISD::SETONE; - case FCmpInst::FCMP_ORD : Opcode = ISD::SETO; - case FCmpInst::FCMP_UNO : Opcode = ISD::SETUO; - case FCmpInst::FCMP_UEQ : Opcode = ISD::SETUEQ; - case FCmpInst::FCMP_UGT : Opcode = ISD::SETUGT; - case FCmpInst::FCMP_UGE : Opcode = ISD::SETUGE; - case FCmpInst::FCMP_ULT : Opcode = ISD::SETULT; - case FCmpInst::FCMP_ULE : Opcode = ISD::SETULE; - case FCmpInst::FCMP_UNE : Opcode = ISD::SETUNE; - case FCmpInst::FCMP_TRUE : Opcode = ISD::SETTRUE; + FCmpInst::Predicate predicate = FCmpInst::BAD_FCMP_PREDICATE; + if (FCmpInst *FC = dyn_cast(&I)) + predicate = FC->getPredicate(); + else if (ConstantExpr *FC = dyn_cast(&I)) + predicate = FCmpInst::Predicate(FC->getPredicate()); + SDOperand Op1 = getValue(I.getOperand(0)); + SDOperand Op2 = getValue(I.getOperand(1)); + ISD::CondCode Condition, FOC, FPC; + switch (predicate) { + case FCmpInst::FCMP_FALSE: FOC = FPC = ISD::SETFALSE; break; + case FCmpInst::FCMP_OEQ: FOC = ISD::SETEQ; FPC = ISD::SETOEQ; break; + case FCmpInst::FCMP_OGT: FOC = ISD::SETGT; FPC = ISD::SETOGT; break; + case FCmpInst::FCMP_OGE: FOC = ISD::SETGE; FPC = ISD::SETOGE; break; + case FCmpInst::FCMP_OLT: FOC = ISD::SETLT; FPC = ISD::SETOLT; break; + case FCmpInst::FCMP_OLE: FOC = ISD::SETLE; FPC = ISD::SETOLE; break; + case FCmpInst::FCMP_ONE: FOC = ISD::SETNE; FPC = ISD::SETONE; break; + case FCmpInst::FCMP_ORD: FOC = ISD::SETEQ; FPC = ISD::SETO; break; + case FCmpInst::FCMP_UNO: FOC = ISD::SETNE; FPC = ISD::SETUO; break; + case FCmpInst::FCMP_UEQ: FOC = ISD::SETEQ; FPC = ISD::SETUEQ; break; + case FCmpInst::FCMP_UGT: FOC = ISD::SETGT; FPC = ISD::SETUGT; break; + case FCmpInst::FCMP_UGE: FOC = ISD::SETGE; FPC = ISD::SETUGE; break; + case FCmpInst::FCMP_ULT: FOC = ISD::SETLT; FPC = ISD::SETULT; break; + case FCmpInst::FCMP_ULE: FOC = ISD::SETLE; FPC = ISD::SETULE; break; + case FCmpInst::FCMP_UNE: FOC = ISD::SETNE; FPC = ISD::SETUNE; break; + case FCmpInst::FCMP_TRUE: FOC = FPC = ISD::SETTRUE; break; default: assert(!"Invalid FCmp predicate value"); - Opcode = ISD::SETFALSE; + FOC = FPC = ISD::SETFALSE; break; } - setValue(&I, DAG.getSetCC(MVT::i1, Op1, Op2, Opcode)); -} - -void SelectionDAGLowering::visitSetCC(User &I,ISD::CondCode SignedOpcode, - ISD::CondCode UnsignedOpcode, - ISD::CondCode FPOpcode) { - SDOperand Op1 = getValue(I.getOperand(0)); - SDOperand Op2 = getValue(I.getOperand(1)); - ISD::CondCode Opcode = SignedOpcode; - if (!FiniteOnlyFPMath() && I.getOperand(0)->getType()->isFloatingPoint()) - Opcode = FPOpcode; - else if (I.getOperand(0)->getType()->isUnsigned()) - Opcode = UnsignedOpcode; - setValue(&I, DAG.getSetCC(MVT::i1, Op1, Op2, Opcode)); + if (FiniteOnlyFPMath()) + Condition = FOC; + else + Condition = FPC; + setValue(&I, DAG.getSetCC(MVT::i1, Op1, Op2, Condition)); } void SelectionDAGLowering::visitSelect(User &I) { From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp Message-ID: <200612230607.kBN670ZN022137@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: RSProfiling.cpp updated: 1.12 -> 1.13 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+10 -9) RSProfiling.cpp | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.12 llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.13 --- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.12 Tue Dec 19 16:23:21 2006 +++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp Sat Dec 23 00:05:41 2006 @@ -197,9 +197,9 @@ //decrement counter LoadInst* l = new LoadInst(Counter, "counter", t); - SetCondInst* s = new SetCondInst(Instruction::SetEQ, l, - ConstantInt::get(T, 0), - "countercc", t); + ICmpInst* s = new ICmpInst(ICmpInst::ICMP_EQ, l, ConstantInt::get(T, 0), + "countercc", t); + Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1), "counternew", t); new StoreInst(nv, Counter, t); @@ -270,9 +270,9 @@ //decrement counter LoadInst* l = new LoadInst(AI, "counter", t); - SetCondInst* s = new SetCondInst(Instruction::SetEQ, l, - ConstantInt::get(T, 0), - "countercc", t); + ICmpInst* s = new ICmpInst(ICmpInst::ICMP_EQ, l, ConstantInt::get(T, 0), + "countercc", t); + Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1), "counternew", t); new StoreInst(nv, AI, t); @@ -305,9 +305,10 @@ BinaryOperator::createAnd(c, ConstantInt::get(Type::ULongTy, rm), "mrdcc", t); - SetCondInst* s = new SetCondInst(Instruction::SetEQ, b, - ConstantInt::get(Type::ULongTy, 0), - "mrdccc", t); + ICmpInst *s = new ICmpInst(ICmpInst::ICMP_EQ, b, + ConstantInt::get(Type::ULongTy, 0), + "mrdccc", t); + t->setCondition(s); } From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/CloneFunction.cpp Local.cpp LowerInvoke.cpp LowerSwitch.cpp SimplifyCFG.cpp Message-ID: <200612230607.kBN670Yx022129@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: CloneFunction.cpp updated: 1.33 -> 1.34 Local.cpp updated: 1.62 -> 1.63 LowerInvoke.cpp updated: 1.47 -> 1.48 LowerSwitch.cpp updated: 1.30 -> 1.31 SimplifyCFG.cpp updated: 1.107 -> 1.108 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+63 -47) CloneFunction.cpp | 12 ++++++++++-- Local.cpp | 30 ++++++++++++++++++++---------- LowerInvoke.cpp | 12 ++++++------ LowerSwitch.cpp | 7 +++---- SimplifyCFG.cpp | 49 ++++++++++++++++++++++++------------------------- 5 files changed, 63 insertions(+), 47 deletions(-) Index: llvm/lib/Transforms/Utils/CloneFunction.cpp diff -u llvm/lib/Transforms/Utils/CloneFunction.cpp:1.33 llvm/lib/Transforms/Utils/CloneFunction.cpp:1.34 --- llvm/lib/Transforms/Utils/CloneFunction.cpp:1.33 Sun Nov 5 13:31:28 2006 +++ llvm/lib/Transforms/Utils/CloneFunction.cpp Sat Dec 23 00:05:41 2006 @@ -278,7 +278,15 @@ /// mapping its operands through ValueMap if they are available. Constant *PruningFunctionCloner:: ConstantFoldMappedInstruction(const Instruction *I) { - if (isa(I) || isa(I)) { + if (isa(I)) { + if (Constant *Op0 = dyn_cast_or_null(MapValue(I->getOperand(0), + ValueMap))) + if (Constant *Op1 = dyn_cast_or_null(MapValue(I->getOperand(1), + ValueMap))) + return ConstantExpr::getCompare(cast(I)->getPredicate(), Op0, + Op1); + return 0; + } else if (isa(I) || isa(I)) { if (Constant *Op0 = dyn_cast_or_null(MapValue(I->getOperand(0), ValueMap))) if (Constant *Op1 = dyn_cast_or_null(MapValue(I->getOperand(1), @@ -295,7 +303,7 @@ else return 0; // All operands not constant! - return ConstantFoldInstOperands(I->getOpcode(), I->getType(), Ops); + return ConstantFoldInstOperands(I, Ops); } /// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto, Index: llvm/lib/Transforms/Utils/Local.cpp diff -u llvm/lib/Transforms/Utils/Local.cpp:1.62 llvm/lib/Transforms/Utils/Local.cpp:1.63 --- llvm/lib/Transforms/Utils/Local.cpp:1.62 Sun Nov 26 19:05:10 2006 +++ llvm/lib/Transforms/Utils/Local.cpp Sat Dec 23 00:05:41 2006 @@ -71,6 +71,7 @@ case 2: Op1 = dyn_cast(I->getOperand(1)); if (Op1 == 0) return 0; // Not a constant?, can't fold + /* FALL THROUGH */ case 1: Op0 = dyn_cast(I->getOperand(0)); if (Op0 == 0) return 0; // Not a constant?, can't fold @@ -79,13 +80,14 @@ } if (isa(I) || isa(I)) { - if (Constant *Op0 = dyn_cast(I->getOperand(0))) - if (Constant *Op1 = dyn_cast(I->getOperand(1))) - return ConstantExpr::get(I->getOpcode(), Op0, Op1); - return 0; // Operands not constants. + return ConstantExpr::get(I->getOpcode(), Op0, Op1); + } else if (isa(I)) { + return ConstantExpr::getICmp(cast(I)->getPredicate(), Op0, Op1); + } else if (isa(I)) { + return ConstantExpr::getFCmp(cast(I)->getPredicate(), Op0, Op1); } - // Scan the operand list, checking to see if the are all constants, if so, + // Scan the operand list, checking to see if they are all constants, if so, // hand off to ConstantFoldInstOperands. std::vector Ops; for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) @@ -94,7 +96,7 @@ else return 0; // All operands not constant! - return ConstantFoldInstOperands(I->getOpcode(), I->getType(), Ops); + return ConstantFoldInstOperands(I, Ops); } /// ConstantFoldInstOperands - Attempt to constant fold an instruction with the @@ -103,9 +105,13 @@ /// attempting to fold instructions like loads and stores, which have no /// constant expression form. /// -Constant *llvm::ConstantFoldInstOperands(unsigned Opc, const Type *DestTy, +Constant *llvm::ConstantFoldInstOperands(const Instruction* I, const std::vector &Ops) { - if (Opc >= Instruction::BinaryOpsBegin && Opc < Instruction::BinaryOpsEnd) + unsigned Opc = I->getOpcode(); + const Type *DestTy = I->getType(); + + // Handle easy binops first + if (isa(I)) return ConstantExpr::get(Opc, Ops[0], Ops[1]); switch (Opc) { @@ -118,6 +124,10 @@ } } return 0; + case Instruction::ICmp: + case Instruction::FCmp: + return ConstantExpr::getCompare(cast(I)->getPredicate(), Ops[0], + Ops[1]); case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: @@ -257,8 +267,8 @@ } else if (SI->getNumSuccessors() == 2) { // Otherwise, we can fold this switch into a conditional branch // instruction if it has only one non-default destination. - Value *Cond = new SetCondInst(Instruction::SetEQ, SI->getCondition(), - SI->getSuccessorValue(1), "cond", SI); + Value *Cond = new ICmpInst(ICmpInst::ICMP_EQ, SI->getCondition(), + SI->getSuccessorValue(1), "cond", SI); // Insert the new branch... new BranchInst(SI->getSuccessor(1), SI->getSuccessor(0), Cond, SI); Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.47 llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.48 --- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.47 Tue Dec 19 16:17:40 2006 +++ llvm/lib/Transforms/Utils/LowerInvoke.cpp Sat Dec 23 00:05:41 2006 @@ -517,9 +517,9 @@ EntryBB->getTerminator()); // Compare the return value to zero. - Value *IsNormal = BinaryOperator::createSetEQ(SJRet, - Constant::getNullValue(SJRet->getType()), - "notunwind", EntryBB->getTerminator()); + Value *IsNormal = new ICmpInst(ICmpInst::ICMP_EQ, SJRet, + Constant::getNullValue(SJRet->getType()), + "notunwind", EntryBB->getTerminator()); // Nuke the uncond branch. EntryBB->getTerminator()->eraseFromParent(); @@ -551,9 +551,9 @@ } // Load the JBList, if it's null, then there was no catch! - Value *NotNull = BinaryOperator::createSetNE(BufPtr, - Constant::getNullValue(BufPtr->getType()), - "notnull", UnwindHandler); + Value *NotNull = new ICmpInst(ICmpInst::ICMP_NE, BufPtr, + Constant::getNullValue(BufPtr->getType()), + "notnull", UnwindHandler); new BranchInst(UnwindBlock, TermBlock, NotNull, UnwindHandler); // Create the block to do the longjmp. Index: llvm/lib/Transforms/Utils/LowerSwitch.cpp diff -u llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.30 llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.31 --- llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.30 Tue Dec 19 16:17:40 2006 +++ llvm/lib/Transforms/Utils/LowerSwitch.cpp Sat Dec 23 00:05:41 2006 @@ -143,8 +143,7 @@ BasicBlock* NewNode = new BasicBlock("NodeBlock"); F->getBasicBlockList().insert(OrigBlock->getNext(), NewNode); - SetCondInst* Comp = new SetCondInst(Instruction::SetLT, Val, Pivot.first, - "Pivot"); + ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_ULT, Val, Pivot.first, "Pivot"); NewNode->getInstList().push_back(Comp); new BranchInst(LBranch, RBranch, Comp, NewNode); return NewNode; @@ -165,8 +164,8 @@ F->getBasicBlockList().insert(OrigBlock->getNext(), NewLeaf); // Make the seteq instruction... - SetCondInst* Comp = new SetCondInst(Instruction::SetEQ, Val, - Leaf.first, "SwitchLeaf"); + ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_EQ, Val, + Leaf.first, "SwitchLeaf"); NewLeaf->getInstList().push_back(Comp); // Make the conditional branch... Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.107 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.108 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.107 Sun Nov 26 19:05:10 2006 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Sat Dec 23 00:05:41 2006 @@ -369,12 +369,8 @@ case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: - case Instruction::SetEQ: - case Instruction::SetNE: - case Instruction::SetLT: - case Instruction::SetGT: - case Instruction::SetLE: - case Instruction::SetGE: + case Instruction::ICmp: + case Instruction::FCmp: break; // These are all cheap and non-trapping instructions. } @@ -390,12 +386,13 @@ return true; } -// GatherConstantSetEQs - Given a potentially 'or'd together collection of seteq -// instructions that compare a value against a constant, return the value being -// compared, and stick the constant into the Values vector. +// GatherConstantSetEQs - Given a potentially 'or'd together collection of +// icmp_eq instructions that compare a value against a constant, return the +// value being compared, and stick the constant into the Values vector. static Value *GatherConstantSetEQs(Value *V, std::vector &Values){ if (Instruction *Inst = dyn_cast(V)) - if (Inst->getOpcode() == Instruction::SetEQ) { + if (Inst->getOpcode() == Instruction::ICmp && + cast(Inst)->getPredicate() == ICmpInst::ICMP_EQ) { if (ConstantInt *C = dyn_cast(Inst->getOperand(1))) { Values.push_back(C); return Inst->getOperand(0); @@ -417,7 +414,8 @@ // being compared, and stick the constant into the Values vector. static Value *GatherConstantSetNEs(Value *V, std::vector &Values){ if (Instruction *Inst = dyn_cast(V)) - if (Inst->getOpcode() == Instruction::SetNE) { + if (Inst->getOpcode() == Instruction::ICmp && + cast(Inst)->getPredicate() == ICmpInst::ICMP_NE) { if (ConstantInt *C = dyn_cast(Inst->getOperand(1))) { Values.push_back(C); return Inst->getOperand(0); @@ -503,11 +501,11 @@ } if (BranchInst *BI = dyn_cast(TI)) if (BI->isConditional() && BI->getCondition()->hasOneUse()) - if (SetCondInst *SCI = dyn_cast(BI->getCondition())) - if ((SCI->getOpcode() == Instruction::SetEQ || - SCI->getOpcode() == Instruction::SetNE) && - isa(SCI->getOperand(1))) - return SCI->getOperand(0); + if (ICmpInst *ICI = dyn_cast(BI->getCondition())) + if ((ICI->getPredicate() == ICmpInst::ICMP_EQ || + ICI->getPredicate() == ICmpInst::ICMP_NE) && + isa(ICI->getOperand(1))) + return ICI->getOperand(0); return 0; } @@ -525,11 +523,11 @@ } BranchInst *BI = cast(TI); - SetCondInst *SCI = cast(BI->getCondition()); - Cases.push_back(std::make_pair(cast(SCI->getOperand(1)), - BI->getSuccessor(SCI->getOpcode() == - Instruction::SetNE))); - return BI->getSuccessor(SCI->getOpcode() == Instruction::SetEQ); + ICmpInst *ICI = cast(BI->getCondition()); + Cases.push_back(std::make_pair(cast(ICI->getOperand(1)), + BI->getSuccessor(ICI->getPredicate() == + ICmpInst::ICMP_NE))); + return BI->getSuccessor(ICI->getPredicate() == ICmpInst::ICMP_EQ); } @@ -847,8 +845,8 @@ BasicBlock *BB2 = BI->getSuccessor(1); // The false destination Instruction *I1 = BB1->begin(), *I2 = BB2->begin(); - if (I1->getOpcode() != I2->getOpcode() || !I1->isIdenticalTo(I2) || - isa(I1) || isa(I1)) + if (I1->getOpcode() != I2->getOpcode() || isa(I1) || + isa(I1) || !I1->isIdenticalTo(I2)) return false; // If we get here, we can hoist at least one instruction. @@ -1443,8 +1441,9 @@ // predecessor and use logical operations to pick the right destination. BasicBlock *TrueDest = BI->getSuccessor(0); BasicBlock *FalseDest = BI->getSuccessor(1); - if (BinaryOperator *Cond = dyn_cast(BI->getCondition())) - if (Cond->getParent() == BB && &BB->front() == Cond && + if (Instruction *Cond = dyn_cast(BI->getCondition())) + if ((isa(Cond) || isa(Cond)) && + Cond->getParent() == BB && &BB->front() == Cond && Cond->getNext() == BI && Cond->hasOneUse() && TrueDest != BB && FalseDest != BB) for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI!=E; ++PI) From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Utils/Local.h Message-ID: <200612230607.kBN670xv022199@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms/Utils: Local.h updated: 1.23 -> 1.24 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+9 -7) Local.h | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) Index: llvm/include/llvm/Transforms/Utils/Local.h diff -u llvm/include/llvm/Transforms/Utils/Local.h:1.23 llvm/include/llvm/Transforms/Utils/Local.h:1.24 --- llvm/include/llvm/Transforms/Utils/Local.h:1.23 Fri May 26 20:17:40 2006 +++ llvm/include/llvm/Transforms/Utils/Local.h Sat Dec 23 00:05:40 2006 @@ -49,13 +49,15 @@ Constant *ConstantFoldInstruction(Instruction *I); /// ConstantFoldInstOperands - Attempt to constant fold an instruction with the -/// specified opcode and operands. If successful, the constant result is -/// returned, if not, null is returned. Note that this function can fail when -/// attempting to fold instructions like loads and stores, which have no -/// constant expression form. -/// -Constant *ConstantFoldInstOperands(unsigned Opc, const Type *DestTy, - const std::vector &Ops); +/// specified operands. If successful, the constant result is returned, if not, +/// null is returned. Note that this function can fail when attempting to +/// fold instructions like loads and stores, which have no constant expression +/// form. +/// +Constant *ConstantFoldInstOperands( + const Instruction *I, ///< The model instruction + const std::vector &Ops ///< The constant operands to use. +); /// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a From reid at x10sys.com Sat Dec 23 00:06:54 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/Andersens.cpp GlobalsModRef.cpp Message-ID: <200612230606.kBN66s0M022003@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: Andersens.cpp updated: 1.41 -> 1.42 GlobalsModRef.cpp updated: 1.26 -> 1.27 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+6 -3) Andersens.cpp | 5 ++++- GlobalsModRef.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/lib/Analysis/IPA/Andersens.cpp diff -u llvm/lib/Analysis/IPA/Andersens.cpp:1.41 llvm/lib/Analysis/IPA/Andersens.cpp:1.42 --- llvm/lib/Analysis/IPA/Andersens.cpp:1.41 Tue Dec 19 16:30:33 2006 +++ llvm/lib/Analysis/IPA/Andersens.cpp Sat Dec 23 00:05:40 2006 @@ -325,7 +325,8 @@ void visitGetElementPtrInst(GetElementPtrInst &GEP); void visitPHINode(PHINode &PN); void visitCastInst(CastInst &CI); - void visitSetCondInst(SetCondInst &SCI) {} // NOOP! + void visitICmpInst(ICmpInst &ICI) {} // NOOP! + void visitFCmpInst(FCmpInst &ICI) {} // NOOP! void visitSelectInst(SelectInst &SI); void visitVAArg(VAArgInst &I); void visitInstruction(Instruction &I); @@ -778,6 +779,8 @@ case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: + case Instruction::ICmp: + case Instruction::FCmp: return; default: // Is this something we aren't handling yet? Index: llvm/lib/Analysis/IPA/GlobalsModRef.cpp diff -u llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.26 llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.27 --- llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.26 Tue Dec 19 16:30:33 2006 +++ llvm/lib/Analysis/IPA/GlobalsModRef.cpp Sat Dec 23 00:05:40 2006 @@ -251,8 +251,8 @@ } else { return true; } - } else if (SetCondInst *SCI = dyn_cast(*UI)) { - if (!isa(SCI->getOperand(1))) + } else if (ICmpInst *ICI = dyn_cast(*UI)) { + if (!isa(ICI->getOperand(1))) return true; // Allow comparison against null. } else if (FreeInst *F = dyn_cast(*UI)) { Writers.push_back(F->getParent()->getParent()); From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll 2006-12-15-Range-Test.ll 2006-12-08-Phi-ICmp-Op-Fold.ll JavaCompare.ll cast.ll set.ll setcc-strength-reduce.ll Message-ID: <200612230607.kBN670Kn022194@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2006-12-10-ICmp-GEP-GEP.ll added (r1.1) 2006-12-15-Range-Test.ll added (r1.1) 2006-12-08-Phi-ICmp-Op-Fold.ll updated: 1.1 -> 1.2 JavaCompare.ll updated: 1.4 -> 1.5 cast.ll updated: 1.35 -> 1.36 set.ll updated: 1.20 -> 1.21 setcc-strength-reduce.ll updated: 1.7 -> 1.8 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+207 -9) 2006-12-08-Phi-ICmp-Op-Fold.ll | 2 2006-12-10-ICmp-GEP-GEP.ll | 165 +++++++++++++++++++++++++++++++++++++++++ 2006-12-15-Range-Test.ll | 32 +++++++ JavaCompare.ll | 2 cast.ll | 11 +- set.ll | 2 setcc-strength-reduce.ll | 2 7 files changed, 207 insertions(+), 9 deletions(-) Index: llvm/test/Regression/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll:1.1 *** /dev/null Sat Dec 23 00:05:51 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll Sat Dec 23 00:05:41 2006 *************** *** 0 **** --- 1,165 ---- + ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ + ; RUN: grep -v 'icmp ult int' + ; ModuleID = 'good.bc' + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + %struct.edgeBox = type { short, short, short, short, short, short } + %qsz = external global int ; [#uses=12] + %thresh = external global int ; [#uses=2] + %mthresh = external global int ; [#uses=1] + + implementation ; Functions: + + int %qsorte(sbyte* %base, int %n, int %size) { + entry: + %tmp = setgt int %n, 1 ; [#uses=1] + br bool %tmp, label %cond_next, label %return + + cond_next: ; preds = %entry + store int %size, int* %qsz + %tmp3 = shl int %size, ubyte 2 ; [#uses=1] + store int %tmp3, int* %thresh + %tmp4 = load int* %qsz ; [#uses=1] + %tmp5 = mul int %tmp4, 6 ; [#uses=1] + store int %tmp5, int* %mthresh + %tmp6 = load int* %qsz ; [#uses=1] + %tmp8 = mul int %tmp6, %n ; [#uses=1] + %tmp9 = getelementptr sbyte* %base, int %tmp8 ; [#uses=3] + %tmp11 = setgt int %n, 3 ; [#uses=1] + br bool %tmp11, label %cond_true12, label %bb30 + + cond_true12: ; preds = %cond_next + %tmp156 = call int %qste( sbyte* %base, sbyte* %tmp9 ) ; [#uses=0] + %tmp16 = load int* %thresh ; [#uses=1] + %tmp18 = getelementptr sbyte* %base, int %tmp16 ; [#uses=2] + %tmp3117 = load int* %qsz ; [#uses=1] + %tmp3318 = getelementptr sbyte* %base, int %tmp3117 ; [#uses=2] + %tmp3621 = setlt sbyte* %tmp3318, %tmp18 ; [#uses=1] + br bool %tmp3621, label %bb, label %bb37 + + bb: ; preds = %bb30, %cond_true12 + %hi.0.0 = phi sbyte* [ %tmp18, %cond_true12 ], [ %hi.0, %bb30 ] ; [#uses=4] + %j.1.0 = phi sbyte* [ %base, %cond_true12 ], [ %j.1, %bb30 ] ; [#uses=4] + %tmp33.0 = phi sbyte* [ %tmp3318, %cond_true12 ], [ %tmp33, %bb30 ] ; [#uses=6] + %tmp3 = bitcast sbyte* %j.1.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] + %tmp4 = bitcast sbyte* %tmp33.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] + %tmp255 = call int %comparee( %struct.edgeBox* %tmp3, %struct.edgeBox* %tmp4 ) ; [#uses=1] + %tmp26 = setgt int %tmp255, 0 ; [#uses=1] + br bool %tmp26, label %cond_true27, label %bb30 + + cond_true27: ; preds = %bb + br label %bb30 + + bb30: ; preds = %cond_true27, %bb, %cond_next + %hi.0.3 = phi sbyte* [ %hi.0.0, %cond_true27 ], [ %hi.0.0, %bb ], [ undef, %cond_next ] ; [#uses=0] + %j.1.3 = phi sbyte* [ %j.1.0, %cond_true27 ], [ %j.1.0, %bb ], [ undef, %cond_next ] ; [#uses=0] + %tmp33.3 = phi sbyte* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ undef, %cond_next ] ; [#uses=0] + %hi.0 = phi sbyte* [ %tmp9, %cond_next ], [ %hi.0.0, %bb ], [ %hi.0.0, %cond_true27 ] ; [#uses=2] + %lo.1 = phi sbyte* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ %base, %cond_next ] ; [#uses=1] + %j.1 = phi sbyte* [ %tmp33.0, %cond_true27 ], [ %j.1.0, %bb ], [ %base, %cond_next ] ; [#uses=2] + %tmp31 = load int* %qsz ; [#uses=1] + %tmp33 = getelementptr sbyte* %lo.1, int %tmp31 ; [#uses=2] + %tmp36 = setlt sbyte* %tmp33, %hi.0 ; [#uses=1] + br bool %tmp36, label %bb, label %bb37 + + bb37: ; preds = %bb30, %cond_true12 + %j.1.1 = phi sbyte* [ %j.1, %bb30 ], [ %base, %cond_true12 ] ; [#uses=4] + %tmp40 = seteq sbyte* %j.1.1, %base ; [#uses=1] + br bool %tmp40, label %bb115, label %cond_true41 + + cond_true41: ; preds = %bb37 + %tmp43 = load int* %qsz ; [#uses=1] + %tmp45 = getelementptr sbyte* %base, int %tmp43 ; [#uses=2] + %tmp6030 = setlt sbyte* %base, %tmp45 ; [#uses=1] + br bool %tmp6030, label %bb46, label %bb115 + + bb46: ; preds = %bb46, %cond_true41 + %j.2.0 = phi sbyte* [ %j.1.1, %cond_true41 ], [ %tmp52, %bb46 ] ; [#uses=3] + %i.2.0 = phi sbyte* [ %base, %cond_true41 ], [ %tmp56, %bb46 ] ; [#uses=3] + %tmp = load sbyte* %j.2.0 ; [#uses=2] + %tmp49 = load sbyte* %i.2.0 ; [#uses=1] + store sbyte %tmp49, sbyte* %j.2.0 + %tmp52 = getelementptr sbyte* %j.2.0, int 1 ; [#uses=2] + store sbyte %tmp, sbyte* %i.2.0 + %tmp56 = getelementptr sbyte* %i.2.0, int 1 ; [#uses=3] + %tmp60 = setlt sbyte* %tmp56, %tmp45 ; [#uses=1] + br bool %tmp60, label %bb46, label %bb115 + + bb66: ; preds = %bb115, %bb66 + %hi.3 = phi sbyte* [ %tmp118, %bb115 ], [ %tmp70, %bb66 ] ; [#uses=2] + %tmp67 = load int* %qsz ; [#uses=2] + %tmp68 = sub int 0, %tmp67 ; [#uses=1] + %tmp70 = getelementptr sbyte* %hi.3, int %tmp68 ; [#uses=2] + %tmp = bitcast sbyte* %tmp70 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] + %tmp1 = bitcast sbyte* %tmp118 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] + %tmp732 = call int %comparee( %struct.edgeBox* %tmp, %struct.edgeBox* %tmp1 ) ; [#uses=1] + %tmp74 = setgt int %tmp732, 0 ; [#uses=1] + br bool %tmp74, label %bb66, label %bb75 + + bb75: ; preds = %bb66 + %tmp76 = load int* %qsz ; [#uses=1] + %tmp70.sum = sub int %tmp76, %tmp67 ; [#uses=1] + %tmp78 = getelementptr sbyte* %hi.3, int %tmp70.sum ; [#uses=3] + %tmp81 = seteq sbyte* %tmp78, %tmp118 ; [#uses=1] + br bool %tmp81, label %bb115, label %cond_true82 + + cond_true82: ; preds = %bb75 + %tmp83 = load int* %qsz ; [#uses=1] + %tmp118.sum = add int %tmp116, %tmp83 ; [#uses=1] + %tmp85 = getelementptr sbyte* %min.1, int %tmp118.sum ; [#uses=1] + %tmp10937 = getelementptr sbyte* %tmp85, int -1 ; [#uses=3] + %tmp11239 = setlt sbyte* %tmp10937, %tmp118 ; [#uses=1] + br bool %tmp11239, label %bb115, label %bb86 + + bb86: ; preds = %bb104, %cond_true82 + %tmp109.0 = phi sbyte* [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ] ; [#uses=5] + %i.5.2 = phi sbyte* [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ] ; [#uses=0] + %tmp100.2 = phi sbyte* [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ] ; [#uses=0] + %tmp88 = load sbyte* %tmp109.0 ; [#uses=2] + %tmp9746 = load int* %qsz ; [#uses=1] + %tmp9847 = sub int 0, %tmp9746 ; [#uses=1] + %tmp10048 = getelementptr sbyte* %tmp109.0, int %tmp9847 ; [#uses=3] + %tmp10350 = setlt sbyte* %tmp10048, %tmp78 ; [#uses=1] + br bool %tmp10350, label %bb104, label %bb91 + + bb91: ; preds = %bb91, %bb86 + %i.5.0 = phi sbyte* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; [#uses=1] + %tmp100.0 = phi sbyte* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; [#uses=4] + %tmp93 = load sbyte* %tmp100.0 ; [#uses=1] + store sbyte %tmp93, sbyte* %i.5.0 + %tmp97 = load int* %qsz ; [#uses=1] + %tmp98 = sub int 0, %tmp97 ; [#uses=1] + %tmp100 = getelementptr sbyte* %tmp100.0, int %tmp98 ; [#uses=3] + %tmp103 = setlt sbyte* %tmp100, %tmp78 ; [#uses=1] + br bool %tmp103, label %bb104, label %bb91 + + bb104: ; preds = %bb91, %bb86 + %i.5.1 = phi sbyte* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; [#uses=4] + %tmp100.1 = phi sbyte* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; [#uses=3] + store sbyte %tmp88, sbyte* %i.5.1 + %tmp109 = getelementptr sbyte* %tmp109.0, int -1 ; [#uses=3] + %tmp112 = setlt sbyte* %tmp109, %tmp118 ; [#uses=1] + br bool %tmp112, label %bb115, label %bb86 + + bb115: ; preds = %bb104, %cond_true82, %bb75, %bb46, %cond_true41, %bb37 + %tmp109.1 = phi sbyte* [ undef, %bb37 ], [ %tmp109.1, %bb75 ], [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; [#uses=1] + %i.5.3 = phi sbyte* [ undef, %bb37 ], [ %i.5.3, %bb75 ], [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; [#uses=3] + %tmp100.3 = phi sbyte* [ undef, %bb37 ], [ %tmp100.3, %bb75 ], [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; [#uses=3] + %min.1 = phi sbyte* [ %tmp118, %bb104 ], [ %tmp118, %bb75 ], [ %base, %bb37 ], [ %base, %bb46 ], [ %base, %cond_true41 ], [ %tmp118, %cond_true82 ] ; [#uses=2] + %j.5 = phi sbyte* [ %tmp100.1, %bb104 ], [ %j.5, %bb75 ], [ %tmp52, %bb46 ], [ %j.1.1, %bb37 ], [ %j.1.1, %cond_true41 ], [ %j.5, %cond_true82 ] ; [#uses=2] + %i.4 = phi sbyte* [ %i.5.1, %bb104 ], [ %i.4, %bb75 ], [ %tmp56, %bb46 ], [ undef, %bb37 ], [ %base, %cond_true41 ], [ %i.4, %cond_true82 ] ; [#uses=2] + %c.4 = phi sbyte [ %tmp88, %bb104 ], [ %c.4, %bb75 ], [ %tmp, %bb46 ], [ undef, %bb37 ], [ undef, %cond_true41 ], [ %c.4, %cond_true82 ] ; [#uses=2] + %tmp116 = load int* %qsz ; [#uses=2] + %tmp118 = getelementptr sbyte* %min.1, int %tmp116 ; [#uses=9] + %tmp122 = setlt sbyte* %tmp118, %tmp9 ; [#uses=1] + br bool %tmp122, label %bb66, label %return + + return: ; preds = %bb115, %entry + ret int undef + } + + declare int %qste(sbyte*, sbyte*) + + declare int %comparee(%struct.edgeBox*, %struct.edgeBox*) Index: llvm/test/Regression/Transforms/InstCombine/2006-12-15-Range-Test.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-12-15-Range-Test.ll:1.1 *** /dev/null Sat Dec 23 00:07:00 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-12-15-Range-Test.ll Sat Dec 23 00:05:41 2006 *************** *** 0 **** --- 1,32 ---- + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'icmp' | wc -l | grep 1 + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'icmp ugt' | wc -l | grep 1 + ; ModuleID = 'bugpoint-tooptimize.bc' + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + %r = external global [17 x int] ; <[17 x int]*> [#uses=1] + + implementation ; Functions: + + bool %print_pgm_cond_true(int %tmp12.reload, int* %tmp16.out) { + newFuncRoot: + br label %cond_true + + bb27.exitStub: ; preds = %cond_true + store int %tmp16, int* %tmp16.out + ret bool true + + cond_next23.exitStub: ; preds = %cond_true + store int %tmp16, int* %tmp16.out + ret bool false + + cond_true: ; preds = %newFuncRoot + %tmp15 = getelementptr [17 x int]* %r, int 0, int %tmp12.reload ; [#uses=1] + %tmp16 = load int* %tmp15 ; [#uses=4] + %tmp18 = icmp slt int %tmp16, -31 ; [#uses=1] + %tmp21 = icmp sgt int %tmp16, 31 ; [#uses=1] + %bothcond = or bool %tmp18, %tmp21 ; [#uses=1] + br bool %bothcond, label %bb27.exitStub, label %cond_next23.exitStub + } + Index: llvm/test/Regression/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll diff -u llvm/test/Regression/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll:1.1 llvm/test/Regression/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll:1.2 --- llvm/test/Regression/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll:1.1 Fri Dec 8 23:13:01 2006 +++ llvm/test/Regression/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll Sat Dec 23 00:05:41 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'setlt' +; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis|grep 'icmp slt' ; ModuleID = 'visible.bc' target datalayout = "e-p:32:32" target endian = little Index: llvm/test/Regression/Transforms/InstCombine/JavaCompare.ll diff -u llvm/test/Regression/Transforms/InstCombine/JavaCompare.ll:1.4 llvm/test/Regression/Transforms/InstCombine/JavaCompare.ll:1.5 --- llvm/test/Regression/Transforms/InstCombine/JavaCompare.ll:1.4 Fri Dec 8 23:13:50 2006 +++ llvm/test/Regression/Transforms/InstCombine/JavaCompare.ll Sat Dec 23 00:05:41 2006 @@ -1,7 +1,7 @@ ; This is the sequence of stuff that the Java front-end expands for a single ; <= comparison. Check to make sure we turn it into a <= (only) -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v 'setle'| not grep '#uses' +; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v 'icmp sle'| not grep '#uses' bool %le(int %A, int %B) { %c1 = setgt int %A, %B; Index: llvm/test/Regression/Transforms/InstCombine/cast.ll diff -u llvm/test/Regression/Transforms/InstCombine/cast.ll:1.35 llvm/test/Regression/Transforms/InstCombine/cast.ll:1.36 --- llvm/test/Regression/Transforms/InstCombine/cast.ll:1.35 Fri Dec 1 22:23:09 2006 +++ llvm/test/Regression/Transforms/InstCombine/cast.ll Sat Dec 23 00:05:41 2006 @@ -93,11 +93,12 @@ ret bool %X } -bool %test15(ubyte %A) { - %c = cast ubyte %A to sbyte - %X = setlt sbyte %c, 0 ; setgt %A, 127 - ret bool %X -} +; This just won't occur when there's no difference between ubyte and sbyte +;bool %test15(ubyte %A) { +; %c = cast ubyte %A to sbyte +; %X = setlt sbyte %c, 0 ; setgt %A, 127 +; ret bool %X +;} bool %test16(int* %P) { %c = cast int* %P to bool ;; setne P, null Index: llvm/test/Regression/Transforms/InstCombine/set.ll diff -u llvm/test/Regression/Transforms/InstCombine/set.ll:1.20 llvm/test/Regression/Transforms/InstCombine/set.ll:1.21 --- llvm/test/Regression/Transforms/InstCombine/set.ll:1.20 Fri Dec 1 22:23:09 2006 +++ llvm/test/Regression/Transforms/InstCombine/set.ll Sat Dec 23 00:05:41 2006 @@ -1,7 +1,7 @@ ; This test makes sure that these instructions are properly eliminated. ; ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output && -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep set +; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep icmp %X = uninitialized global int Index: llvm/test/Regression/Transforms/InstCombine/setcc-strength-reduce.ll diff -u llvm/test/Regression/Transforms/InstCombine/setcc-strength-reduce.ll:1.7 llvm/test/Regression/Transforms/InstCombine/setcc-strength-reduce.ll:1.8 --- llvm/test/Regression/Transforms/InstCombine/setcc-strength-reduce.ll:1.7 Fri Dec 1 22:23:09 2006 +++ llvm/test/Regression/Transforms/InstCombine/setcc-strength-reduce.ll Sat Dec 23 00:05:41 2006 @@ -3,7 +3,7 @@ ; into equivalent setne,eq instructions. ; -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v seteq | grep -v setne | not grep set +; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v 'icmp eq' | grep -v 'icmp ne' | not grep icmp bool %test1(uint %A) { %B = setge uint %A, 1 ; setne %A, 0 From reid at x10sys.com Sat Dec 23 00:06:58 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp Message-ID: <200612230606.kBN66wa3022032@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.53 -> 1.54 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+2 -2) IntrinsicLowering.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.53 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.54 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.53 Thu Dec 21 02:28:31 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sat Dec 23 00:05:40 2006 @@ -432,8 +432,8 @@ Value *L = CI->getOperand(1); Value *R = CI->getOperand(2); - Value *LIsNan = new SetCondInst(Instruction::SetNE, L, L, "LIsNan", CI); - Value *RIsNan = new SetCondInst(Instruction::SetNE, R, R, "RIsNan", CI); + Value *LIsNan = new FCmpInst(FCmpInst::FCMP_ONE, L, L, "LIsNan", CI); + Value *RIsNan = new FCmpInst(FCmpInst::FCMP_ONE, R, R, "RIsNan", CI); CI->replaceAllUsesWith( BinaryOperator::create(Instruction::Or, LIsNan, RIsNan, "isunordered", CI)); From reid at x10sys.com Sat Dec 23 00:06:59 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:59 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h InstrTypes.h Instruction.def Instruction.h Instructions.h Pass.h Message-ID: <200612230606.kBN66xmB022083@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.111 -> 1.112 InstrTypes.h updated: 1.55 -> 1.56 Instruction.def updated: 1.27 -> 1.28 Instruction.h updated: 1.76 -> 1.77 Instructions.h updated: 1.47 -> 1.48 Pass.h updated: 1.66 -> 1.67 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+96 -134) Constants.h | 13 +------ InstrTypes.h | 14 +++++++ Instruction.def | 86 ++++++++++++++++++++++-------------------------- Instruction.h | 16 +++++---- Instructions.h | 99 ++++++++++++++++---------------------------------------- Pass.h | 2 - 6 files changed, 96 insertions(+), 134 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.111 llvm/include/llvm/Constants.h:1.112 --- llvm/include/llvm/Constants.h:1.111 Mon Dec 18 19:34:39 2006 +++ llvm/include/llvm/Constants.h Sat Dec 23 00:05:40 2006 @@ -496,8 +496,8 @@ // ConstantExprs in intermediate forms. static Constant *getTy(const Type *Ty, unsigned Opcode, Constant *C1, Constant *C2); - static Constant *getCompareTy(unsigned Opcode, unsigned short pred, - Constant *C1, Constant *C2); + static Constant *getCompareTy(unsigned short pred, Constant *C1, + Constant *C2); static Constant *getShiftTy(const Type *Ty, unsigned Opcode, Constant *C1, Constant *C2); static Constant *getSelectTy(const Type *Ty, @@ -604,8 +604,7 @@ static Constant *get(unsigned Opcode, Constant *C1, Constant *C2); /// @brief Return an ICmp or FCmp comparison operator constant expression. - static Constant *getCompare(unsigned Opcode, unsigned short pred, - Constant *C1, Constant *C2); + static Constant *getCompare(unsigned short pred, Constant *C1, Constant *C2); /// ConstantExpr::get* - Return some common constants without having to /// specify the full Instruction::OPCODE identifier. @@ -624,12 +623,6 @@ static Constant *getAnd(Constant *C1, Constant *C2); static Constant *getOr(Constant *C1, Constant *C2); static Constant *getXor(Constant *C1, Constant *C2); - static Constant *getSetEQ(Constant *C1, Constant *C2); - static Constant *getSetNE(Constant *C1, Constant *C2); - static Constant *getSetLT(Constant *C1, Constant *C2); - static Constant *getSetGT(Constant *C1, Constant *C2); - static Constant *getSetLE(Constant *C1, Constant *C2); - static Constant *getSetGE(Constant *C1, Constant *C2); static Constant* getICmp(unsigned short pred, Constant* LHS, Constant* RHS); static Constant* getFCmp(unsigned short pred, Constant* LHS, Constant* RHS); static Constant *getShl(Constant *C1, Constant *C2); Index: llvm/include/llvm/InstrTypes.h diff -u llvm/include/llvm/InstrTypes.h:1.55 llvm/include/llvm/InstrTypes.h:1.56 --- llvm/include/llvm/InstrTypes.h:1.55 Mon Dec 18 02:52:59 2006 +++ llvm/include/llvm/InstrTypes.h Sat Dec 23 00:05:40 2006 @@ -543,6 +543,20 @@ /// @brief Determine if this is an equals/not equals predicate. bool isEquality(); + /// @returns true if the predicate is unsigned, false otherwise. + /// @brief Determine if the predicate is an unsigned operation. + static bool isUnsigned(unsigned short predicate); + + /// @returns true if the predicate is signed, false otherwise. + /// @brief Determine if the predicate is an signed operation. + static bool isSigned(unsigned short predicate); + + /// @brief Determine if the predicate is an ordered operation. + static bool isOrdered(unsigned short predicate); + + /// @brief Determine if the predicate is an unordered operation. + static bool isUnordered(unsigned short predicate); + /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const CmpInst *) { return true; } static inline bool classof(const Instruction *I) { Index: llvm/include/llvm/Instruction.def diff -u llvm/include/llvm/Instruction.def:1.27 llvm/include/llvm/Instruction.def:1.28 --- llvm/include/llvm/Instruction.def:1.27 Wed Nov 29 15:37:00 2006 +++ llvm/include/llvm/Instruction.def Sat Dec 23 00:05:40 2006 @@ -118,61 +118,53 @@ HANDLE_BINARY_INST(16, And , BinaryOperator) HANDLE_BINARY_INST(17, Or , BinaryOperator) HANDLE_BINARY_INST(18, Xor , BinaryOperator) - -// Binary comparison operators... -HANDLE_BINARY_INST(19, SetEQ , SetCondInst) -HANDLE_BINARY_INST(20, SetNE , SetCondInst) -HANDLE_BINARY_INST(21, SetLE , SetCondInst) -HANDLE_BINARY_INST(22, SetGE , SetCondInst) -HANDLE_BINARY_INST(23, SetLT , SetCondInst) -HANDLE_BINARY_INST(24, SetGT , SetCondInst) - LAST_BINARY_INST(24) + LAST_BINARY_INST(18) // Memory operators... - FIRST_MEMORY_INST(25) -HANDLE_MEMORY_INST(25, Malloc, MallocInst) // Heap management instructions -HANDLE_MEMORY_INST(26, Free , FreeInst ) -HANDLE_MEMORY_INST(27, Alloca, AllocaInst) // Stack management -HANDLE_MEMORY_INST(28, Load , LoadInst ) // Memory manipulation instrs -HANDLE_MEMORY_INST(29, Store , StoreInst ) -HANDLE_MEMORY_INST(30, GetElementPtr, GetElementPtrInst) - LAST_MEMORY_INST(30) + FIRST_MEMORY_INST(19) +HANDLE_MEMORY_INST(19, Malloc, MallocInst) // Heap management instructions +HANDLE_MEMORY_INST(20, Free , FreeInst ) +HANDLE_MEMORY_INST(21, Alloca, AllocaInst) // Stack management +HANDLE_MEMORY_INST(22, Load , LoadInst ) // Memory manipulation instrs +HANDLE_MEMORY_INST(23, Store , StoreInst ) +HANDLE_MEMORY_INST(24, GetElementPtr, GetElementPtrInst) + LAST_MEMORY_INST(24) // Cast operators ... // NOTE: The order matters here because CastInst::isEliminableCastPair // NOTE: (see Instructions.cpp) encodes a table based on this ordering. - FIRST_CAST_INST(31) -HANDLE_CAST_INST(31, Trunc , TruncInst ) // Truncate integers -HANDLE_CAST_INST(32, ZExt , ZExtInst ) // Zero extend integers -HANDLE_CAST_INST(33, SExt , SExtInst ) // Sign extend integers -HANDLE_CAST_INST(34, FPToUI , FPToUIInst ) // floating point -> UInt -HANDLE_CAST_INST(35, FPToSI , FPToSIInst ) // floating point -> SInt -HANDLE_CAST_INST(36, UIToFP , UIToFPInst ) // UInt -> floating point -HANDLE_CAST_INST(37, SIToFP , SIToFPInst ) // SInt -> floating point -HANDLE_CAST_INST(38, FPTrunc , FPTruncInst ) // Truncate floating point -HANDLE_CAST_INST(39, FPExt , FPExtInst ) // Extend floating point -HANDLE_CAST_INST(40, PtrToInt, PtrToIntInst) // Pointer -> Integer -HANDLE_CAST_INST(41, IntToPtr, IntToPtrInst) // Integer -> Pointer -HANDLE_CAST_INST(42, BitCast , BitCastInst ) // Type cast - LAST_CAST_INST(42) + FIRST_CAST_INST(25) +HANDLE_CAST_INST(25, Trunc , TruncInst ) // Truncate integers +HANDLE_CAST_INST(26, ZExt , ZExtInst ) // Zero extend integers +HANDLE_CAST_INST(27, SExt , SExtInst ) // Sign extend integers +HANDLE_CAST_INST(28, FPToUI , FPToUIInst ) // floating point -> UInt +HANDLE_CAST_INST(29, FPToSI , FPToSIInst ) // floating point -> SInt +HANDLE_CAST_INST(30, UIToFP , UIToFPInst ) // UInt -> floating point +HANDLE_CAST_INST(31, SIToFP , SIToFPInst ) // SInt -> floating point +HANDLE_CAST_INST(32, FPTrunc , FPTruncInst ) // Truncate floating point +HANDLE_CAST_INST(33, FPExt , FPExtInst ) // Extend floating point +HANDLE_CAST_INST(34, PtrToInt, PtrToIntInst) // Pointer -> Integer +HANDLE_CAST_INST(35, IntToPtr, IntToPtrInst) // Integer -> Pointer +HANDLE_CAST_INST(36, BitCast , BitCastInst ) // Type cast + LAST_CAST_INST(36) // Other operators... - FIRST_OTHER_INST(43) -HANDLE_OTHER_INST(43, ICmp , ICmpInst ) // Integer comparison instruction -HANDLE_OTHER_INST(44, FCmp , FCmpInst ) // Floating point comparison instr. -HANDLE_OTHER_INST(45, PHI , PHINode ) // PHI node instruction -HANDLE_OTHER_INST(46, Call , CallInst ) // Call a function -HANDLE_OTHER_INST(47, Shl , ShiftInst ) // Shift Left operations (logical) -HANDLE_OTHER_INST(48, LShr , ShiftInst ) // Logical Shift right (unsigned) -HANDLE_OTHER_INST(49, AShr , ShiftInst ) // Arithmetic shift right (signed) -HANDLE_OTHER_INST(50, Select , SelectInst ) // select instruction -HANDLE_OTHER_INST(51, UserOp1, Instruction) // May be used internally in a pass -HANDLE_OTHER_INST(52, UserOp2, Instruction) // Internal to passes only -HANDLE_OTHER_INST(53, VAArg , VAArgInst ) // vaarg instruction -HANDLE_OTHER_INST(54, ExtractElement, ExtractElementInst)// extract from vector. -HANDLE_OTHER_INST(55, InsertElement, InsertElementInst) // insert into vector -HANDLE_OTHER_INST(56, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. - LAST_OTHER_INST(56) + FIRST_OTHER_INST(37) +HANDLE_OTHER_INST(37, ICmp , ICmpInst ) // Integer comparison instruction +HANDLE_OTHER_INST(38, FCmp , FCmpInst ) // Floating point comparison instr. +HANDLE_OTHER_INST(39, PHI , PHINode ) // PHI node instruction +HANDLE_OTHER_INST(40, Call , CallInst ) // Call a function +HANDLE_OTHER_INST(41, Shl , ShiftInst ) // Shift Left operations (logical) +HANDLE_OTHER_INST(42, LShr , ShiftInst ) // Logical Shift right (unsigned) +HANDLE_OTHER_INST(43, AShr , ShiftInst ) // Arithmetic shift right (signed) +HANDLE_OTHER_INST(44, Select , SelectInst ) // select instruction +HANDLE_OTHER_INST(45, UserOp1, Instruction) // May be used internally in a pass +HANDLE_OTHER_INST(46, UserOp2, Instruction) // Internal to passes only +HANDLE_OTHER_INST(47, VAArg , VAArgInst ) // vaarg instruction +HANDLE_OTHER_INST(48, ExtractElement, ExtractElementInst)// extract from vector. +HANDLE_OTHER_INST(49, InsertElement, InsertElementInst) // insert into vector +HANDLE_OTHER_INST(50, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. + LAST_OTHER_INST(50) #undef FIRST_TERM_INST #undef HANDLE_TERM_INST Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.76 llvm/include/llvm/Instruction.h:1.77 --- llvm/include/llvm/Instruction.h:1.76 Sat Dec 16 23:15:12 2006 +++ llvm/include/llvm/Instruction.h Sat Dec 23 00:05:40 2006 @@ -71,6 +71,16 @@ /// extra information (e.g. load is volatile) agree. bool isIdenticalTo(Instruction *I) const; + /// This function determines if the specified instruction executes the same + /// operation as the current one. This means that the opcodes, type, operand + /// types and any other factors affecting the operation must be the same. This + /// is similar to isIdenticalTo except the operands themselves don't have to + /// be identical. + /// @returns true if the specified instruction is the same operation as + /// the current one. + /// @brief Determine if one instruction is the same operation as another. + bool isSameOperationAs(Instruction *I) const; + /// use_back - Specialize the methods defined in Value, as we know that an /// instruction can only be used by other instructions. Instruction *use_back() { return cast(*use_begin());} @@ -155,12 +165,6 @@ bool isCommutative() const { return isCommutative(getOpcode()); } static bool isCommutative(unsigned op); - /// isComparison - Return true if the instruction is a Set* instruction: - /// - bool isComparison() const { return isComparison(getOpcode()); } - static bool isComparison(unsigned op); - - /// isTrappingInstruction - Return true if the instruction may trap. /// bool isTrapping() const { Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.47 llvm/include/llvm/Instructions.h:1.48 --- llvm/include/llvm/Instructions.h:1.47 Sun Nov 26 19:05:09 2006 +++ llvm/include/llvm/Instructions.h Sat Dec 23 00:05:40 2006 @@ -440,7 +440,8 @@ ICMP_SLT = 40, ///< signed less than ICMP_SLE = 41, ///< signed less or equal FIRST_ICMP_PREDICATE = ICMP_EQ, - LAST_ICMP_PREDICATE = ICMP_SLE + LAST_ICMP_PREDICATE = ICMP_SLE, + BAD_ICMP_PREDICATE = ICMP_SLE + 1 }; /// @brief Constructor with insert-before-instruction semantics. @@ -490,16 +491,30 @@ /// This is a static version that you can use without an instruction /// available. /// @brief Return the predicate as if the operands were swapped. - static Predicate getSwappedPredicate(Predicate Opcode); + static Predicate getSwappedPredicate(Predicate pred); + + /// For example, EQ->EQ, SLE->SLE, UGT->SGT, etc. + /// @returns the predicate that would be the result if the operand were + /// regarded as signed. + /// @brief Return the signed version of the predicate + Predicate getSignedPredicate() const { + return getSignedPredicate(getPredicate()); + } + + /// This is a static version that you can use without an instruction. + /// @brief Return the signed version of the predicate. + static Predicate getSignedPredicate(Predicate pred); /// This also tests for commutativity. If isEquality() returns true then - /// the predicate is also commutative. Only the equality predicates are - /// commutative. + /// the predicate is also commutative. /// @returns true if the predicate of this instruction is EQ or NE. /// @brief Determine if this is an equality predicate. bool isEquality() const { return SubclassData == ICMP_EQ || SubclassData == ICMP_NE; } + + /// @returns true if the predicate of this ICmpInst is commutative + /// @brief Determine if this relation is commutative. bool isCommutative() const { return isEquality(); } /// @returns true if the predicate is relational (not EQ or NE). @@ -508,6 +523,14 @@ return !isEquality(); } + /// @returns true if the predicate of this ICmpInst is signed, false otherwise + /// @brief Determine if this instruction's predicate is signed. + bool isSignedPredicate() { return isSignedPredicate(getPredicate()); } + + /// @returns true if the predicate provided is signed, false otherwise + /// @brief Determine if the predicate is signed. + static bool isSignedPredicate(Predicate pred); + /// Exchange the two operands to this instruction in such a way that it does /// not modify the semantics of the instruction. The predicate value may be /// changed to retain the same result if the predicate is order dependent @@ -559,7 +582,8 @@ FCMP_UNE =14, ///< 1 1 1 0 True if unordered or not equal FCMP_TRUE =15, ///< 1 1 1 1 Always true (always folded) FIRST_FCMP_PREDICATE = FCMP_FALSE, - LAST_FCMP_PREDICATE = FCMP_TRUE + LAST_FCMP_PREDICATE = FCMP_TRUE, + BAD_FCMP_PREDICATE = FCMP_TRUE + 1 }; /// @brief Constructor with insert-before-instruction semantics. @@ -646,71 +670,6 @@ } }; - -//===----------------------------------------------------------------------===// -// SetCondInst Class -//===----------------------------------------------------------------------===// - -/// SetCondInst class - Represent a setCC operator, where CC is eq, ne, lt, gt, -/// le, or ge. -/// -class SetCondInst : public BinaryOperator { -public: - SetCondInst(BinaryOps Opcode, Value *LHS, Value *RHS, - const std::string &Name = "", Instruction *InsertBefore = 0); - SetCondInst(BinaryOps Opcode, Value *LHS, Value *RHS, - const std::string &Name, BasicBlock *InsertAtEnd); - - /// getInverseCondition - Return the inverse of the current condition opcode. - /// For example seteq -> setne, setgt -> setle, setlt -> setge, etc... - /// - BinaryOps getInverseCondition() const { - return getInverseCondition(getOpcode()); - } - - /// getInverseCondition - Static version that you can use without an - /// instruction available. - /// - static BinaryOps getInverseCondition(BinaryOps Opcode); - - /// getSwappedCondition - Return the condition opcode that would be the result - /// of exchanging the two operands of the setcc instruction without changing - /// the result produced. Thus, seteq->seteq, setle->setge, setlt->setgt, etc. - /// - BinaryOps getSwappedCondition() const { - return getSwappedCondition(getOpcode()); - } - - /// getSwappedCondition - Static version that you can use without an - /// instruction available. - /// - static BinaryOps getSwappedCondition(BinaryOps Opcode); - - /// isEquality - Return true if this comparison is an ==/!= comparison. - /// - bool isEquality() const { - return getOpcode() == SetEQ || getOpcode() == SetNE; - } - - /// isRelational - Return true if this comparison is a /<=/>= comparison. - /// - bool isRelational() const { - return !isEquality(); - } - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const SetCondInst *) { return true; } - static inline bool classof(const Instruction *I) { - return I->getOpcode() == SetEQ || I->getOpcode() == SetNE || - I->getOpcode() == SetLE || I->getOpcode() == SetGE || - I->getOpcode() == SetLT || I->getOpcode() == SetGT; - } - static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); - } -}; - - //===----------------------------------------------------------------------===// // CallInst Class //===----------------------------------------------------------------------===// Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.66 llvm/include/llvm/Pass.h:1.67 --- llvm/include/llvm/Pass.h:1.66 Fri Dec 22 16:55:30 2006 +++ llvm/include/llvm/Pass.h Sat Dec 23 00:05:40 2006 @@ -36,7 +36,7 @@ #include #include -//#define USE_OLD_PASSMANAGER 1 +#define USE_OLD_PASSMANAGER 1 namespace llvm { From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp LevelRaise.cpp Message-ID: <200612230607.kBN6702Y022153@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.117 -> 1.118 LevelRaise.cpp updated: 1.116 -> 1.117 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+21 -10) ExprTypeConvert.cpp | 28 +++++++++++++++++++++------- LevelRaise.cpp | 3 --- 2 files changed, 21 insertions(+), 10 deletions(-) Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.117 llvm/lib/Transforms/ExprTypeConvert.cpp:1.118 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.117 Mon Dec 18 02:47:13 2006 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Sat Dec 23 00:05:41 2006 @@ -463,10 +463,13 @@ return ValueConvertibleToType(I, Ty, CTMap, TD) && ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD); } - case Instruction::SetEQ: - case Instruction::SetNE: { - Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0); - return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD); + case Instruction::ICmp: { + if (cast(I)->getPredicate() == ICmpInst::ICMP_EQ || + cast(I)->getPredicate() == ICmpInst::ICMP_NE) { + Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0); + return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD); + } + return false; } case Instruction::LShr: case Instruction::AShr: @@ -717,9 +720,7 @@ } case Instruction::Add: - case Instruction::Sub: - case Instruction::SetEQ: - case Instruction::SetNE: { + case Instruction::Sub: { Res = BinaryOperator::create(cast(I)->getOpcode(), Dummy, Dummy, Name); VMC.ExprMap[I] = Res; // Add node to expression eagerly @@ -731,6 +732,19 @@ Res->setOperand(OtherIdx, NewOther); break; } + case Instruction::ICmp: { + ICmpInst::Predicate pred = cast(I)->getPredicate(); + if (pred == ICmpInst::ICMP_EQ || pred == ICmpInst::ICMP_NE) { + Res = new ICmpInst(pred, Dummy, Dummy, Name); + VMC.ExprMap[I] = Res; // Add node to expression eagerly + unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0; + Value *OtherOp = I->getOperand(OtherIdx); + Res->setOperand(!OtherIdx, NewVal); + Value *NewOther = ConvertExpressionToType(OtherOp, NewTy, VMC, TD); + Res->setOperand(OtherIdx, NewOther); + } + break; + } case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: Index: llvm/lib/Transforms/LevelRaise.cpp diff -u llvm/lib/Transforms/LevelRaise.cpp:1.116 llvm/lib/Transforms/LevelRaise.cpp:1.117 --- llvm/lib/Transforms/LevelRaise.cpp:1.116 Tue Dec 19 16:17:40 2006 +++ llvm/lib/Transforms/LevelRaise.cpp Sat Dec 23 00:05:41 2006 @@ -393,9 +393,6 @@ return false; } - - - bool RPR::DoRaisePass(Function &F) { bool Changed = false; for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB) From reid at x10sys.com Sat Dec 23 00:06:59 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:59 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h Message-ID: <200612230606.kBN66xTq022057@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: ScalarEvolutionExpressions.h updated: 1.9 -> 1.10 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+4 -2) ScalarEvolutionExpressions.h | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.9 llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.10 --- llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.9 Sat Dec 16 23:15:12 2006 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h Sat Dec 23 00:05:40 2006 @@ -426,8 +426,10 @@ /// looking at this is that it returns the first iteration number where the /// value is not in the condition, thus computing the exit count. If the /// iteration count can't be computed, an instance of SCEVCouldNotCompute is - /// returned. - SCEVHandle getNumIterationsInRange(ConstantRange Range) const; + /// returned. The isSigned parameter indicates whether the ConstantRange + /// should be treated as signed or unsigned. + SCEVHandle getNumIterationsInRange(ConstantRange Range, + bool isSigned) const; SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym, const SCEVHandle &Conc) const; From reid at x10sys.com Sat Dec 23 00:06:53 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:53 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LoopSimplify/2006-08-11-LoopSimplifyLongTime.ll.bc Message-ID: <200612230606.kBN66rCw021970@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LoopSimplify: 2006-08-11-LoopSimplifyLongTime.ll.bc updated: 1.2 -> 1.3 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+0 -0) 2006-08-11-LoopSimplifyLongTime.ll.bc | 0 1 files changed Index: llvm/test/Regression/Transforms/LoopSimplify/2006-08-11-LoopSimplifyLongTime.ll.bc From reid at x10sys.com Sat Dec 23 00:06:53 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:53 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll DeadSetCC.ll Message-ID: <200612230606.kBN66rOW021955@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SimplifyCFG: 2006-12-08-Ptr-ICmp-Branch.ll added (r1.1) DeadSetCC.ll updated: 1.2 -> 1.3 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+145 -1) 2006-12-08-Ptr-ICmp-Branch.ll | 144 ++++++++++++++++++++++++++++++++++++++++++ DeadSetCC.ll | 2 2 files changed, 145 insertions(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll diff -c /dev/null llvm/test/Regression/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll:1.1 *** /dev/null Sat Dec 23 00:05:51 2006 --- llvm/test/Regression/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll Sat Dec 23 00:05:41 2006 *************** *** 0 **** --- 1,144 ---- + ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis + ; ModuleID = 'bugpoint-tooptimize.bc' + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + %struct.FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, sbyte*, sbyte*, uint, int, [40 x sbyte] } + %struct._IO_FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, sbyte*, sbyte*, uint, int, [40 x sbyte] } + %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, int } + %struct.charsequence = type { sbyte*, uint, uint } + %struct.trie_s = type { [26 x %struct.trie_s*], int } + %str = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %str = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %str = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %C.0.2294 = external global %struct.charsequence ; <%struct.charsequence*> [#uses=3] + %t = external global %struct.trie_s* ; <%struct.trie_s**> [#uses=0] + %str = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %str = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + + implementation ; Functions: + + declare void %charsequence_reset(%struct.charsequence*) + declare void %free(sbyte*) + declare void %charsequence_push(%struct.charsequence*, sbyte) + declare sbyte* %charsequence_val(%struct.charsequence*) + declare int %_IO_getc(%struct.FILE*) + declare int %tolower(int) + declare %struct.trie_s* %trie_insert(%struct.trie_s*, sbyte*) + declare int %feof(%struct.FILE*) + + void %addfile(%struct.trie_s* %t, %struct.FILE* %f) { + entry: + %t_addr = alloca %struct.trie_s* ; <%struct.trie_s**> [#uses=2] + %f_addr = alloca %struct.FILE* ; <%struct.FILE**> [#uses=3] + %c = alloca sbyte, align 1 ; [#uses=7] + %wstate = alloca int, align 4 ; [#uses=4] + %cs = alloca %struct.charsequence, align 16 ; <%struct.charsequence*> [#uses=7] + %str = alloca sbyte*, align 4 ; [#uses=3] + "alloca point" = bitcast int 0 to int ; [#uses=0] + store %struct.trie_s* %t, %struct.trie_s** %t_addr + store %struct.FILE* %f, %struct.FILE** %f_addr + store int 0, int* %wstate + %tmp = getelementptr %struct.charsequence* %cs, uint 0, uint 0 ; [#uses=1] + %tmp1 = getelementptr %struct.charsequence* %C.0.2294, uint 0, uint 0 ; [#uses=1] + %tmp = load sbyte** %tmp1 ; [#uses=1] + store sbyte* %tmp, sbyte** %tmp + %tmp = getelementptr %struct.charsequence* %cs, uint 0, uint 1 ; [#uses=1] + %tmp2 = getelementptr %struct.charsequence* %C.0.2294, uint 0, uint 1 ; [#uses=1] + %tmp = load uint* %tmp2 ; [#uses=1] + store uint %tmp, uint* %tmp + %tmp3 = getelementptr %struct.charsequence* %cs, uint 0, uint 2 ; [#uses=1] + %tmp4 = getelementptr %struct.charsequence* %C.0.2294, uint 0, uint 2 ; [#uses=1] + %tmp5 = load uint* %tmp4 ; [#uses=1] + store uint %tmp5, uint* %tmp3 + br label %bb33 + + bb: ; preds = %bb33 + %tmp = load %struct.FILE** %f_addr ; <%struct.FILE*> [#uses=1] + %tmp = call int %_IO_getc( %struct.FILE* %tmp ) ; [#uses=1] + %tmp6 = call int %tolower( int %tmp ) ; [#uses=1] + %tmp6 = trunc int %tmp6 to sbyte ; [#uses=1] + store sbyte %tmp6, sbyte* %c + %tmp7 = load int* %wstate ; [#uses=1] + %tmp = icmp ne int %tmp7, 0 ; [#uses=1] + br bool %tmp, label %cond_true, label %cond_false + + cond_true: ; preds = %bb + %tmp = load sbyte* %c ; [#uses=1] + %tmp8 = icmp sle sbyte %tmp, 96 ; [#uses=1] + br bool %tmp8, label %cond_true9, label %cond_next + + cond_true9: ; preds = %cond_true + br label %bb16 + + cond_next: ; preds = %cond_true + %tmp10 = load sbyte* %c ; [#uses=1] + %tmp11 = icmp sgt sbyte %tmp10, 122 ; [#uses=1] + br bool %tmp11, label %cond_true12, label %cond_next13 + + cond_true12: ; preds = %cond_next + br label %bb16 + + cond_next13: ; preds = %cond_next + %tmp14 = load sbyte* %c ; [#uses=1] + %tmp14 = sext sbyte %tmp14 to int ; [#uses=1] + %tmp1415 = trunc int %tmp14 to sbyte ; [#uses=1] + call void %charsequence_push( %struct.charsequence* %cs, sbyte %tmp1415 ) + br label %bb21 + + bb16: ; preds = %cond_true12, %cond_true9 + %tmp17 = call sbyte* %charsequence_val( %struct.charsequence* %cs ) ; [#uses=1] + store sbyte* %tmp17, sbyte** %str + %tmp = load %struct.trie_s** %t_addr ; <%struct.trie_s*> [#uses=1] + %tmp18 = load sbyte** %str ; [#uses=1] + %tmp19 = call %struct.trie_s* %trie_insert( %struct.trie_s* %tmp, sbyte* %tmp18 ) ; <%struct.trie_s*> [#uses=0] + %tmp20 = load sbyte** %str ; [#uses=1] + call void %free( sbyte* %tmp20 ) + store int 0, int* %wstate + br label %bb21 + + bb21: ; preds = %bb16, %cond_next13 + br label %cond_next32 + + cond_false: ; preds = %bb + %tmp22 = load sbyte* %c ; [#uses=1] + %tmp23 = icmp sgt sbyte %tmp22, 96 ; [#uses=1] + br bool %tmp23, label %cond_true24, label %cond_next31 + + cond_true24: ; preds = %cond_false + %tmp25 = load sbyte* %c ; [#uses=1] + %tmp26 = icmp sle sbyte %tmp25, 122 ; [#uses=1] + br bool %tmp26, label %cond_true27, label %cond_next30 + + cond_true27: ; preds = %cond_true24 + call void %charsequence_reset( %struct.charsequence* %cs ) + %tmp28 = load sbyte* %c ; [#uses=1] + %tmp28 = sext sbyte %tmp28 to int ; [#uses=1] + %tmp2829 = trunc int %tmp28 to sbyte ; [#uses=1] + call void %charsequence_push( %struct.charsequence* %cs, sbyte %tmp2829 ) + store int 1, int* %wstate + br label %cond_next30 + + cond_next30: ; preds = %cond_true27, %cond_true24 + br label %cond_next31 + + cond_next31: ; preds = %cond_next30, %cond_false + br label %cond_next32 + + cond_next32: ; preds = %cond_next31, %bb21 + br label %bb33 + + bb33: ; preds = %cond_next32, %entry + %tmp34 = load %struct.FILE** %f_addr ; <%struct.FILE*> [#uses=1] + %tmp35 = call int %feof( %struct.FILE* %tmp34 ) ; [#uses=1] + %tmp36 = icmp eq int %tmp35, 0 ; [#uses=1] + br bool %tmp36, label %bb, label %bb37 + + bb37: ; preds = %bb33 + br label %return + + return: ; preds = %bb37 + ret void + } + Index: llvm/test/Regression/Transforms/SimplifyCFG/DeadSetCC.ll diff -u llvm/test/Regression/Transforms/SimplifyCFG/DeadSetCC.ll:1.2 llvm/test/Regression/Transforms/SimplifyCFG/DeadSetCC.ll:1.3 --- llvm/test/Regression/Transforms/SimplifyCFG/DeadSetCC.ll:1.2 Fri Dec 1 22:23:10 2006 +++ llvm/test/Regression/Transforms/SimplifyCFG/DeadSetCC.ll Sat Dec 23 00:05:41 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep seteq +; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'icmp eq' ; Check that simplifycfg deletes a dead 'seteq' instruction when it ; folds a conditional branch into a switch instruction. From reid at x10sys.com Sat Dec 23 00:06:58 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:58 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx Message-ID: <200612230606.kBN66waC022035@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/IndVarsSimplify: tripcount_infinite.llx updated: 1.4 -> 1.5 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+2 -2) tripcount_infinite.llx | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx diff -u llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx:1.4 llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx:1.5 --- llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx:1.4 Mon Dec 18 20:17:23 2006 +++ llvm/test/Regression/Transforms/IndVarsSimplify/tripcount_infinite.llx Sat Dec 23 00:05:41 2006 @@ -1,8 +1,8 @@ ; These tests have an infinite trip count. We obviously shouldn't remove the ; loops! :) ; -; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -adce -simplifycfg | llvm-dis | grep set | wc -l > %t2 -; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep set | wc -l > %t1 +; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -adce -simplifycfg | llvm-dis | grep icmp | wc -l > %t2 +; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep icmp | wc -l > %t1 ; RUN: diff %t1 %t2 int %infinite_linear() { ;; test for (i = 1; i != 100; i += 2) From reid at x10sys.com Sat Dec 23 00:06:53 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Interpreter.h Message-ID: <200612230606.kBN66rgE021960@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.153 -> 1.154 Interpreter.h updated: 1.78 -> 1.79 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+331 -112) Execution.cpp | 441 +++++++++++++++++++++++++++++++++++++++++++--------------- Interpreter.h | 2 2 files changed, 331 insertions(+), 112 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.153 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.154 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.153 Tue Dec 19 16:56:53 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Sat Dec 23 00:05:41 2006 @@ -55,18 +55,8 @@ const Type *Ty); static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2, const Type *Ty); -static GenericValue executeSetEQInst(GenericValue Src1, GenericValue Src2, - const Type *Ty); -static GenericValue executeSetNEInst(GenericValue Src1, GenericValue Src2, - const Type *Ty); -static GenericValue executeSetLTInst(GenericValue Src1, GenericValue Src2, - const Type *Ty); -static GenericValue executeSetGTInst(GenericValue Src1, GenericValue Src2, - const Type *Ty); -static GenericValue executeSetLEInst(GenericValue Src1, GenericValue Src2, - const Type *Ty); -static GenericValue executeSetGEInst(GenericValue Src1, GenericValue Src2, - const Type *Ty); +static GenericValue executeCmpInst(unsigned predicate, GenericValue Src1, + GenericValue Src2, const Type *Ty); static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2, const Type *Ty); static GenericValue executeLShrInst(GenericValue Src1, GenericValue Src2, @@ -144,30 +134,12 @@ return executeXorInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), CE->getOperand(0)->getType()); - case Instruction::SetEQ: - return executeSetEQInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); - case Instruction::SetNE: - return executeSetNEInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); - case Instruction::SetLE: - return executeSetLEInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); - case Instruction::SetGE: - return executeSetGEInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); - case Instruction::SetLT: - return executeSetLTInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); - case Instruction::SetGT: - return executeSetGTInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); + case Instruction::FCmp: + case Instruction::ICmp: + return executeCmpInst(CE->getPredicate(), + getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); case Instruction::Shl: return executeShlInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), @@ -434,33 +406,227 @@ return Dest; } -#define IMPLEMENT_SETCC(OP, TY) \ - case Type::TY##TyID: Dest.BoolVal = Src1.TY##Val OP Src2.TY##Val; break +#define IMPLEMENT_CMP(OP, TY1, TY2) \ + case Type::TY1##TyID: Dest.BoolVal = Src1.TY2##Val OP Src2.TY2##Val; break // Handle pointers specially because they must be compared with only as much // width as the host has. We _do not_ want to be comparing 64 bit values when // running on a 32-bit target, otherwise the upper 32 bits might mess up // comparisons if they contain garbage. -#define IMPLEMENT_POINTERSETCC(OP) \ +#define IMPLEMENT_POINTERCMP(OP) \ case Type::PointerTyID: \ Dest.BoolVal = (void*)(intptr_t)Src1.PointerVal OP \ (void*)(intptr_t)Src2.PointerVal; break -static GenericValue executeSetEQInst(GenericValue Src1, GenericValue Src2, - const Type *Ty) { +static GenericValue executeICMP_EQ(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(==, UByte, UByte); + IMPLEMENT_CMP(==, SByte, SByte); + IMPLEMENT_CMP(==, UShort, UShort); + IMPLEMENT_CMP(==, Short, Short); + IMPLEMENT_CMP(==, UInt, UInt); + IMPLEMENT_CMP(==, Int, Int); + IMPLEMENT_CMP(==, ULong, ULong); + IMPLEMENT_CMP(==, Long, Long); + IMPLEMENT_POINTERCMP(==); + default: + cerr << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeICMP_NE(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(!=, UByte, UByte); + IMPLEMENT_CMP(!=, SByte, SByte); + IMPLEMENT_CMP(!=, UShort,UShort); + IMPLEMENT_CMP(!=, Short, Short); + IMPLEMENT_CMP(!=, UInt, UInt); + IMPLEMENT_CMP(!=, Int, Int); + IMPLEMENT_CMP(!=, ULong, ULong); + IMPLEMENT_CMP(!=, Long, Long); + IMPLEMENT_POINTERCMP(!=); + default: + cerr << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeICMP_ULT(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(<, SByte, UByte); + IMPLEMENT_CMP(<, Short, UShort); + IMPLEMENT_CMP(<, Int, UInt); + IMPLEMENT_CMP(<, Long, ULong); + IMPLEMENT_CMP(<, UByte, UByte); + IMPLEMENT_CMP(<, UShort, UShort); + IMPLEMENT_CMP(<, UInt, UInt); + IMPLEMENT_CMP(<, ULong, ULong); + IMPLEMENT_POINTERCMP(<); + default: + cerr << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeICMP_SLT(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(<, SByte, SByte); + IMPLEMENT_CMP(<, Short, Short); + IMPLEMENT_CMP(<, Int, Int); + IMPLEMENT_CMP(<, Long, Long); + IMPLEMENT_CMP(<, UByte, SByte); + IMPLEMENT_CMP(<, UShort, Short); + IMPLEMENT_CMP(<, UInt, Int); + IMPLEMENT_CMP(<, ULong, Long); + IMPLEMENT_POINTERCMP(<); + default: + cerr << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeICMP_UGT(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(>, SByte, UByte); + IMPLEMENT_CMP(>, Short, UShort); + IMPLEMENT_CMP(>, Int, UInt); + IMPLEMENT_CMP(>, Long, ULong); + IMPLEMENT_CMP(>, UByte, UByte); + IMPLEMENT_CMP(>, UShort, UShort); + IMPLEMENT_CMP(>, UInt, UInt); + IMPLEMENT_CMP(>, ULong, ULong); + IMPLEMENT_POINTERCMP(>); + default: + cerr << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeICMP_SGT(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(>, SByte, SByte); + IMPLEMENT_CMP(>, Short, Short); + IMPLEMENT_CMP(>, Int, Int); + IMPLEMENT_CMP(>, Long, Long); + IMPLEMENT_CMP(>, UByte, SByte); + IMPLEMENT_CMP(>, UShort, Short); + IMPLEMENT_CMP(>, UInt, Int); + IMPLEMENT_CMP(>, ULong, Long); + IMPLEMENT_POINTERCMP(>); + default: + cerr << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeICMP_ULE(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(<=, SByte, UByte); + IMPLEMENT_CMP(<=, Short, UShort); + IMPLEMENT_CMP(<=, Int, UInt); + IMPLEMENT_CMP(<=, Long, ULong); + IMPLEMENT_CMP(<=, UByte, UByte); + IMPLEMENT_CMP(<=, UShort, UShort); + IMPLEMENT_CMP(<=, UInt, UInt); + IMPLEMENT_CMP(<=, ULong, ULong); + IMPLEMENT_POINTERCMP(<=); + default: + cerr << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeICMP_SLE(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(<=, SByte, SByte); + IMPLEMENT_CMP(<=, Short, Short); + IMPLEMENT_CMP(<=, Int, Int); + IMPLEMENT_CMP(<=, Long, Long); + IMPLEMENT_CMP(<=, UByte, SByte); + IMPLEMENT_CMP(<=, UShort, Short); + IMPLEMENT_CMP(<=, UInt, Int); + IMPLEMENT_CMP(<=, ULong, Long); + IMPLEMENT_POINTERCMP(<=); + default: + cerr << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeICMP_UGE(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(>=, SByte, UByte); + IMPLEMENT_CMP(>=, Short, UShort); + IMPLEMENT_CMP(>=, Int, UInt); + IMPLEMENT_CMP(>=, Long, ULong); + IMPLEMENT_CMP(>=, UByte, UByte); + IMPLEMENT_CMP(>=, UShort, UShort); + IMPLEMENT_CMP(>=, UInt, UInt); + IMPLEMENT_CMP(>=, ULong, ULong); + IMPLEMENT_POINTERCMP(>=); + default: + cerr << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeICMP_SGE(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(>=, SByte, SByte); + IMPLEMENT_CMP(>=, Short, Short); + IMPLEMENT_CMP(>=, Int, Int); + IMPLEMENT_CMP(>=, Long, Long); + IMPLEMENT_CMP(>=, UByte, SByte); + IMPLEMENT_CMP(>=, UShort, Short); + IMPLEMENT_CMP(>=, UInt, Int); + IMPLEMENT_CMP(>=, ULong, Long); + IMPLEMENT_POINTERCMP(>=); + default: + cerr << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +#define IMPLEMENT_SETCC(OP, TY) \ + case Type::TY##TyID: Dest.BoolVal = Src1.TY##Val OP Src2.TY##Val; break + +static GenericValue executeFCMP_EQ(GenericValue Src1, GenericValue Src2, + const Type *Ty) { GenericValue Dest; switch (Ty->getTypeID()) { - IMPLEMENT_SETCC(==, UByte); - IMPLEMENT_SETCC(==, SByte); - IMPLEMENT_SETCC(==, UShort); - IMPLEMENT_SETCC(==, Short); - IMPLEMENT_SETCC(==, UInt); - IMPLEMENT_SETCC(==, Int); - IMPLEMENT_SETCC(==, ULong); - IMPLEMENT_SETCC(==, Long); IMPLEMENT_SETCC(==, Float); IMPLEMENT_SETCC(==, Double); - IMPLEMENT_POINTERSETCC(==); default: cerr << "Unhandled type for SetEQ instruction: " << *Ty << "\n"; abort(); @@ -468,21 +634,12 @@ return Dest; } -static GenericValue executeSetNEInst(GenericValue Src1, GenericValue Src2, - const Type *Ty) { +static GenericValue executeFCMP_NE(GenericValue Src1, GenericValue Src2, + const Type *Ty) { GenericValue Dest; switch (Ty->getTypeID()) { - IMPLEMENT_SETCC(!=, UByte); - IMPLEMENT_SETCC(!=, SByte); - IMPLEMENT_SETCC(!=, UShort); - IMPLEMENT_SETCC(!=, Short); - IMPLEMENT_SETCC(!=, UInt); - IMPLEMENT_SETCC(!=, Int); - IMPLEMENT_SETCC(!=, ULong); - IMPLEMENT_SETCC(!=, Long); IMPLEMENT_SETCC(!=, Float); IMPLEMENT_SETCC(!=, Double); - IMPLEMENT_POINTERSETCC(!=); default: cerr << "Unhandled type for SetNE instruction: " << *Ty << "\n"; @@ -491,21 +648,12 @@ return Dest; } -static GenericValue executeSetLEInst(GenericValue Src1, GenericValue Src2, - const Type *Ty) { +static GenericValue executeFCMP_LE(GenericValue Src1, GenericValue Src2, + const Type *Ty) { GenericValue Dest; switch (Ty->getTypeID()) { - IMPLEMENT_SETCC(<=, UByte); - IMPLEMENT_SETCC(<=, SByte); - IMPLEMENT_SETCC(<=, UShort); - IMPLEMENT_SETCC(<=, Short); - IMPLEMENT_SETCC(<=, UInt); - IMPLEMENT_SETCC(<=, Int); - IMPLEMENT_SETCC(<=, ULong); - IMPLEMENT_SETCC(<=, Long); IMPLEMENT_SETCC(<=, Float); IMPLEMENT_SETCC(<=, Double); - IMPLEMENT_POINTERSETCC(<=); default: cerr << "Unhandled type for SetLE instruction: " << *Ty << "\n"; abort(); @@ -513,21 +661,12 @@ return Dest; } -static GenericValue executeSetGEInst(GenericValue Src1, GenericValue Src2, - const Type *Ty) { +static GenericValue executeFCMP_GE(GenericValue Src1, GenericValue Src2, + const Type *Ty) { GenericValue Dest; switch (Ty->getTypeID()) { - IMPLEMENT_SETCC(>=, UByte); - IMPLEMENT_SETCC(>=, SByte); - IMPLEMENT_SETCC(>=, UShort); - IMPLEMENT_SETCC(>=, Short); - IMPLEMENT_SETCC(>=, UInt); - IMPLEMENT_SETCC(>=, Int); - IMPLEMENT_SETCC(>=, ULong); - IMPLEMENT_SETCC(>=, Long); IMPLEMENT_SETCC(>=, Float); IMPLEMENT_SETCC(>=, Double); - IMPLEMENT_POINTERSETCC(>=); default: cerr << "Unhandled type for SetGE instruction: " << *Ty << "\n"; abort(); @@ -535,21 +674,12 @@ return Dest; } -static GenericValue executeSetLTInst(GenericValue Src1, GenericValue Src2, - const Type *Ty) { +static GenericValue executeFCMP_LT(GenericValue Src1, GenericValue Src2, + const Type *Ty) { GenericValue Dest; switch (Ty->getTypeID()) { - IMPLEMENT_SETCC(<, UByte); - IMPLEMENT_SETCC(<, SByte); - IMPLEMENT_SETCC(<, UShort); - IMPLEMENT_SETCC(<, Short); - IMPLEMENT_SETCC(<, UInt); - IMPLEMENT_SETCC(<, Int); - IMPLEMENT_SETCC(<, ULong); - IMPLEMENT_SETCC(<, Long); IMPLEMENT_SETCC(<, Float); IMPLEMENT_SETCC(<, Double); - IMPLEMENT_POINTERSETCC(<); default: cerr << "Unhandled type for SetLT instruction: " << *Ty << "\n"; abort(); @@ -557,21 +687,12 @@ return Dest; } -static GenericValue executeSetGTInst(GenericValue Src1, GenericValue Src2, +static GenericValue executeFCMP_GT(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; switch (Ty->getTypeID()) { - IMPLEMENT_SETCC(>, UByte); - IMPLEMENT_SETCC(>, SByte); - IMPLEMENT_SETCC(>, UShort); - IMPLEMENT_SETCC(>, Short); - IMPLEMENT_SETCC(>, UInt); - IMPLEMENT_SETCC(>, Int); - IMPLEMENT_SETCC(>, ULong); - IMPLEMENT_SETCC(>, Long); IMPLEMENT_SETCC(>, Float); IMPLEMENT_SETCC(>, Double); - IMPLEMENT_POINTERSETCC(>); default: cerr << "Unhandled type for SetGT instruction: " << *Ty << "\n"; abort(); @@ -579,6 +700,108 @@ return Dest; } +void Interpreter::visitFCmpInst(FCmpInst &I) { + ExecutionContext &SF = ECStack.back(); + const Type *Ty = I.getOperand(0)->getType(); + GenericValue Src1 = getOperandValue(I.getOperand(0), SF); + GenericValue Src2 = getOperandValue(I.getOperand(1), SF); + GenericValue R; // Result + + switch (I.getPredicate()) { + case FCmpInst::FCMP_FALSE: R.BoolVal = false; + case FCmpInst::FCMP_ORD: R = executeFCMP_EQ(Src1, Src2, Ty); break; ///??? + case FCmpInst::FCMP_UNO: R = executeFCMP_NE(Src1, Src2, Ty); break; ///??? + case FCmpInst::FCMP_OEQ: + case FCmpInst::FCMP_UEQ: R = executeFCMP_EQ(Src1, Src2, Ty); break; + case FCmpInst::FCMP_ONE: + case FCmpInst::FCMP_UNE: R = executeFCMP_NE(Src1, Src2, Ty); break; + case FCmpInst::FCMP_OLT: + case FCmpInst::FCMP_ULT: R = executeFCMP_LT(Src1, Src2, Ty); break; + case FCmpInst::FCMP_OGT: + case FCmpInst::FCMP_UGT: R = executeFCMP_GT(Src1, Src2, Ty); break; + case FCmpInst::FCMP_OLE: + case FCmpInst::FCMP_ULE: R = executeFCMP_LE(Src1, Src2, Ty); break; + case FCmpInst::FCMP_OGE: + case FCmpInst::FCMP_UGE: R = executeFCMP_GE(Src1, Src2, Ty); break; + case FCmpInst::FCMP_TRUE: R.BoolVal = true; + default: + cerr << "Don't know how to handle this FCmp predicate!\n-->" << I; + abort(); + } + + SetValue(&I, R, SF); +} + +void Interpreter::visitICmpInst(ICmpInst &I) { + ExecutionContext &SF = ECStack.back(); + const Type *Ty = I.getOperand(0)->getType(); + GenericValue Src1 = getOperandValue(I.getOperand(0), SF); + GenericValue Src2 = getOperandValue(I.getOperand(1), SF); + GenericValue R; // Result + + switch (I.getPredicate()) { + case ICmpInst::ICMP_EQ: R = executeICMP_EQ(Src1, Src2, Ty); break; + case ICmpInst::ICMP_NE: R = executeICMP_NE(Src1, Src2, Ty); break; + case ICmpInst::ICMP_ULT: R = executeICMP_ULT(Src1, Src2, Ty); break; + case ICmpInst::ICMP_SLT: R = executeICMP_SLT(Src1, Src2, Ty); break; + case ICmpInst::ICMP_UGT: R = executeICMP_UGT(Src1, Src2, Ty); break; + case ICmpInst::ICMP_SGT: R = executeICMP_SGT(Src1, Src2, Ty); break; + case ICmpInst::ICMP_ULE: R = executeICMP_ULE(Src1, Src2, Ty); break; + case ICmpInst::ICMP_SLE: R = executeICMP_SLE(Src1, Src2, Ty); break; + case ICmpInst::ICMP_UGE: R = executeICMP_UGE(Src1, Src2, Ty); break; + case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break; + default: + cerr << "Don't know how to handle this ICmp predicate!\n-->" << I; + abort(); + } + + SetValue(&I, R, SF); +} + +static GenericValue executeCmpInst(unsigned predicate, GenericValue Src1, + GenericValue Src2, const Type *Ty) { + GenericValue Result; + switch (predicate) { + case ICmpInst::ICMP_EQ: return executeICMP_EQ(Src1, Src2, Ty); + case ICmpInst::ICMP_NE: return executeICMP_NE(Src1, Src2, Ty); + case ICmpInst::ICMP_UGT: return executeICMP_UGT(Src1, Src2, Ty); + case ICmpInst::ICMP_SGT: return executeICMP_SGT(Src1, Src2, Ty); + case ICmpInst::ICMP_ULT: return executeICMP_ULT(Src1, Src2, Ty); + case ICmpInst::ICMP_SLT: return executeICMP_SLT(Src1, Src2, Ty); + case ICmpInst::ICMP_UGE: return executeICMP_UGE(Src1, Src2, Ty); + case ICmpInst::ICMP_SGE: return executeICMP_SGE(Src1, Src2, Ty); + case ICmpInst::ICMP_ULE: return executeICMP_ULE(Src1, Src2, Ty); + case ICmpInst::ICMP_SLE: return executeICMP_SLE(Src1, Src2, Ty); + case FCmpInst::FCMP_ORD: return executeFCMP_EQ(Src1, Src2, Ty); break; + case FCmpInst::FCMP_UNO: return executeFCMP_NE(Src1, Src2, Ty); break; + case FCmpInst::FCMP_OEQ: + case FCmpInst::FCMP_UEQ: return executeFCMP_EQ(Src1, Src2, Ty); break; + case FCmpInst::FCMP_ONE: + case FCmpInst::FCMP_UNE: return executeFCMP_NE(Src1, Src2, Ty); break; + case FCmpInst::FCMP_OLT: + case FCmpInst::FCMP_ULT: return executeFCMP_LT(Src1, Src2, Ty); break; + case FCmpInst::FCMP_OGT: + case FCmpInst::FCMP_UGT: return executeFCMP_GT(Src1, Src2, Ty); break; + case FCmpInst::FCMP_OLE: + case FCmpInst::FCMP_ULE: return executeFCMP_LE(Src1, Src2, Ty); break; + case FCmpInst::FCMP_OGE: + case FCmpInst::FCMP_UGE: return executeFCMP_GE(Src1, Src2, Ty); break; + case FCmpInst::FCMP_FALSE: { + GenericValue Result; + Result.BoolVal = false; + return Result; + } + case FCmpInst::FCMP_TRUE: { + GenericValue Result; + Result.BoolVal = true; + return Result; + } + default: + cerr << "Unhandled Cmp predicate\n"; + abort(); + } +} + void Interpreter::visitBinaryOperator(BinaryOperator &I) { ExecutionContext &SF = ECStack.back(); const Type *Ty = I.getOperand(0)->getType(); @@ -599,12 +822,6 @@ case Instruction::And: R = executeAndInst (Src1, Src2, Ty); break; case Instruction::Or: R = executeOrInst (Src1, Src2, Ty); break; case Instruction::Xor: R = executeXorInst (Src1, Src2, Ty); break; - case Instruction::SetEQ: R = executeSetEQInst(Src1, Src2, Ty); break; - case Instruction::SetNE: R = executeSetNEInst(Src1, Src2, Ty); break; - case Instruction::SetLE: R = executeSetLEInst(Src1, Src2, Ty); break; - case Instruction::SetGE: R = executeSetGEInst(Src1, Src2, Ty); break; - case Instruction::SetLT: R = executeSetLTInst(Src1, Src2, Ty); break; - case Instruction::SetGT: R = executeSetGTInst(Src1, Src2, Ty); break; default: cerr << "Don't know how to handle this binary operator!\n-->" << I; abort(); @@ -732,8 +949,8 @@ // Check to see if any of the cases match... BasicBlock *Dest = 0; for (unsigned i = 2, e = I.getNumOperands(); i != e; i += 2) - if (executeSetEQInst(CondVal, - getOperandValue(I.getOperand(i), SF), ElTy).BoolVal) { + if (executeICMP_EQ(CondVal, + getOperandValue(I.getOperand(i), SF), ElTy).BoolVal) { Dest = cast(I.getOperand(i+1)); break; } Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.78 llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.79 --- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.78 Thu Dec 7 14:04:42 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h Sat Dec 23 00:05:41 2006 @@ -136,6 +136,8 @@ void visitSwitchInst(SwitchInst &I); void visitBinaryOperator(BinaryOperator &I); + void visitICmpInst(ICmpInst &I); + void visitFCmpInst(FCmpInst &I); void visitAllocationInst(AllocationInst &I); void visitFreeInst(FreeInst &I); void visitLoadInst(LoadInst &I); From reid at x10sys.com Sat Dec 23 00:06:54 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.cpp.cvs Lexer.l Lexer.l.cvs llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200612230606.kBN66sDW022007@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.cpp.cvs updated: 1.18 -> 1.19 Lexer.l updated: 1.87 -> 1.88 Lexer.l.cvs updated: 1.14 -> 1.15 llvmAsmParser.cpp.cvs updated: 1.37 -> 1.38 llvmAsmParser.h.cvs updated: 1.30 -> 1.31 llvmAsmParser.y updated: 1.290 -> 1.291 llvmAsmParser.y.cvs updated: 1.38 -> 1.39 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+2813 -2819) Lexer.cpp.cvs | 1270 +++++++-------- Lexer.l | 6 Lexer.l.cvs | 6 llvmAsmParser.cpp.cvs | 4055 +++++++++++++++++++++++++------------------------- llvmAsmParser.h.cvs | 223 +- llvmAsmParser.y | 24 llvmAsmParser.y.cvs | 48 7 files changed, 2813 insertions(+), 2819 deletions(-) Index: llvm/lib/AsmParser/Lexer.cpp.cvs diff -u llvm/lib/AsmParser/Lexer.cpp.cvs:1.18 llvm/lib/AsmParser/Lexer.cpp.cvs:1.19 --- llvm/lib/AsmParser/Lexer.cpp.cvs:1.18 Sun Dec 3 00:59:29 2006 +++ llvm/lib/AsmParser/Lexer.cpp.cvs Sat Dec 23 00:05:40 2006 @@ -20,7 +20,7 @@ /* A lexical scanner generated by flex*/ /* Scanner skeleton version: - * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.18 2006/12/03 06:59:29 reid Exp $ + * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.19 2006/12/23 06:05:40 reid Exp $ */ #define FLEX_SCANNER @@ -317,38 +317,37 @@ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 147 -#define YY_END_OF_BUFFER 148 -static yyconst short int yy_acclist[225] = +#define YY_NUM_RULES 141 +#define YY_END_OF_BUFFER 142 +static yyconst short int yy_acclist[219] = { 0, - 148, 146, 147, 145, 146, 147, 145, 147, 146, 147, - 146, 147, 146, 147, 146, 147, 146, 147, 146, 147, - 138, 146, 147, 138, 146, 147, 1, 146, 147, 146, - 147, 146, 147, 146, 147, 146, 147, 146, 147, 146, - 147, 146, 147, 146, 147, 146, 147, 146, 147, 146, - 147, 146, 147, 146, 147, 146, 147, 146, 147, 146, - 147, 146, 147, 146, 147, 146, 147, 146, 147, 146, - 147, 137, 135, 134, 134, 141, 139, 143, 138, 1, - 120, 38, 80, 81, 70, 22, 137, 134, 134, 142, - 143, 19, 143, 144, 60, 69, 36, 31, 39, 3, - - 51, 62, 90, 95, 93, 94, 92, 91, 96, 100, - 119, 85, 83, 115, 84, 82, 61, 98, 89, 87, - 88, 86, 99, 97, 71, 136, 143, 143, 117, 46, - 101, 79, 65, 127, 68, 78, 128, 53, 116, 21, - 140, 64, 104, 67, 23, 4, 58, 63, 52, 66, - 45, 11, 103, 143, 33, 2, 5, 55, 106, 57, - 47, 73, 77, 75, 76, 74, 72, 49, 129, 102, - 48, 54, 20, 126, 42, 56, 27, 41, 110, 109, - 7, 122, 30, 125, 35, 59, 114, 108, 121, 24, - 25, 107, 123, 50, 118, 113, 40, 6, 26, 105, - - 34, 8, 16, 9, 111, 10, 112, 32, 12, 14, - 13, 29, 37, 15, 28, 124, 130, 132, 133, 43, - 131, 17, 44, 18 + 142, 140, 141, 139, 140, 141, 139, 141, 140, 141, + 140, 141, 140, 141, 140, 141, 140, 141, 140, 141, + 132, 140, 141, 132, 140, 141, 1, 140, 141, 140, + 141, 140, 141, 140, 141, 140, 141, 140, 141, 140, + 141, 140, 141, 140, 141, 140, 141, 140, 141, 140, + 141, 140, 141, 140, 141, 140, 141, 140, 141, 140, + 141, 140, 141, 140, 141, 140, 141, 140, 141, 140, + 141, 131, 129, 128, 128, 135, 133, 137, 132, 1, + 114, 38, 74, 75, 70, 22, 131, 128, 128, 136, + 137, 19, 137, 138, 60, 69, 36, 31, 39, 3, + + 51, 62, 84, 89, 87, 88, 86, 85, 90, 94, + 113, 79, 77, 109, 78, 76, 61, 92, 83, 81, + 82, 80, 93, 91, 71, 130, 137, 137, 111, 46, + 95, 73, 65, 121, 68, 72, 122, 53, 110, 21, + 134, 64, 98, 67, 23, 4, 58, 63, 52, 66, + 45, 11, 97, 137, 33, 2, 5, 55, 100, 57, + 47, 49, 123, 96, 48, 54, 20, 120, 42, 56, + 27, 41, 104, 103, 7, 116, 30, 119, 35, 59, + 108, 102, 115, 24, 25, 101, 117, 50, 112, 107, + 40, 6, 26, 99, 34, 8, 16, 9, 105, 10, + + 106, 32, 12, 14, 13, 29, 37, 15, 28, 118, + 124, 126, 127, 43, 125, 17, 44, 18 } ; -static yyconst short int yy_accept[581] = +static yyconst short int yy_accept[570] = { 0, 1, 1, 1, 2, 4, 7, 9, 11, 13, 15, 17, 19, 21, 24, 27, 30, 32, 34, 36, 38, @@ -372,47 +371,46 @@ 102, 102, 102, 102, 102, 102, 103, 103, 104, 105, 106, 107, 108, 109, 109, 110, 111, 111, 111, 112, - 112, 112, 112, 112, 112, 112, 112, 113, 114, 115, - 115, 115, 115, 115, 116, 117, 117, 117, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 119, 120, 121, - 121, 121, 122, 122, 123, 123, 124, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 126, 126, 126, - 127, 128, 128, 128, 128, 129, 129, 129, 129, 130, - 130, 130, 131, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, 133, 134, - 134, 134, 134, 134, 135, 136, 136, 136, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 138, 139, 140, - - 140, 140, 141, 141, 141, 141, 142, 142, 143, 143, - 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, - 145, 145, 145, 146, 146, 146, 147, 147, 148, 148, - 149, 150, 150, 150, 150, 150, 150, 151, 151, 151, - 152, 152, 153, 153, 153, 154, 155, 156, 156, 156, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 158, 158, 159, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, 161, 161, - 161, 161, 161, 161, 161, 161, 162, 162, 162, 163, - 164, 165, 166, 167, 168, 169, 169, 169, 169, 170, - - 170, 170, 170, 171, 172, 172, 173, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 175, 175, 175, 176, - 176, 176, 176, 176, 176, 176, 176, 177, 178, 178, - 178, 179, 180, 181, 181, 181, 182, 182, 182, 182, - 182, 183, 183, 184, 185, 186, 187, 187, 187, 187, - 188, 188, 188, 189, 190, 191, 192, 193, 193, 194, - 195, 196, 196, 196, 196, 196, 196, 197, 197, 198, - 198, 199, 200, 200, 200, 200, 200, 200, 201, 201, - 201, 201, 201, 201, 201, 201, 201, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 203, 203, 203, 203, - - 203, 204, 204, 204, 204, 204, 205, 206, 207, 207, - 208, 208, 208, 208, 209, 209, 209, 209, 210, 210, - 211, 212, 212, 212, 212, 212, 212, 212, 212, 212, - 212, 212, 212, 212, 213, 213, 213, 213, 213, 213, - 213, 213, 214, 214, 214, 214, 214, 215, 215, 215, - 215, 215, 216, 216, 217, 217, 217, 217, 217, 217, - 217, 217, 217, 217, 217, 217, 217, 218, 218, 219, - 220, 220, 221, 221, 222, 223, 224, 224, 225, 225 + 112, 112, 112, 112, 112, 112, 113, 114, 115, 115, + 115, 115, 115, 116, 117, 117, 117, 118, 118, 118, + 118, 118, 118, 118, 118, 118, 119, 120, 121, 121, + 121, 122, 122, 123, 123, 124, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 126, 126, 126, 127, + 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, + 130, 131, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 133, 134, 134, + 134, 134, 134, 135, 136, 136, 136, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 138, 139, 140, 140, + + 140, 141, 141, 141, 141, 142, 142, 143, 143, 143, + 144, 144, 144, 144, 144, 145, 145, 145, 146, 146, + 146, 147, 147, 148, 148, 149, 150, 150, 150, 150, + 150, 150, 151, 151, 151, 152, 152, 153, 153, 153, + 154, 155, 156, 156, 156, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 158, + 158, 159, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 161, 161, 161, 161, 161, 161, 161, + 161, 162, 162, 162, 163, 163, 163, 163, 164, 164, + 164, 164, 165, 166, 166, 167, 168, 168, 168, 168, + + 168, 168, 168, 168, 168, 169, 169, 169, 170, 170, + 170, 170, 170, 170, 170, 170, 171, 172, 172, 172, + 173, 174, 175, 175, 175, 176, 176, 176, 176, 176, + 177, 177, 178, 179, 180, 181, 181, 181, 181, 182, + 182, 182, 183, 184, 185, 186, 187, 187, 188, 189, + 190, 190, 190, 190, 190, 190, 191, 191, 192, 192, + 193, 194, 194, 194, 194, 194, 194, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 196, 196, 196, 196, + 196, 196, 196, 196, 196, 197, 197, 197, 197, 197, + 198, 198, 198, 198, 198, 199, 200, 201, 201, 202, + + 202, 202, 202, 203, 203, 203, 203, 204, 204, 205, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 207, 207, 207, 207, 207, 207, 207, + 207, 208, 208, 208, 208, 208, 209, 209, 209, 209, + 209, 210, 210, 211, 211, 211, 211, 211, 211, 211, + 211, 211, 211, 211, 211, 211, 212, 212, 213, 214, + 214, 215, 215, 216, 217, 218, 218, 219, 219 } ; static yyconst int yy_ec[256] = @@ -456,143 +454,141 @@ 3, 3, 3 } ; -static yyconst short int yy_base[585] = +static yyconst short int yy_base[574] = { 0, - 0, 0, 1248, 1249, 1249, 1249, 1243, 1232, 36, 40, + 0, 0, 1226, 1227, 1227, 1227, 1221, 1210, 36, 40, 44, 50, 56, 62, 0, 63, 66, 81, 89, 47, 108, 91, 95, 92, 72, 109, 134, 119, 117, 160, - 120, 191, 139, 121, 136, 150, 1241, 1249, 1230, 1249, + 120, 191, 139, 121, 136, 150, 1219, 1227, 1208, 1227, 0, 165, 180, 197, 219, 70, 224, 239, 244, 0, - 68, 152, 93, 128, 158, 190, 245, 31, 1229, 188, - 182, 211, 48, 207, 248, 210, 122, 124, 1228, 209, + 68, 152, 93, 128, 158, 190, 245, 31, 1207, 188, + 182, 211, 48, 207, 248, 210, 122, 124, 1206, 209, 257, 258, 185, 259, 260, 261, 262, 263, 264, 265, - 266, 276, 273, 287, 286, 278, 294, 295, 1227, 297, + 266, 276, 273, 287, 286, 278, 294, 295, 1205, 297, 299, 300, 305, 306, 303, 313, 307, 311, 301, 316, - 46, 317, 318, 325, 326, 329, 333, 327, 334, 337, - 351, 346, 354, 1226, 358, 342, 338, 360, 363, 365, - 362, 368, 372, 369, 364, 271, 384, 387, 231, 389, - 394, 1225, 0, 404, 408, 1224, 426, 443, 0, 1223, - 408, 395, 1222, 409, 412, 1221, 414, 1220, 431, 430, - 432, 1219, 420, 434, 444, 446, 448, 449, 452, 454, - 455, 450, 457, 458, 466, 180, 462, 469, 470, 473, - 474, 472, 475, 477, 484, 486, 480, 490, 487, 497, - 500, 502, 503, 504, 505, 1218, 506, 1217, 1216, 1215, - 1214, 1213, 1212, 396, 1211, 1210, 510, 507, 1209, 535, - - 512, 511, 516, 514, 546, 525, 1208, 1207, 1206, 526, - 518, 549, 550, 1205, 1204, 551, 552, 1203, 553, 554, - 559, 556, 562, 565, 560, 564, 1202, 1201, 1200, 572, - 566, 1199, 577, 1198, 578, 1197, 1196, 581, 580, 582, - 585, 517, 588, 586, 592, 597, 1195, 599, 600, 1249, - 611, 628, 632, 636, 641, 602, 604, 642, 1194, 643, - 613, 1193, 1192, 605, 644, 645, 646, 647, 649, 648, - 650, 654, 651, 653, 658, 655, 665, 1191, 1190, 657, - 670, 673, 676, 1189, 1188, 671, 677, 1187, 678, 681, - 683, 685, 684, 679, 688, 690, 1186, 1185, 1184, 689, - - 696, 1183, 691, 699, 692, 0, 708, 1182, 701, 709, - 712, 718, 719, 720, 1181, 713, 721, 724, 725, 1180, - 730, 737, 1179, 734, 723, 1178, 740, 1177, 745, 1176, - 1175, 746, 748, 750, 752, 749, 1174, 751, 753, 1173, - 755, 1172, 758, 762, 1171, 785, 1170, 764, 763, 1169, - 765, 770, 785, 779, 788, 773, 761, 776, 789, 791, - 792, 796, 797, 1168, 798, 1167, 1166, 799, 801, 802, - 806, 803, 807, 810, 811, 816, 817, 1165, 820, 821, - 822, 825, 827, 831, 832, 1164, 824, 838, 1163, 1162, - 1161, 1160, 1159, 1158, 1157, 839, 841, 843, 1156, 844, - - 846, 848, 1155, 1154, 847, 1153, 1152, 852, 850, 849, - 853, 855, 860, 863, 867, 1151, 870, 871, 1150, 873, - 874, 875, 876, 877, 878, 879, 1149, 1148, 887, 882, - 1147, 1146, 1145, 888, 893, 1144, 880, 898, 901, 900, - 1143, 904, 1142, 1141, 1140, 1139, 908, 902, 910, 1138, - 912, 914, 1137, 1136, 1135, 1134, 1133, 913, 1132, 1131, - 1130, 915, 916, 918, 920, 917, 1129, 922, 1128, 928, - 1127, 1126, 931, 932, 935, 936, 939, 1125, 940, 937, - 941, 942, 943, 950, 944, 947, 1124, 955, 958, 960, - 962, 963, 968, 969, 972, 1123, 973, 976, 977, 978, - - 1122, 974, 979, 981, 982, 1121, 1118, 1108, 985, 1107, - 984, 988, 1001, 1106, 1002, 1003, 1005, 1105, 990, 1103, - 1102, 1006, 1010, 994, 1015, 1012, 1014, 1016, 1021, 1022, - 1024, 1025, 1026, 1101, 1027, 1030, 1032, 1033, 1036, 1038, - 1034, 1100, 1039, 1035, 1049, 1052, 1098, 1053, 1042, 1055, - 1054, 1097, 1058, 1093, 1059, 1063, 1060, 1061, 1066, 1072, - 1069, 1075, 1077, 1079, 1080, 1081, 1091, 1082, 1083, 726, - 1088, 616, 1085, 615, 515, 476, 1089, 370, 1249, 1124, - 1126, 341, 1130, 151 + 46, 317, 318, 325, 326, 329, 333, 327, 334, 330, + 351, 342, 346, 1204, 358, 354, 337, 361, 360, 363, + 362, 366, 369, 383, 364, 271, 381, 388, 231, 370, + 397, 1203, 0, 402, 406, 1202, 429, 446, 0, 1201, + 406, 412, 1200, 407, 410, 1199, 408, 1198, 413, 419, + 422, 1197, 433, 414, 447, 448, 435, 449, 452, 451, + 454, 459, 455, 458, 460, 180, 466, 462, 469, 475, + 463, 470, 473, 478, 474, 485, 482, 486, 488, 496, + 497, 498, 499, 501, 503, 1196, 506, 1195, 1194, 1193, + 1192, 1191, 1190, 504, 1189, 1188, 511, 507, 1187, 535, + + 512, 514, 513, 517, 523, 1186, 1185, 1184, 529, 515, + 547, 548, 1183, 1182, 549, 551, 1181, 552, 553, 558, + 554, 561, 555, 557, 559, 1180, 1179, 1178, 560, 563, + 1177, 562, 1176, 567, 1175, 1174, 577, 574, 582, 571, + 585, 510, 588, 591, 592, 1173, 594, 595, 1227, 604, + 623, 612, 627, 632, 597, 599, 633, 1172, 634, 635, + 1171, 1170, 636, 615, 637, 639, 641, 642, 644, 645, + 647, 648, 649, 652, 656, 659, 1169, 1168, 658, 663, + 667, 664, 1167, 1166, 668, 669, 1165, 673, 672, 675, + 676, 678, 680, 679, 684, 1164, 1163, 1162, 685, 687, + + 1161, 677, 690, 698, 0, 700, 1160, 704, 705, 1159, + 706, 708, 710, 711, 1158, 714, 715, 1157, 724, 720, + 1156, 725, 1155, 727, 1154, 1153, 728, 726, 730, 734, + 731, 1152, 741, 742, 1151, 743, 1150, 745, 744, 1149, + 753, 1148, 753, 746, 1147, 747, 761, 759, 765, 770, + 756, 773, 771, 774, 776, 778, 780, 781, 1146, 782, + 1145, 1144, 783, 786, 784, 791, 787, 792, 794, 798, + 803, 804, 1143, 806, 805, 809, 810, 811, 812, 818, + 1142, 807, 824, 1141, 826, 827, 829, 1140, 411, 828, + 830, 1139, 1138, 833, 1137, 1136, 835, 832, 834, 838, + + 843, 845, 836, 844, 1135, 853, 846, 1134, 854, 855, + 858, 863, 860, 865, 867, 1133, 1132, 870, 864, 1131, + 1130, 1129, 873, 868, 1128, 879, 881, 889, 876, 1127, + 891, 1126, 1125, 1124, 1123, 892, 878, 893, 1122, 896, + 897, 1121, 1120, 1119, 1118, 1117, 900, 1116, 1115, 1114, + 901, 902, 903, 904, 906, 1113, 908, 1112, 909, 1111, + 1110, 914, 915, 918, 919, 920, 1109, 921, 922, 925, + 926, 928, 933, 932, 937, 1108, 938, 943, 945, 946, + 947, 951, 948, 953, 1107, 956, 959, 961, 957, 1106, + 962, 968, 965, 967, 1105, 1104, 1103, 973, 1102, 969, + + 972, 975, 1101, 983, 987, 989, 1098, 974, 1088, 1086, + 991, 994, 993, 995, 998, 999, 1001, 1004, 1005, 1006, + 1007, 1010, 1085, 1009, 1013, 1012, 1017, 1021, 1024, 1018, + 1084, 1025, 1032, 1035, 1036, 1083, 1037, 1019, 1026, 1038, + 1082, 1043, 1077, 1044, 1045, 1049, 1048, 1053, 1054, 1056, + 1057, 1060, 1063, 1058, 1066, 1076, 1064, 1073, 877, 1068, + 760, 1071, 707, 604, 522, 1069, 368, 1227, 1104, 1106, + 349, 1110, 151 } ; -static yyconst short int yy_def[585] = +static yyconst short int yy_def[574] = { 0, - 579, 1, 579, 579, 579, 579, 580, 581, 582, 579, - 581, 581, 581, 581, 583, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 580, 579, 581, 579, - 584, 584, 579, 579, 581, 581, 581, 581, 581, 583, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 579, 584, 584, 579, 581, 581, 581, 49, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 49, - - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 579, - 579, 579, 579, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - - 581, 581, 581, 581, 581, 200, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 579, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 581, 581, 581, 581, 581, 0, 579, - 579, 579, 579, 579 + 568, 1, 568, 568, 568, 568, 569, 570, 571, 568, + 570, 570, 570, 570, 572, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 569, 568, 570, 568, + 573, 573, 568, 568, 570, 570, 570, 570, 570, 572, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 568, 573, 573, 568, 570, 570, 570, 49, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 49, + + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 568, 568, + 568, 568, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + + 570, 570, 570, 570, 200, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 568, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 0, 568, 568, + 568, 568, 568 } ; -static yyconst short int yy_nxt[1293] = +static yyconst short int yy_nxt[1271] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 14, 4, 15, 8, 8, 8, 16, 17, @@ -617,107 +613,105 @@ 43, 43, 43, 40, 109, 40, 110, 111, 40, 112, 101, 40, 152, 40, 40, 135, 44, 44, 44, 44, - 117, 166, 118, 119, 147, 120, 151, 121, 279, 122, + 117, 166, 118, 119, 147, 120, 151, 121, 278, 122, 40, 123, 40, 40, 40, 124, 125, 47, 45, 45, 45, 45, 40, 137, 137, 137, 137, 40, 159, 153, - 138, 154, 246, 156, 40, 162, 138, 47, 48, 48, + 138, 154, 245, 156, 40, 162, 138, 47, 48, 48, 48, 48, 40, 139, 139, 139, 139, 40, 40, 139, 139, 40, 139, 139, 139, 139, 139, 139, 157, 148, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 158, 149, 168, 170, 40, 163, 40, 165, 242, 40, + 158, 149, 168, 170, 40, 163, 40, 165, 241, 40, 167, 40, 164, 173, 172, 178, 169, 174, 171, 40, 40, 175, 176, 179, 177, 181, 184, 40, 40, 180, 40, 183, 40, 40, 40, 185, 40, 182, 40, 40, 40, 194, 189, 186, 40, 187, 40, 191, 193, 40, 40, 40, 188, 196, 195, 198, 190, 197, 40, 40, - 40, 192, 40, 41, 202, 203, 40, 40, 207, 214, - 40, 40, 199, 204, 212, 40, 216, 209, 201, 40, - 210, 205, 208, 215, 40, 206, 211, 40, 217, 213, - 218, 40, 219, 40, 224, 40, 40, 40, 40, 225, - 220, 40, 40, 40, 222, 40, 226, 228, 221, 241, - 232, 240, 230, 235, 236, 223, 227, 40, 231, 233, - - 40, 229, 40, 237, 234, 245, 238, 40, 40, 40, - 243, 239, 244, 134, 134, 134, 134, 251, 251, 251, - 251, 40, 40, 247, 252, 40, 257, 40, 248, 303, - 252, 258, 256, 40, 249, 137, 137, 137, 137, 40, - 260, 264, 138, 40, 40, 40, 259, 40, 138, 253, - 254, 261, 255, 255, 255, 255, 40, 40, 262, 40, - 263, 40, 40, 40, 267, 40, 266, 40, 40, 265, - 40, 40, 274, 272, 270, 40, 268, 269, 271, 40, - 280, 273, 40, 40, 275, 40, 40, 40, 40, 40, - 40, 287, 276, 40, 277, 284, 286, 40, 278, 40, - - 40, 282, 285, 40, 283, 289, 290, 288, 291, 281, - 40, 293, 294, 40, 295, 40, 40, 40, 40, 40, - 40, 297, 292, 40, 40, 40, 298, 40, 40, 40, - 40, 40, 300, 296, 302, 339, 310, 299, 40, 40, - 304, 317, 301, 305, 306, 306, 306, 306, 307, 308, - 306, 306, 309, 306, 306, 306, 306, 306, 306, 40, - 316, 315, 40, 40, 40, 40, 40, 40, 311, 40, - 312, 318, 40, 40, 313, 40, 314, 40, 40, 40, - 320, 319, 323, 324, 326, 40, 321, 328, 325, 322, - 40, 40, 327, 40, 40, 40, 329, 332, 40, 40, - - 334, 40, 330, 335, 341, 40, 336, 333, 331, 340, - 40, 337, 40, 40, 343, 40, 338, 40, 40, 342, - 251, 251, 251, 251, 348, 352, 40, 252, 40, 40, - 344, 351, 347, 252, 253, 253, 345, 346, 346, 346, - 346, 346, 346, 346, 346, 255, 255, 255, 255, 40, - 255, 255, 255, 255, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 356, 40, 40, 40, 361, - 40, 40, 349, 350, 355, 357, 363, 364, 40, 359, - 353, 354, 360, 40, 40, 365, 40, 362, 358, 40, - 40, 40, 40, 366, 40, 372, 40, 40, 40, 371, - - 373, 40, 40, 40, 40, 40, 367, 378, 368, 40, - 369, 377, 40, 370, 40, 374, 376, 375, 380, 379, - 381, 40, 40, 385, 382, 40, 40, 387, 383, 388, - 386, 40, 40, 40, 40, 384, 40, 40, 40, 40, - 390, 392, 394, 40, 396, 389, 397, 40, 398, 395, - 40, 402, 399, 40, 391, 393, 401, 400, 40, 40, - 403, 40, 40, 40, 40, 40, 40, 404, 40, 405, - 408, 40, 406, 407, 40, 40, 40, 40, 40, 409, - 424, 413, 416, 40, 417, 410, 40, 411, 415, 40, - 419, 412, 40, 414, 346, 346, 346, 346, 40, 421, - - 418, 40, 40, 420, 40, 40, 422, 423, 425, 40, - 40, 40, 40, 427, 40, 40, 40, 430, 431, 40, - 40, 426, 428, 40, 40, 432, 429, 433, 435, 40, - 40, 436, 434, 40, 40, 40, 437, 40, 40, 441, - 40, 439, 444, 443, 40, 40, 438, 445, 440, 446, - 442, 40, 40, 447, 40, 449, 40, 40, 448, 40, - 40, 40, 40, 40, 452, 40, 40, 451, 40, 454, - 456, 459, 458, 40, 450, 453, 40, 461, 463, 457, - 40, 462, 455, 40, 40, 460, 40, 40, 40, 40, - 40, 40, 40, 40, 469, 40, 466, 465, 471, 464, - - 40, 40, 480, 468, 475, 476, 40, 467, 478, 473, - 474, 40, 472, 40, 40, 40, 470, 40, 477, 482, - 481, 40, 479, 40, 484, 40, 40, 40, 40, 40, - 40, 40, 486, 40, 488, 40, 483, 489, 490, 493, - 487, 40, 485, 491, 40, 40, 494, 495, 40, 40, - 40, 492, 40, 40, 40, 40, 40, 40, 496, 497, - 40, 502, 503, 40, 501, 498, 499, 504, 40, 505, - 506, 40, 508, 40, 500, 40, 40, 507, 513, 509, - 512, 40, 40, 510, 514, 40, 40, 40, 516, 40, - 40, 40, 40, 511, 40, 40, 518, 40, 40, 515, - - 522, 40, 523, 40, 526, 517, 528, 40, 529, 524, - 519, 527, 520, 521, 40, 40, 40, 525, 40, 40, - 530, 532, 531, 40, 535, 40, 534, 40, 40, 40, - 537, 533, 536, 538, 40, 40, 541, 40, 40, 40, - 40, 539, 544, 40, 546, 40, 40, 40, 40, 40, - 543, 40, 40, 545, 547, 40, 540, 542, 551, 548, - 552, 554, 40, 555, 549, 40, 40, 40, 40, 550, - 553, 40, 40, 40, 40, 558, 40, 556, 559, 40, - 557, 560, 40, 564, 561, 40, 565, 563, 40, 562, - 40, 566, 40, 40, 40, 40, 40, 571, 40, 572, - - 567, 40, 40, 568, 40, 569, 40, 577, 576, 570, - 40, 40, 575, 40, 40, 40, 40, 574, 40, 40, - 40, 40, 573, 578, 37, 37, 37, 37, 39, 39, + 40, 192, 40, 40, 202, 203, 40, 40, 206, 213, + 40, 41, 199, 204, 211, 40, 215, 208, 201, 40, + 209, 216, 207, 214, 40, 205, 210, 40, 218, 212, + 217, 40, 219, 40, 40, 40, 40, 40, 224, 40, + 220, 40, 40, 40, 221, 227, 223, 225, 231, 240, + 234, 235, 229, 226, 40, 222, 40, 232, 230, 228, + + 236, 40, 233, 237, 246, 239, 244, 242, 238, 243, + 40, 134, 134, 134, 134, 250, 250, 250, 250, 40, + 40, 40, 251, 40, 40, 40, 40, 40, 251, 257, + 255, 247, 40, 260, 259, 40, 443, 248, 137, 137, + 137, 137, 40, 256, 258, 138, 40, 261, 40, 264, + 262, 138, 252, 253, 263, 254, 254, 254, 254, 40, + 40, 40, 40, 267, 40, 40, 266, 40, 40, 265, + 271, 40, 40, 40, 269, 40, 40, 268, 270, 40, + 272, 273, 40, 40, 279, 285, 40, 40, 40, 286, + 275, 40, 277, 274, 276, 40, 289, 283, 40, 40, + + 281, 40, 280, 282, 284, 287, 288, 290, 293, 40, + 40, 40, 40, 292, 40, 294, 40, 40, 296, 40, + 40, 291, 297, 40, 40, 40, 40, 40, 40, 299, + 40, 335, 295, 298, 301, 40, 40, 302, 312, 309, + 300, 303, 40, 304, 305, 305, 305, 305, 306, 308, + 305, 305, 307, 305, 305, 305, 305, 305, 305, 310, + 40, 40, 40, 311, 40, 40, 40, 40, 40, 313, + 40, 40, 40, 40, 40, 40, 40, 323, 315, 314, + 40, 318, 319, 321, 40, 316, 320, 40, 317, 329, + 40, 322, 328, 324, 327, 40, 326, 325, 40, 330, + + 331, 40, 333, 334, 40, 40, 336, 40, 40, 338, + 40, 332, 40, 250, 250, 250, 250, 40, 337, 343, + 251, 341, 341, 341, 341, 339, 251, 342, 40, 252, + 252, 340, 341, 341, 341, 341, 254, 254, 254, 254, + 40, 254, 254, 254, 254, 40, 40, 40, 40, 40, + 40, 348, 40, 346, 40, 40, 347, 40, 40, 351, + 40, 40, 40, 344, 345, 40, 356, 350, 352, 40, + 358, 40, 40, 349, 354, 355, 40, 40, 359, 360, + 40, 40, 40, 357, 353, 40, 40, 367, 40, 40, + 40, 40, 40, 40, 361, 368, 366, 40, 40, 362, + + 40, 365, 363, 40, 364, 372, 369, 371, 373, 370, + 374, 40, 375, 40, 378, 377, 376, 40, 40, 40, + 40, 40, 381, 40, 40, 383, 379, 40, 40, 380, + 382, 385, 386, 40, 387, 389, 388, 40, 40, 40, + 40, 40, 384, 40, 40, 392, 390, 40, 391, 393, + 395, 394, 397, 396, 40, 40, 40, 40, 40, 40, + 40, 398, 341, 341, 341, 341, 40, 406, 402, 40, + 404, 405, 40, 40, 40, 399, 400, 409, 40, 401, + 403, 408, 407, 40, 40, 410, 40, 40, 411, 40, + 412, 40, 413, 40, 40, 40, 40, 40, 416, 40, + + 40, 419, 420, 414, 40, 40, 415, 40, 417, 421, + 418, 40, 422, 424, 423, 425, 40, 40, 40, 40, + 40, 426, 40, 40, 40, 40, 430, 432, 428, 433, + 427, 40, 434, 435, 436, 429, 431, 40, 438, 40, + 40, 40, 40, 40, 437, 40, 40, 40, 40, 40, + 441, 40, 445, 448, 440, 447, 40, 40, 40, 40, + 439, 442, 450, 452, 444, 446, 40, 40, 40, 451, + 449, 40, 453, 40, 454, 458, 40, 40, 40, 455, + 40, 40, 456, 40, 457, 460, 40, 464, 465, 40, + 40, 40, 40, 467, 40, 461, 462, 468, 463, 459, + + 466, 469, 40, 470, 40, 40, 40, 471, 475, 40, + 40, 473, 472, 40, 40, 40, 40, 40, 477, 40, + 478, 40, 40, 476, 482, 479, 474, 40, 40, 480, + 483, 40, 40, 40, 40, 40, 484, 481, 40, 40, + 486, 40, 491, 492, 485, 40, 40, 490, 487, 488, + 40, 40, 493, 494, 495, 497, 40, 489, 40, 40, + 40, 40, 496, 502, 40, 501, 40, 498, 503, 40, + 40, 505, 40, 499, 40, 40, 500, 507, 40, 511, + 40, 40, 40, 504, 506, 40, 40, 40, 40, 515, + 512, 517, 518, 508, 519, 509, 40, 510, 513, 516, + + 40, 514, 40, 520, 40, 521, 40, 40, 40, 524, + 523, 40, 40, 527, 40, 522, 525, 40, 40, 40, + 40, 530, 40, 40, 533, 40, 40, 528, 535, 526, + 40, 40, 40, 532, 40, 534, 536, 40, 40, 40, + 531, 529, 537, 540, 538, 40, 541, 543, 40, 40, + 40, 40, 549, 539, 542, 548, 40, 40, 40, 547, + 544, 40, 40, 545, 546, 553, 40, 40, 550, 40, + 40, 40, 552, 40, 551, 554, 40, 40, 555, 40, + 560, 40, 40, 561, 40, 557, 40, 556, 565, 40, + 40, 559, 558, 566, 564, 40, 40, 40, 40, 40, + + 562, 40, 563, 567, 37, 37, 37, 37, 39, 39, 50, 40, 50, 50, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, @@ -725,21 +719,19 @@ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 250, 40, - 40, 40, 40, 40, 132, 40, 38, 579, 3, 579, - 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579 + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 249, 40, 40, 40, + 40, 40, 132, 40, 38, 568, 3, 568, 568, 568, + 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + 568, 568, 568, 568, 568, 568, 568, 568, 568, 568 } ; -static yyconst short int yy_chk[1293] = +static yyconst short int yy_chk[1271] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -757,7 +749,7 @@ 19, 21, 26, 24, 23, 23, 21, 24, 21, 21, 29, 26, 28, 31, 34, 67, 21, 68, 31, 29, 21, 54, 21, 34, 28, 68, 26, 27, 35, 35, - 28, 31, 33, 584, 31, 28, 27, 33, 27, 67, + 28, 31, 33, 573, 31, 28, 27, 33, 27, 67, 54, 31, 27, 36, 27, 52, 27, 35, 27, 30, 33, 55, 36, 30, 42, 42, 42, 42, 52, 30, 52, 30, 30, 55, 30, 30, 30, 55, 30, 43, @@ -778,112 +770,108 @@ 90, 85, 91, 92, 99, 87, 95, 84, 93, 94, 97, 95, 92, 88, 98, 90, 96, 93, 94, 100, 102, 103, 91, 97, 96, 99, 92, 98, 104, 105, - 108, 93, 106, 582, 103, 104, 107, 109, 105, 108, - 110, 117, 100, 104, 107, 116, 109, 106, 102, 112, - 106, 104, 105, 108, 111, 104, 106, 113, 110, 107, - 111, 115, 112, 118, 116, 121, 119, 125, 120, 117, - 113, 122, 124, 578, 115, 123, 118, 120, 113, 125, - 122, 124, 121, 123, 123, 115, 119, 127, 121, 122, - - 128, 120, 130, 123, 122, 128, 123, 131, 142, 194, - 127, 123, 127, 134, 134, 134, 134, 135, 135, 135, - 135, 141, 144, 130, 135, 145, 142, 147, 131, 194, - 135, 144, 141, 153, 131, 137, 137, 137, 137, 137, - 147, 153, 137, 150, 149, 151, 145, 154, 137, 138, - 138, 149, 138, 138, 138, 138, 138, 155, 150, 156, - 151, 157, 158, 162, 156, 159, 155, 160, 161, 154, - 163, 164, 162, 160, 159, 167, 157, 158, 159, 165, - 167, 161, 168, 169, 162, 172, 170, 171, 173, 576, - 174, 172, 163, 177, 164, 170, 171, 175, 165, 176, - - 179, 169, 170, 178, 169, 174, 175, 173, 176, 168, - 180, 177, 178, 181, 179, 182, 183, 184, 185, 187, - 198, 181, 176, 197, 202, 201, 182, 204, 575, 203, - 242, 211, 184, 180, 187, 242, 204, 183, 206, 210, - 197, 211, 185, 198, 200, 200, 200, 200, 201, 202, - 200, 200, 203, 200, 200, 200, 200, 200, 200, 205, - 210, 206, 212, 213, 216, 217, 219, 220, 205, 222, - 205, 212, 221, 225, 205, 223, 205, 226, 224, 231, - 216, 213, 220, 221, 223, 230, 217, 224, 222, 219, - 233, 235, 223, 239, 238, 240, 225, 231, 241, 244, - - 235, 243, 226, 238, 244, 245, 239, 233, 230, 243, - 246, 240, 248, 249, 246, 256, 241, 257, 264, 245, - 251, 251, 251, 251, 257, 264, 261, 251, 574, 572, - 248, 261, 256, 251, 252, 252, 249, 252, 252, 252, - 252, 253, 253, 253, 253, 254, 254, 254, 254, 254, - 255, 255, 255, 255, 255, 258, 260, 265, 266, 267, - 268, 270, 269, 271, 273, 268, 274, 272, 276, 273, - 280, 275, 258, 260, 267, 269, 275, 276, 277, 271, - 265, 266, 272, 281, 286, 277, 282, 274, 270, 283, - 287, 289, 294, 280, 290, 287, 291, 293, 292, 286, - - 289, 295, 300, 296, 303, 305, 281, 294, 282, 301, - 282, 293, 304, 283, 309, 290, 292, 291, 296, 295, - 300, 307, 310, 305, 301, 311, 316, 309, 303, 310, - 307, 312, 313, 314, 317, 304, 325, 318, 319, 570, - 312, 313, 314, 321, 317, 311, 318, 324, 319, 316, - 322, 325, 321, 327, 312, 313, 324, 322, 329, 332, - 327, 333, 336, 334, 338, 335, 339, 329, 341, 332, - 335, 343, 333, 334, 357, 344, 349, 348, 351, 336, - 357, 343, 348, 352, 349, 338, 356, 339, 344, 358, - 352, 341, 354, 343, 346, 346, 346, 346, 353, 354, - - 351, 355, 359, 353, 360, 361, 355, 356, 358, 362, - 363, 365, 368, 360, 369, 370, 372, 363, 365, 371, - 373, 359, 361, 374, 375, 368, 362, 369, 371, 376, - 377, 372, 370, 379, 380, 381, 373, 387, 382, 377, - 383, 375, 381, 380, 384, 385, 374, 382, 376, 383, - 379, 388, 396, 384, 397, 387, 398, 400, 385, 401, - 405, 402, 410, 409, 397, 408, 411, 396, 412, 400, - 402, 409, 408, 413, 388, 398, 414, 411, 413, 405, - 415, 412, 401, 417, 418, 410, 420, 421, 422, 423, - 424, 425, 426, 437, 421, 430, 417, 415, 423, 414, - - 429, 434, 437, 420, 429, 429, 435, 418, 434, 425, - 426, 438, 424, 440, 439, 448, 422, 442, 430, 439, - 438, 447, 435, 449, 442, 451, 458, 452, 462, 463, - 466, 464, 448, 465, 451, 468, 440, 452, 458, 464, - 449, 470, 447, 462, 473, 474, 465, 466, 475, 476, - 480, 463, 477, 479, 481, 482, 483, 485, 468, 470, - 486, 477, 479, 484, 476, 473, 474, 480, 488, 481, - 482, 489, 484, 490, 475, 491, 492, 483, 490, 485, - 489, 493, 494, 486, 491, 495, 497, 502, 493, 498, - 499, 500, 503, 488, 504, 505, 495, 511, 509, 492, - - 500, 512, 502, 519, 505, 494, 511, 524, 512, 503, - 497, 509, 498, 499, 513, 515, 516, 504, 517, 522, - 513, 516, 515, 523, 522, 526, 519, 527, 525, 528, - 524, 517, 523, 525, 529, 530, 528, 531, 532, 533, - 535, 526, 531, 536, 533, 537, 538, 541, 544, 539, - 530, 540, 543, 532, 535, 549, 527, 529, 539, 536, - 540, 543, 545, 544, 537, 546, 548, 551, 550, 538, - 541, 553, 555, 557, 558, 548, 556, 545, 549, 559, - 546, 550, 561, 556, 551, 560, 557, 555, 562, 553, - 563, 558, 564, 565, 566, 568, 569, 563, 573, 564, - - 559, 571, 577, 560, 567, 561, 554, 573, 571, 562, - 552, 547, 568, 542, 534, 521, 520, 566, 518, 514, - 510, 508, 565, 577, 580, 580, 580, 580, 581, 581, - 583, 507, 583, 583, 506, 501, 496, 487, 478, 472, - 471, 469, 467, 461, 460, 459, 457, 456, 455, 454, - 453, 450, 446, 445, 444, 443, 441, 436, 433, 432, - 431, 428, 427, 419, 416, 407, 406, 404, 403, 399, - 395, 394, 393, 392, 391, 390, 389, 386, 378, 367, - 366, 364, 350, 347, 345, 342, 340, 337, 331, 330, - 328, 326, 323, 320, 315, 308, 302, 299, 298, 297, - - 288, 285, 284, 279, 278, 263, 262, 259, 247, 237, - 236, 234, 232, 229, 228, 227, 218, 215, 214, 209, - 208, 207, 199, 196, 195, 193, 192, 191, 190, 189, - 188, 186, 152, 148, 146, 143, 140, 136, 132, 114, - 89, 69, 59, 39, 37, 8, 7, 3, 579, 579, - 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579 - + 108, 93, 106, 110, 103, 104, 107, 109, 105, 108, + 117, 571, 100, 104, 107, 112, 109, 106, 102, 113, + 106, 110, 105, 108, 111, 104, 106, 116, 112, 107, + 111, 115, 113, 119, 118, 121, 120, 125, 117, 122, + 113, 567, 123, 130, 115, 120, 116, 118, 122, 125, + 123, 123, 121, 119, 127, 115, 124, 122, 121, 120, + + 123, 128, 122, 123, 130, 124, 128, 127, 123, 127, + 131, 134, 134, 134, 134, 135, 135, 135, 135, 141, + 144, 147, 135, 145, 389, 142, 149, 154, 135, 144, + 141, 131, 150, 149, 147, 151, 389, 131, 137, 137, + 137, 137, 137, 142, 145, 137, 153, 150, 157, 154, + 151, 137, 138, 138, 153, 138, 138, 138, 138, 138, + 155, 156, 158, 157, 160, 159, 156, 161, 163, 155, + 160, 164, 162, 165, 159, 168, 171, 158, 159, 167, + 161, 162, 169, 172, 167, 171, 173, 175, 170, 172, + 163, 174, 165, 162, 164, 177, 175, 170, 176, 178, + + 169, 179, 168, 169, 170, 173, 174, 176, 178, 180, + 181, 182, 183, 177, 184, 179, 185, 194, 181, 187, + 198, 176, 182, 242, 197, 201, 203, 202, 210, 184, + 204, 242, 180, 183, 187, 565, 205, 194, 210, 204, + 185, 197, 209, 198, 200, 200, 200, 200, 201, 203, + 200, 200, 202, 200, 200, 200, 200, 200, 200, 205, + 211, 212, 215, 209, 216, 218, 219, 221, 223, 211, + 224, 220, 225, 229, 222, 232, 230, 223, 215, 212, + 234, 219, 220, 222, 240, 216, 221, 238, 218, 234, + 237, 222, 232, 224, 230, 239, 229, 225, 241, 237, + + 238, 243, 240, 241, 244, 245, 243, 247, 248, 245, + 255, 239, 256, 250, 250, 250, 250, 564, 244, 256, + 250, 252, 252, 252, 252, 247, 250, 255, 264, 251, + 251, 248, 251, 251, 251, 251, 253, 253, 253, 253, + 253, 254, 254, 254, 254, 254, 257, 259, 260, 263, + 265, 264, 266, 260, 267, 268, 263, 269, 270, 267, + 271, 272, 273, 257, 259, 274, 272, 266, 268, 275, + 274, 279, 276, 265, 270, 271, 280, 282, 275, 276, + 281, 285, 286, 273, 269, 289, 288, 286, 290, 291, + 302, 292, 294, 293, 279, 288, 285, 295, 299, 280, + + 300, 282, 281, 303, 281, 292, 289, 291, 293, 290, + 294, 304, 295, 306, 302, 300, 299, 308, 309, 311, + 563, 312, 306, 313, 314, 309, 303, 316, 317, 304, + 308, 312, 313, 320, 314, 317, 316, 319, 322, 328, + 324, 327, 311, 329, 331, 322, 319, 330, 320, 324, + 328, 327, 330, 329, 333, 334, 336, 339, 338, 344, + 346, 331, 341, 341, 341, 341, 343, 344, 338, 351, + 339, 343, 348, 561, 347, 333, 334, 348, 349, 336, + 338, 347, 346, 350, 353, 349, 352, 354, 350, 355, + 351, 356, 352, 357, 358, 360, 363, 365, 355, 364, + + 367, 358, 360, 353, 366, 368, 354, 369, 356, 363, + 357, 370, 364, 366, 365, 367, 371, 372, 375, 374, + 382, 368, 376, 377, 378, 379, 372, 375, 370, 376, + 369, 380, 377, 378, 379, 371, 374, 383, 382, 385, + 386, 390, 387, 391, 380, 398, 394, 399, 397, 403, + 386, 400, 391, 398, 385, 397, 401, 404, 402, 407, + 383, 387, 400, 402, 390, 394, 406, 409, 410, 401, + 399, 411, 403, 413, 404, 410, 412, 419, 414, 406, + 415, 424, 407, 418, 409, 412, 423, 418, 418, 429, + 559, 437, 426, 423, 427, 413, 414, 424, 415, 411, + + 419, 426, 428, 427, 431, 436, 438, 428, 437, 440, + 441, 431, 429, 447, 451, 452, 453, 454, 440, 455, + 441, 457, 459, 438, 453, 447, 436, 462, 463, 451, + 454, 464, 465, 466, 468, 469, 455, 452, 470, 471, + 459, 472, 466, 468, 457, 474, 473, 465, 462, 463, + 475, 477, 469, 470, 471, 473, 478, 464, 479, 480, + 481, 483, 472, 479, 482, 478, 484, 474, 480, 486, + 489, 482, 487, 475, 488, 491, 477, 484, 493, 489, + 494, 492, 500, 481, 483, 501, 498, 508, 502, 494, + 491, 500, 501, 486, 502, 487, 504, 488, 492, 498, + + 505, 493, 506, 504, 511, 505, 513, 512, 514, 511, + 508, 515, 516, 514, 517, 506, 512, 518, 519, 520, + 521, 517, 524, 522, 520, 526, 525, 515, 522, 513, + 527, 530, 538, 519, 528, 521, 524, 529, 532, 539, + 518, 516, 525, 528, 526, 533, 529, 532, 534, 535, + 537, 540, 539, 527, 530, 538, 542, 544, 545, 537, + 533, 547, 546, 534, 535, 545, 548, 549, 540, 550, + 551, 554, 544, 552, 542, 546, 553, 557, 547, 555, + 552, 560, 566, 553, 562, 549, 558, 548, 560, 556, + 543, 551, 550, 562, 557, 541, 536, 531, 523, 510, + + 554, 509, 555, 566, 569, 569, 569, 569, 570, 570, + 572, 507, 572, 572, 503, 499, 497, 496, 495, 490, + 485, 476, 467, 461, 460, 458, 456, 450, 449, 448, + 446, 445, 444, 443, 442, 439, 435, 434, 433, 432, + 430, 425, 422, 421, 420, 417, 416, 408, 405, 396, + 395, 393, 392, 388, 384, 381, 373, 362, 361, 359, + 345, 342, 340, 337, 335, 332, 326, 325, 323, 321, + 318, 315, 310, 307, 301, 298, 297, 296, 287, 284, + 283, 278, 277, 262, 261, 258, 246, 236, 235, 233, + 231, 228, 227, 226, 217, 214, 213, 208, 207, 206, + + 199, 196, 195, 193, 192, 191, 190, 189, 188, 186, + 152, 148, 146, 143, 140, 136, 132, 114, 89, 69, + 59, 39, 37, 8, 7, 3, 568, 568, 568, 568, + 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + 568, 568, 568, 568, 568, 568, 568, 568, 568, 568 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -900,7 +888,7 @@ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 1 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" #define INITIAL 0 /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===// // @@ -915,7 +903,7 @@ // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#line 28 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 28 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" #include "ParserInternals.h" #include "llvm/Module.h" #include @@ -1048,7 +1036,7 @@ /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing * it to deal with 64 bit numbers. */ -#line 1052 "Lexer.cpp" +#line 1040 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1199,10 +1187,10 @@ register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 186 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 186 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" -#line 1206 "Lexer.cpp" +#line 1194 "Lexer.cpp" if ( yy_init ) { @@ -1250,14 +1238,14 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 580 ) + if ( yy_current_state >= 569 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_current_state != 579 ); + while ( yy_current_state != 568 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -1295,681 +1283,651 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 188 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 188 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 190 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 190 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 191 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 191 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ENDTOK; } YY_BREAK case 4: YY_RULE_SETUP -#line 192 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 192 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TRUETOK; } YY_BREAK case 5: YY_RULE_SETUP -#line 193 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 193 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return FALSETOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 194 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 194 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 195 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 195 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return GLOBAL; } YY_BREAK case 8: YY_RULE_SETUP -#line 196 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 196 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return CONSTANT; } YY_BREAK case 9: YY_RULE_SETUP -#line 197 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 197 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return INTERNAL; } YY_BREAK case 10: YY_RULE_SETUP -#line 198 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 198 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return LINKONCE; } YY_BREAK case 11: YY_RULE_SETUP -#line 199 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 199 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return WEAK; } YY_BREAK case 12: YY_RULE_SETUP -#line 200 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 200 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return APPENDING; } YY_BREAK case 13: YY_RULE_SETUP -#line 201 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 201 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DLLIMPORT; } YY_BREAK case 14: YY_RULE_SETUP -#line 202 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 202 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DLLEXPORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 203 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 203 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return EXTERN_WEAK; } YY_BREAK case 16: YY_RULE_SETUP -#line 204 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 204 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return EXTERNAL; } YY_BREAK case 17: YY_RULE_SETUP -#line 205 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 205 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return IMPLEMENTATION; } YY_BREAK case 18: YY_RULE_SETUP -#line 206 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 206 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ZEROINITIALIZER; } YY_BREAK case 19: YY_RULE_SETUP -#line 207 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 207 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DOTDOTDOT; } YY_BREAK case 20: YY_RULE_SETUP -#line 208 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 208 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UNDEF; } YY_BREAK case 21: YY_RULE_SETUP -#line 209 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 209 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return NULL_TOK; } YY_BREAK case 22: YY_RULE_SETUP -#line 210 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 210 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TO; } YY_BREAK case 23: YY_RULE_SETUP -#line 211 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 211 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TAIL; } YY_BREAK case 24: YY_RULE_SETUP -#line 212 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 212 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TARGET; } YY_BREAK case 25: YY_RULE_SETUP -#line 213 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 213 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TRIPLE; } YY_BREAK case 26: YY_RULE_SETUP -#line 214 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 214 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DEPLIBS; } YY_BREAK case 27: YY_RULE_SETUP -#line 215 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 215 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ENDIAN; } YY_BREAK case 28: YY_RULE_SETUP -#line 216 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 216 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return POINTERSIZE; } YY_BREAK case 29: YY_RULE_SETUP -#line 217 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 217 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return DATALAYOUT; } YY_BREAK case 30: YY_RULE_SETUP -#line 218 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 218 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return LITTLE; } YY_BREAK case 31: YY_RULE_SETUP -#line 219 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 219 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return BIG; } YY_BREAK case 32: YY_RULE_SETUP -#line 220 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 220 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return VOLATILE; } YY_BREAK case 33: YY_RULE_SETUP -#line 221 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 221 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ALIGN; } YY_BREAK case 34: YY_RULE_SETUP -#line 222 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 222 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SECTION; } YY_BREAK case 35: YY_RULE_SETUP -#line 223 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 223 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return MODULE; } YY_BREAK case 36: YY_RULE_SETUP -#line 224 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 224 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ASM_TOK; } YY_BREAK case 37: YY_RULE_SETUP -#line 225 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 225 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SIDEEFFECT; } YY_BREAK case 38: YY_RULE_SETUP -#line 227 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 227 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return CC_TOK; } YY_BREAK case 39: YY_RULE_SETUP -#line 228 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 228 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return CCC_TOK; } YY_BREAK case 40: YY_RULE_SETUP -#line 229 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 229 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return CSRETCC_TOK; } YY_BREAK case 41: YY_RULE_SETUP -#line 230 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 230 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return FASTCC_TOK; } YY_BREAK case 42: YY_RULE_SETUP -#line 231 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 231 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return COLDCC_TOK; } YY_BREAK case 43: YY_RULE_SETUP -#line 232 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 232 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return X86_STDCALLCC_TOK; } YY_BREAK case 44: YY_RULE_SETUP -#line 233 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 233 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return X86_FASTCALLCC_TOK; } YY_BREAK case 45: YY_RULE_SETUP -#line 235 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 235 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::VoidTy, VOID); } YY_BREAK case 46: YY_RULE_SETUP -#line 236 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 236 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::BoolTy, BOOL); } YY_BREAK case 47: YY_RULE_SETUP -#line 237 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 237 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::SByteTy, SBYTE); } YY_BREAK case 48: YY_RULE_SETUP -#line 238 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 238 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::UByteTy, UBYTE); } YY_BREAK case 49: YY_RULE_SETUP -#line 239 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 239 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::ShortTy, SHORT); } YY_BREAK case 50: YY_RULE_SETUP -#line 240 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 240 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::UShortTy,USHORT);} YY_BREAK case 51: YY_RULE_SETUP -#line 241 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 241 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::IntTy, INT); } YY_BREAK case 52: YY_RULE_SETUP -#line 242 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 242 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::UIntTy, UINT); } YY_BREAK case 53: YY_RULE_SETUP -#line 243 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 243 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::LongTy, LONG); } YY_BREAK case 54: YY_RULE_SETUP -#line 244 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 244 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::ULongTy, ULONG); } YY_BREAK case 55: YY_RULE_SETUP -#line 245 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 245 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::FloatTy, FLOAT); } YY_BREAK case 56: YY_RULE_SETUP -#line 246 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 246 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::DoubleTy,DOUBLE);} YY_BREAK case 57: YY_RULE_SETUP -#line 247 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 247 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TY(Type::LabelTy, LABEL); } YY_BREAK case 58: YY_RULE_SETUP -#line 248 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 248 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return TYPE; } YY_BREAK case 59: YY_RULE_SETUP -#line 249 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 249 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OPAQUE; } YY_BREAK case 60: YY_RULE_SETUP -#line 251 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 251 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 61: YY_RULE_SETUP -#line 252 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 252 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 62: YY_RULE_SETUP -#line 253 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 253 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 63: YY_RULE_SETUP -#line 254 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 254 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, UDiv, UDIV); } YY_BREAK case 64: YY_RULE_SETUP -#line 255 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 255 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SDiv, SDIV); } YY_BREAK case 65: YY_RULE_SETUP -#line 256 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 256 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FDiv, FDIV); } YY_BREAK case 66: YY_RULE_SETUP -#line 257 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 257 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, URem, UREM); } YY_BREAK case 67: YY_RULE_SETUP -#line 258 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 258 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SRem, SREM); } YY_BREAK case 68: YY_RULE_SETUP -#line 259 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 259 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FRem, FREM); } YY_BREAK case 69: YY_RULE_SETUP -#line 260 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 260 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, And, AND); } YY_BREAK case 70: YY_RULE_SETUP -#line 261 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 261 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Or , OR ); } YY_BREAK case 71: YY_RULE_SETUP -#line 262 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 262 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Xor, XOR); } YY_BREAK case 72: YY_RULE_SETUP -#line 263 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetNE, SETNE); } - YY_BREAK -case 73: -YY_RULE_SETUP -#line 264 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); } - YY_BREAK -case 74: -YY_RULE_SETUP -#line 265 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetLT, SETLT); } - YY_BREAK -case 75: -YY_RULE_SETUP -#line 266 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetGT, SETGT); } - YY_BREAK -case 76: -YY_RULE_SETUP -#line 267 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetLE, SETLE); } - YY_BREAK -case 77: -YY_RULE_SETUP -#line 268 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetGE, SETGE); } - YY_BREAK -case 78: -YY_RULE_SETUP -#line 269 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 263 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ICmp, ICMP); } YY_BREAK -case 79: +case 73: YY_RULE_SETUP -#line 270 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 264 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, FCmp, FCMP); } YY_BREAK -case 80: +case 74: YY_RULE_SETUP -#line 271 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 265 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return EQ; } YY_BREAK -case 81: +case 75: YY_RULE_SETUP -#line 272 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 266 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return NE; } YY_BREAK -case 82: +case 76: YY_RULE_SETUP -#line 273 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 267 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SLT; } YY_BREAK -case 83: +case 77: YY_RULE_SETUP -#line 274 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 268 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SGT; } YY_BREAK -case 84: +case 78: YY_RULE_SETUP -#line 275 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 269 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SLE; } YY_BREAK -case 85: +case 79: YY_RULE_SETUP -#line 276 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 270 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return SGE; } YY_BREAK -case 86: +case 80: YY_RULE_SETUP -#line 277 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 271 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ULT; } YY_BREAK -case 87: +case 81: YY_RULE_SETUP -#line 278 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 272 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UGT; } YY_BREAK -case 88: +case 82: YY_RULE_SETUP -#line 279 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 273 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ULE; } YY_BREAK -case 89: +case 83: YY_RULE_SETUP -#line 280 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 274 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UGE; } YY_BREAK -case 90: +case 84: YY_RULE_SETUP -#line 281 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 275 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OEQ; } YY_BREAK -case 91: +case 85: YY_RULE_SETUP -#line 282 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 276 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ONE; } YY_BREAK -case 92: +case 86: YY_RULE_SETUP -#line 283 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 277 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OLT; } YY_BREAK -case 93: +case 87: YY_RULE_SETUP -#line 284 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 278 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OGT; } YY_BREAK -case 94: +case 88: YY_RULE_SETUP -#line 285 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 279 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OLE; } YY_BREAK -case 95: +case 89: YY_RULE_SETUP -#line 286 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 280 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return OGE; } YY_BREAK -case 96: +case 90: YY_RULE_SETUP -#line 287 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 281 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return ORD; } YY_BREAK -case 97: +case 91: YY_RULE_SETUP -#line 288 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 282 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UNO; } YY_BREAK -case 98: +case 92: YY_RULE_SETUP -#line 289 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 283 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UEQ; } YY_BREAK -case 99: +case 93: YY_RULE_SETUP -#line 290 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 284 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return UNE; } YY_BREAK -case 100: +case 94: YY_RULE_SETUP -#line 292 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 286 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, PHI, PHI_TOK); } YY_BREAK -case 101: +case 95: YY_RULE_SETUP -#line 293 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 287 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Call, CALL); } YY_BREAK -case 102: +case 96: YY_RULE_SETUP -#line 294 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 288 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, Trunc, TRUNC); } YY_BREAK -case 103: +case 97: YY_RULE_SETUP -#line 295 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 289 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, ZExt, ZEXT); } YY_BREAK -case 104: +case 98: YY_RULE_SETUP -#line 296 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 290 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, SExt, SEXT); } YY_BREAK -case 105: +case 99: YY_RULE_SETUP -#line 297 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 291 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPTrunc, FPTRUNC); } YY_BREAK -case 106: +case 100: YY_RULE_SETUP -#line 298 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 292 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPExt, FPEXT); } YY_BREAK -case 107: +case 101: YY_RULE_SETUP -#line 299 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 293 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, UIToFP, UITOFP); } YY_BREAK -case 108: +case 102: YY_RULE_SETUP -#line 300 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 294 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, SIToFP, SITOFP); } YY_BREAK -case 109: +case 103: YY_RULE_SETUP -#line 301 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 295 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPToUI, FPTOUI); } YY_BREAK -case 110: +case 104: YY_RULE_SETUP -#line 302 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 296 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPToSI, FPTOSI); } YY_BREAK -case 111: +case 105: YY_RULE_SETUP -#line 303 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 297 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, IntToPtr, INTTOPTR); } YY_BREAK -case 112: +case 106: YY_RULE_SETUP -#line 304 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 298 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, PtrToInt, PTRTOINT); } YY_BREAK -case 113: +case 107: YY_RULE_SETUP -#line 305 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 299 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, BitCast, BITCAST); } YY_BREAK -case 114: +case 108: YY_RULE_SETUP -#line 306 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 300 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Select, SELECT); } YY_BREAK -case 115: +case 109: YY_RULE_SETUP -#line 307 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 301 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Shl, SHL); } YY_BREAK -case 116: +case 110: YY_RULE_SETUP -#line 308 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 302 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, LShr, LSHR); } YY_BREAK -case 117: +case 111: YY_RULE_SETUP -#line 309 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 303 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, AShr, ASHR); } YY_BREAK -case 118: +case 112: YY_RULE_SETUP -#line 310 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 304 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, VAArg , VAARG); } YY_BREAK -case 119: +case 113: YY_RULE_SETUP -#line 311 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 305 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Ret, RET); } YY_BREAK -case 120: +case 114: YY_RULE_SETUP -#line 312 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 306 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Br, BR); } YY_BREAK -case 121: +case 115: YY_RULE_SETUP -#line 313 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 307 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK -case 122: +case 116: YY_RULE_SETUP -#line 314 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 308 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Invoke, INVOKE); } YY_BREAK -case 123: +case 117: YY_RULE_SETUP -#line 315 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 309 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK -case 124: +case 118: YY_RULE_SETUP -#line 316 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 310 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } YY_BREAK -case 125: +case 119: YY_RULE_SETUP -#line 318 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 312 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK -case 126: +case 120: YY_RULE_SETUP -#line 319 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 313 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK -case 127: +case 121: YY_RULE_SETUP -#line 320 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 314 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Free, FREE); } YY_BREAK -case 128: +case 122: YY_RULE_SETUP -#line 321 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 315 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK -case 129: +case 123: YY_RULE_SETUP -#line 322 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 316 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Store, STORE); } YY_BREAK -case 130: +case 124: YY_RULE_SETUP -#line 323 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 317 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } YY_BREAK -case 131: +case 125: YY_RULE_SETUP -#line 325 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 319 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } YY_BREAK -case 132: +case 126: YY_RULE_SETUP -#line 326 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 320 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } YY_BREAK -case 133: +case 127: YY_RULE_SETUP -#line 327 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 321 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } YY_BREAK -case 134: +case 128: YY_RULE_SETUP -#line 330 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 324 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { UnEscapeLexed(yytext+1); llvmAsmlval.StrVal = strdup(yytext+1); // Skip % return VAR_ID; } YY_BREAK -case 135: +case 129: YY_RULE_SETUP -#line 335 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 329 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon UnEscapeLexed(yytext); @@ -1977,9 +1935,9 @@ return LABELSTR; } YY_BREAK -case 136: +case 130: YY_RULE_SETUP -#line 341 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 335 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-2] = 0; // nuke colon, end quote UnEscapeLexed(yytext+1); @@ -1987,9 +1945,9 @@ return LABELSTR; } YY_BREAK -case 137: +case 131: YY_RULE_SETUP -#line 348 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 342 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { // Note that we cannot unescape a string constant here! The // string constant might contain a \00 which would not be // understood by the string stuff. It is valid to make a @@ -2000,14 +1958,14 @@ return STRINGCONSTANT; } YY_BREAK -case 138: +case 132: YY_RULE_SETUP -#line 359 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 353 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } YY_BREAK -case 139: +case 133: YY_RULE_SETUP -#line 360 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 354 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -2017,17 +1975,17 @@ return ESINT64VAL; } YY_BREAK -case 140: +case 134: YY_RULE_SETUP -#line 368 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 362 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = HexIntToVal(yytext+3); return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; } YY_BREAK -case 141: +case 135: YY_RULE_SETUP -#line 373 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 367 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -2036,9 +1994,9 @@ return UINTVAL; } YY_BREAK -case 142: +case 136: YY_RULE_SETUP -#line 380 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 374 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+2); // +1: we have bigger negative range @@ -2048,18 +2006,18 @@ return SINTVAL; } YY_BREAK -case 143: +case 137: YY_RULE_SETUP -#line 389 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 383 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } YY_BREAK -case 144: +case 138: YY_RULE_SETUP -#line 390 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 384 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 392 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 386 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { /* Make sure to free the internal buffers for flex when we are * done reading our input! @@ -2068,22 +2026,22 @@ return EOF; } YY_BREAK -case 145: +case 139: YY_RULE_SETUP -#line 400 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 394 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { /* Ignore whitespace */ } YY_BREAK -case 146: +case 140: YY_RULE_SETUP -#line 401 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 395 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" { return yytext[0]; } YY_BREAK -case 147: +case 141: YY_RULE_SETUP -#line 403 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 397 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 2087 "Lexer.cpp" +#line 2045 "Lexer.cpp" case YY_END_OF_BUFFER: { @@ -2370,7 +2328,7 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 580 ) + if ( yy_current_state >= 569 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2400,11 +2358,11 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 580 ) + if ( yy_current_state >= 569 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 579); + yy_is_jam = (yy_current_state == 568); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2961,5 +2919,5 @@ return 0; } #endif -#line 403 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 397 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l" Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.87 llvm/lib/AsmParser/Lexer.l:1.88 --- llvm/lib/AsmParser/Lexer.l:1.87 Sun Dec 3 00:58:07 2006 +++ llvm/lib/AsmParser/Lexer.l Sat Dec 23 00:05:40 2006 @@ -260,12 +260,6 @@ and { RET_TOK(BinaryOpVal, And, AND); } or { RET_TOK(BinaryOpVal, Or , OR ); } xor { RET_TOK(BinaryOpVal, Xor, XOR); } -setne { RET_TOK(BinaryOpVal, SetNE, SETNE); } -seteq { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } -setlt { RET_TOK(BinaryOpVal, SetLT, SETLT); } -setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); } -setle { RET_TOK(BinaryOpVal, SetLE, SETLE); } -setge { RET_TOK(BinaryOpVal, SetGE, SETGE); } icmp { RET_TOK(OtherOpVal, ICmp, ICMP); } fcmp { RET_TOK(OtherOpVal, FCmp, FCMP); } eq { return EQ; } Index: llvm/lib/AsmParser/Lexer.l.cvs diff -u llvm/lib/AsmParser/Lexer.l.cvs:1.14 llvm/lib/AsmParser/Lexer.l.cvs:1.15 --- llvm/lib/AsmParser/Lexer.l.cvs:1.14 Sun Dec 3 00:59:29 2006 +++ llvm/lib/AsmParser/Lexer.l.cvs Sat Dec 23 00:05:40 2006 @@ -260,12 +260,6 @@ and { RET_TOK(BinaryOpVal, And, AND); } or { RET_TOK(BinaryOpVal, Or , OR ); } xor { RET_TOK(BinaryOpVal, Xor, XOR); } -setne { RET_TOK(BinaryOpVal, SetNE, SETNE); } -seteq { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } -setlt { RET_TOK(BinaryOpVal, SetLT, SETLT); } -setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); } -setle { RET_TOK(BinaryOpVal, SetLE, SETLE); } -setge { RET_TOK(BinaryOpVal, SetGE, SETGE); } icmp { RET_TOK(OtherOpVal, ICmp, ICMP); } fcmp { RET_TOK(OtherOpVal, FCmp, FCMP); } eq { return EQ; } Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.37 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.38 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.37 Fri Dec 8 12:07:06 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Sat Dec 23 00:05:40 2006 @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ +/* A Bison parser, made by GNU Bison 2.1. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -36,6 +36,9 @@ /* Identify Bison output. */ #define YYBISON 1 +/* Bison version. */ +#define YYBISON_VERSION "2.1" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -45,8 +48,7 @@ /* Using locations. */ #define YYLSP_NEEDED 0 -/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +/* Substitute the variable and function names. */ #define yyparse llvmAsmparse #define yylex llvmAsmlex #define yyerror llvmAsmerror @@ -149,63 +151,58 @@ AND = 342, OR = 343, XOR = 344, - SETLE = 345, - SETGE = 346, - SETLT = 347, - SETGT = 348, - SETEQ = 349, - SETNE = 350, - ICMP = 351, - FCMP = 352, - EQ = 353, - NE = 354, - SLT = 355, - SGT = 356, - SLE = 357, - SGE = 358, - ULT = 359, - UGT = 360, - ULE = 361, - UGE = 362, - OEQ = 363, - ONE = 364, - OLT = 365, - OGT = 366, - OLE = 367, - OGE = 368, - ORD = 369, - UNO = 370, - UEQ = 371, - UNE = 372, - MALLOC = 373, - ALLOCA = 374, - FREE = 375, - LOAD = 376, - STORE = 377, - GETELEMENTPTR = 378, - TRUNC = 379, - ZEXT = 380, - SEXT = 381, - FPTRUNC = 382, - FPEXT = 383, - BITCAST = 384, - UITOFP = 385, - SITOFP = 386, - FPTOUI = 387, - FPTOSI = 388, - INTTOPTR = 389, - PTRTOINT = 390, - PHI_TOK = 391, - SELECT = 392, - SHL = 393, - LSHR = 394, - ASHR = 395, - VAARG = 396, - EXTRACTELEMENT = 397, - INSERTELEMENT = 398, - SHUFFLEVECTOR = 399 + ICMP = 345, + FCMP = 346, + EQ = 347, + NE = 348, + SLT = 349, + SGT = 350, + SLE = 351, + SGE = 352, + ULT = 353, + UGT = 354, + ULE = 355, + UGE = 356, + OEQ = 357, + ONE = 358, + OLT = 359, + OGT = 360, + OLE = 361, + OGE = 362, + ORD = 363, + UNO = 364, + UEQ = 365, + UNE = 366, + MALLOC = 367, + ALLOCA = 368, + FREE = 369, + LOAD = 370, + STORE = 371, + GETELEMENTPTR = 372, + TRUNC = 373, + ZEXT = 374, + SEXT = 375, + FPTRUNC = 376, + FPEXT = 377, + BITCAST = 378, + UITOFP = 379, + SITOFP = 380, + FPTOUI = 381, + FPTOSI = 382, + INTTOPTR = 383, + PTRTOINT = 384, + PHI_TOK = 385, + SELECT = 386, + SHL = 387, + LSHR = 388, + ASHR = 389, + VAARG = 390, + EXTRACTELEMENT = 391, + INSERTELEMENT = 392, + SHUFFLEVECTOR = 393 }; #endif +/* Tokens. */ #define ESINT64VAL 258 #define EUINT64VAL 259 #define SINTVAL 260 @@ -293,67 +290,61 @@ #define AND 342 #define OR 343 #define XOR 344 -#define SETLE 345 -#define SETGE 346 -#define SETLT 347 -#define SETGT 348 -#define SETEQ 349 -#define SETNE 350 -#define ICMP 351 -#define FCMP 352 -#define EQ 353 -#define NE 354 -#define SLT 355 -#define SGT 356 -#define SLE 357 -#define SGE 358 -#define ULT 359 -#define UGT 360 -#define ULE 361 -#define UGE 362 -#define OEQ 363 -#define ONE 364 -#define OLT 365 -#define OGT 366 -#define OLE 367 -#define OGE 368 -#define ORD 369 -#define UNO 370 -#define UEQ 371 -#define UNE 372 -#define MALLOC 373 -#define ALLOCA 374 -#define FREE 375 -#define LOAD 376 -#define STORE 377 -#define GETELEMENTPTR 378 -#define TRUNC 379 -#define ZEXT 380 -#define SEXT 381 -#define FPTRUNC 382 -#define FPEXT 383 -#define BITCAST 384 -#define UITOFP 385 -#define SITOFP 386 -#define FPTOUI 387 -#define FPTOSI 388 -#define INTTOPTR 389 -#define PTRTOINT 390 -#define PHI_TOK 391 -#define SELECT 392 -#define SHL 393 -#define LSHR 394 -#define ASHR 395 -#define VAARG 396 -#define EXTRACTELEMENT 397 -#define INSERTELEMENT 398 -#define SHUFFLEVECTOR 399 +#define ICMP 345 +#define FCMP 346 +#define EQ 347 +#define NE 348 +#define SLT 349 +#define SGT 350 +#define SLE 351 +#define SGE 352 +#define ULT 353 +#define UGT 354 +#define ULE 355 +#define UGE 356 +#define OEQ 357 +#define ONE 358 +#define OLT 359 +#define OGT 360 +#define OLE 361 +#define OGE 362 +#define ORD 363 +#define UNO 364 +#define UEQ 365 +#define UNE 366 +#define MALLOC 367 +#define ALLOCA 368 +#define FREE 369 +#define LOAD 370 +#define STORE 371 +#define GETELEMENTPTR 372 +#define TRUNC 373 +#define ZEXT 374 +#define SEXT 375 +#define FPTRUNC 376 +#define FPEXT 377 +#define BITCAST 378 +#define UITOFP 379 +#define SITOFP 380 +#define FPTOUI 381 +#define FPTOSI 382 +#define INTTOPTR 383 +#define PTRTOINT 384 +#define PHI_TOK 385 +#define SELECT 386 +#define SHL 387 +#define LSHR 388 +#define ASHR 389 +#define VAARG 390 +#define EXTRACTELEMENT 391 +#define INSERTELEMENT 392 +#define SHUFFLEVECTOR 393 /* Copy the first part of user declarations. */ -#line 14 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" +#line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1208,8 +1199,13 @@ # define YYERROR_VERBOSE 0 #endif +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 855 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" +#line 855 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1252,8 +1248,8 @@ llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; } YYSTYPE; -/* Line 191 of yacc.c. */ -#line 1257 "llvmAsmParser.tab.c" +/* Line 196 of yacc.c. */ +#line 1253 "llvmAsmParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1264,30 +1260,49 @@ /* Copy the second part of user declarations. */ -/* Line 214 of yacc.c. */ -#line 1269 "llvmAsmParser.tab.c" +/* Line 219 of yacc.c. */ +#line 1265 "llvmAsmParser.tab.c" -#if ! defined (yyoverflow) || YYERROR_VERBOSE +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif -# ifndef YYFREE -# define YYFREE free +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif # endif -# ifndef YYMALLOC -# define YYMALLOC malloc +# ifndef YY_ +# define YY_(msgid) msgid # endif +#endif + +#if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# else +# define YYSTACK_ALLOC alloca +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYINCLUDED_STDLIB_H +# endif # endif # endif # endif @@ -1295,13 +1310,39 @@ # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ # endif +# else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# endif +# ifdef __cplusplus +extern "C" { +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifdef __cplusplus +} +# endif # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ @@ -1313,7 +1354,7 @@ /* A type that is properly aligned for any stack member. */ union yyalloc { - short yyss; + short int yyss; YYSTYPE yyvs; }; @@ -1323,7 +1364,7 @@ /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do @@ -1336,7 +1377,7 @@ # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ @@ -1365,28 +1406,28 @@ #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else - typedef short yysigned_char; + typedef short int yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1476 +#define YYLAST 1390 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 159 +#define YYNTOKENS 153 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 78 +#define YYNNTS 76 /* YYNRULES -- Number of rules. */ -#define YYNRULES 299 +#define YYNRULES 291 /* YYNRULES -- Number of states. */ -#define YYNSTATES 584 +#define YYNSTATES 567 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 399 +#define YYMAXUTOK 393 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -1396,15 +1437,15 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 148, 149, 157, 2, 146, 2, 2, 2, 2, 2, + 142, 143, 151, 2, 140, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 153, 145, 154, 2, 2, 2, 2, 2, 2, 2, + 147, 139, 148, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 150, 147, 152, 2, 2, 2, 2, 2, 158, + 2, 144, 141, 146, 2, 2, 2, 2, 2, 152, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 151, 2, 2, 155, 2, 156, 2, 2, 2, 2, + 145, 2, 2, 149, 2, 150, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1431,13 +1472,13 @@ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144 + 135, 136, 137, 138 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short yyprhs[] = +static const unsigned short int yyprhs[] = { 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, @@ -1446,168 +1487,166 @@ 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, - 139, 141, 143, 145, 147, 149, 151, 153, 156, 157, - 159, 161, 163, 165, 167, 169, 171, 172, 173, 175, - 177, 179, 181, 183, 185, 188, 189, 192, 193, 197, - 200, 201, 203, 204, 208, 210, 213, 215, 217, 219, + 140, 141, 143, 145, 147, 149, 151, 153, 155, 156, + 157, 159, 161, 163, 165, 167, 169, 172, 173, 176, + 177, 181, 184, 185, 187, 188, 192, 194, 197, 199, + 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, - 241, 243, 245, 247, 249, 251, 253, 255, 258, 263, - 269, 275, 279, 282, 288, 293, 296, 298, 302, 304, - 308, 310, 311, 316, 320, 324, 329, 334, 338, 341, - 344, 347, 350, 353, 356, 359, 362, 365, 368, 375, - 381, 390, 397, 404, 411, 419, 427, 434, 441, 450, - 459, 463, 465, 467, 469, 471, 474, 477, 482, 485, - 487, 492, 495, 500, 501, 509, 510, 518, 519, 527, - 528, 536, 540, 545, 546, 548, 550, 552, 556, 560, - 564, 568, 572, 576, 578, 579, 581, 583, 585, 586, - 589, 593, 595, 597, 601, 603, 604, 613, 615, 617, - 621, 623, 625, 628, 629, 631, 633, 634, 639, 640, - 642, 644, 646, 648, 650, 652, 654, 656, 658, 662, - 664, 670, 672, 674, 676, 678, 681, 684, 687, 691, - 694, 695, 697, 700, 703, 707, 717, 727, 736, 750, - 752, 754, 761, 767, 770, 777, 785, 787, 791, 793, - 794, 797, 799, 805, 811, 817, 824, 831, 834, 839, - 844, 851, 856, 861, 868, 875, 878, 886, 888, 891, - 892, 894, 895, 899, 906, 910, 917, 920, 925, 932 + 242, 247, 253, 259, 263, 266, 272, 277, 280, 282, + 286, 288, 292, 294, 295, 300, 304, 308, 313, 318, + 322, 325, 328, 331, 334, 337, 340, 343, 346, 349, + 352, 355, 358, 365, 371, 380, 387, 394, 402, 410, + 417, 424, 433, 442, 446, 448, 450, 452, 454, 457, + 460, 465, 468, 470, 475, 478, 483, 484, 492, 493, + 501, 502, 510, 511, 519, 523, 528, 529, 531, 533, + 535, 539, 543, 547, 551, 555, 559, 561, 562, 564, + 566, 568, 569, 572, 576, 578, 580, 584, 586, 587, + 596, 598, 600, 604, 606, 608, 611, 612, 614, 616, + 617, 622, 623, 625, 627, 629, 631, 633, 635, 637, + 639, 641, 645, 647, 653, 655, 657, 659, 661, 664, + 667, 670, 674, 677, 678, 680, 683, 686, 690, 700, + 710, 719, 733, 735, 737, 744, 750, 753, 760, 768, + 770, 774, 776, 777, 780, 782, 788, 794, 801, 808, + 811, 816, 821, 828, 833, 838, 845, 852, 855, 863, + 865, 868, 869, 871, 872, 876, 883, 887, 894, 897, + 902, 909 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short yyrhs[] = +static const short int yyrhs[] = { - 193, 0, -1, 5, -1, 6, -1, 3, -1, 4, - -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, - -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, - -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, - -1, 93, -1, 94, -1, 95, -1, 124, -1, 125, - -1, 126, -1, 127, -1, 128, -1, 129, -1, 130, - -1, 131, -1, 132, -1, 133, -1, 134, -1, 135, - -1, 138, -1, 139, -1, 140, -1, 98, -1, 99, - -1, 100, -1, 101, -1, 102, -1, 103, -1, 104, - -1, 105, -1, 106, -1, 107, -1, 108, -1, 109, - -1, 110, -1, 111, -1, 112, -1, 113, -1, 114, - -1, 115, -1, 116, -1, 117, -1, 104, -1, 105, - -1, 106, -1, 107, -1, 27, -1, 28, -1, 16, - -1, 14, -1, 12, -1, 10, -1, 17, -1, 15, - -1, 13, -1, 11, -1, 169, -1, 170, -1, 18, - -1, 19, -1, 205, 145, -1, -1, 41, -1, 42, - -1, 43, -1, 44, -1, 45, -1, 46, -1, 47, - -1, -1, -1, 65, -1, 66, -1, 67, -1, 68, - -1, 69, -1, 70, -1, 64, 4, -1, -1, 57, - 4, -1, -1, 146, 57, 4, -1, 34, 24, -1, - -1, 178, -1, -1, 146, 181, 180, -1, 178, -1, - 57, 4, -1, 184, -1, 8, -1, 186, -1, 8, - -1, 186, -1, 9, -1, 10, -1, 11, -1, 12, - -1, 13, -1, 14, -1, 15, -1, 16, -1, 17, - -1, 18, -1, 19, -1, 20, -1, 21, -1, 48, - -1, 185, -1, 220, -1, 147, 4, -1, 183, 148, - 188, 149, -1, 150, 4, 151, 186, 152, -1, 153, - 4, 151, 186, 154, -1, 155, 187, 156, -1, 155, - 156, -1, 153, 155, 187, 156, 154, -1, 153, 155, - 156, 154, -1, 186, 157, -1, 186, -1, 187, 146, - 186, -1, 187, -1, 187, 146, 37, -1, 37, -1, - -1, 184, 150, 191, 152, -1, 184, 150, 152, -1, - 184, 158, 24, -1, 184, 153, 191, 154, -1, 184, - 155, 191, 156, -1, 184, 155, 156, -1, 184, 38, - -1, 184, 39, -1, 184, 220, -1, 184, 190, -1, - 184, 26, -1, 169, 161, -1, 170, 4, -1, 9, - 27, -1, 9, 28, -1, 172, 7, -1, 165, 148, - 189, 36, 184, 149, -1, 123, 148, 189, 234, 149, - -1, 137, 148, 189, 146, 189, 146, 189, 149, -1, - 162, 148, 189, 146, 189, 149, -1, 163, 148, 189, - 146, 189, 149, -1, 164, 148, 189, 146, 189, 149, - -1, 96, 167, 148, 189, 146, 189, 149, -1, 97, - 168, 148, 189, 146, 189, 149, -1, 166, 148, 189, - 146, 189, 149, -1, 142, 148, 189, 146, 189, 149, - -1, 143, 148, 189, 146, 189, 146, 189, 149, -1, - 144, 148, 189, 146, 189, 146, 189, 149, -1, 191, - 146, 189, -1, 189, -1, 32, -1, 33, -1, 194, - -1, 194, 214, -1, 194, 216, -1, 194, 62, 61, - 200, -1, 194, 25, -1, 195, -1, 195, 173, 20, - 182, -1, 195, 216, -1, 195, 62, 61, 200, -1, - -1, 195, 173, 174, 192, 189, 196, 180, -1, -1, - 195, 173, 50, 192, 184, 197, 180, -1, -1, 195, - 173, 45, 192, 184, 198, 180, -1, -1, 195, 173, - 47, 192, 184, 199, 180, -1, 195, 51, 202, -1, - 195, 58, 145, 203, -1, -1, 24, -1, 56, -1, - 55, -1, 53, 145, 201, -1, 54, 145, 4, -1, - 52, 145, 24, -1, 71, 145, 24, -1, 150, 204, - 152, -1, 204, 146, 24, -1, 24, -1, -1, 22, - -1, 24, -1, 205, -1, -1, 184, 206, -1, 208, - 146, 207, -1, 207, -1, 208, -1, 208, 146, 37, - -1, 37, -1, -1, 175, 182, 205, 148, 209, 149, - 179, 176, -1, 29, -1, 155, -1, 174, 210, 211, - -1, 30, -1, 156, -1, 223, 213, -1, -1, 45, - -1, 47, -1, -1, 31, 217, 215, 210, -1, -1, - 63, -1, 3, -1, 4, -1, 7, -1, 27, -1, - 28, -1, 38, -1, 39, -1, 26, -1, 153, 191, - 154, -1, 190, -1, 61, 218, 24, 146, 24, -1, - 160, -1, 205, -1, 220, -1, 219, -1, 184, 221, - -1, 223, 224, -1, 212, 224, -1, 225, 173, 226, - -1, 225, 228, -1, -1, 23, -1, 72, 222, -1, - 72, 8, -1, 73, 21, 221, -1, 73, 9, 221, - 146, 21, 221, 146, 21, 221, -1, 74, 171, 221, - 146, 21, 221, 150, 227, 152, -1, 74, 171, 221, - 146, 21, 221, 150, 152, -1, 75, 175, 182, 221, - 148, 231, 149, 36, 21, 221, 76, 21, 221, -1, - 76, -1, 77, -1, 227, 171, 219, 146, 21, 221, - -1, 171, 219, 146, 21, 221, -1, 173, 233, -1, - 184, 150, 221, 146, 221, 152, -1, 229, 146, 150, - 221, 146, 221, 152, -1, 222, -1, 230, 146, 222, - -1, 230, -1, -1, 60, 59, -1, 59, -1, 162, - 184, 221, 146, 221, -1, 163, 184, 221, 146, 221, - -1, 164, 184, 221, 146, 221, -1, 96, 167, 184, - 221, 146, 221, -1, 97, 168, 184, 221, 146, 221, - -1, 49, 222, -1, 166, 222, 146, 222, -1, 165, - 222, 36, 184, -1, 137, 222, 146, 222, 146, 222, - -1, 141, 222, 146, 184, -1, 142, 222, 146, 222, - -1, 143, 222, 146, 222, 146, 222, -1, 144, 222, - 146, 222, 146, 222, -1, 136, 229, -1, 232, 175, - 182, 221, 148, 231, 149, -1, 236, -1, 146, 230, - -1, -1, 35, -1, -1, 118, 184, 177, -1, 118, - 184, 146, 15, 221, 177, -1, 119, 184, 177, -1, - 119, 184, 146, 15, 221, 177, -1, 120, 222, -1, - 235, 121, 184, 221, -1, 235, 122, 222, 146, 184, - 221, -1, 123, 184, 221, 234, -1 + 185, 0, -1, 5, -1, 6, -1, 78, -1, 79, + -1, 80, -1, 81, -1, 82, -1, 83, -1, 84, + -1, 85, -1, 86, -1, 87, -1, 88, -1, 89, + -1, 118, -1, 119, -1, 120, -1, 121, -1, 122, + -1, 123, -1, 124, -1, 125, -1, 126, -1, 127, + -1, 128, -1, 129, -1, 132, -1, 133, -1, 134, + -1, 92, -1, 93, -1, 94, -1, 95, -1, 96, + -1, 97, -1, 98, -1, 99, -1, 100, -1, 101, + -1, 102, -1, 103, -1, 104, -1, 105, -1, 106, + -1, 107, -1, 108, -1, 109, -1, 110, -1, 111, + -1, 98, -1, 99, -1, 100, -1, 101, -1, 27, + -1, 28, -1, 16, -1, 14, -1, 12, -1, 10, + -1, 17, -1, 15, -1, 13, -1, 11, -1, 161, + -1, 162, -1, 18, -1, 19, -1, 197, 139, -1, + -1, 41, -1, 42, -1, 43, -1, 44, -1, 45, + -1, 46, -1, 47, -1, -1, -1, 65, -1, 66, + -1, 67, -1, 68, -1, 69, -1, 70, -1, 64, + 4, -1, -1, 57, 4, -1, -1, 140, 57, 4, + -1, 34, 24, -1, -1, 170, -1, -1, 140, 173, + 172, -1, 170, -1, 57, 4, -1, 176, -1, 8, + -1, 178, -1, 8, -1, 178, -1, 9, -1, 10, + -1, 11, -1, 12, -1, 13, -1, 14, -1, 15, + -1, 16, -1, 17, -1, 18, -1, 19, -1, 20, + -1, 21, -1, 48, -1, 177, -1, 212, -1, 141, + 4, -1, 175, 142, 180, 143, -1, 144, 4, 145, + 178, 146, -1, 147, 4, 145, 178, 148, -1, 149, + 179, 150, -1, 149, 150, -1, 147, 149, 179, 150, + 148, -1, 147, 149, 150, 148, -1, 178, 151, -1, + 178, -1, 179, 140, 178, -1, 179, -1, 179, 140, + 37, -1, 37, -1, -1, 176, 144, 183, 146, -1, + 176, 144, 146, -1, 176, 152, 24, -1, 176, 147, + 183, 148, -1, 176, 149, 183, 150, -1, 176, 149, + 150, -1, 176, 38, -1, 176, 39, -1, 176, 212, + -1, 176, 182, -1, 176, 26, -1, 161, 3, -1, + 161, 4, -1, 162, 4, -1, 162, 3, -1, 9, + 27, -1, 9, 28, -1, 164, 7, -1, 157, 142, + 181, 36, 176, 143, -1, 117, 142, 181, 226, 143, + -1, 131, 142, 181, 140, 181, 140, 181, 143, -1, + 155, 142, 181, 140, 181, 143, -1, 156, 142, 181, + 140, 181, 143, -1, 90, 159, 142, 181, 140, 181, + 143, -1, 91, 160, 142, 181, 140, 181, 143, -1, + 158, 142, 181, 140, 181, 143, -1, 136, 142, 181, + 140, 181, 143, -1, 137, 142, 181, 140, 181, 140, + 181, 143, -1, 138, 142, 181, 140, 181, 140, 181, + 143, -1, 183, 140, 181, -1, 181, -1, 32, -1, + 33, -1, 186, -1, 186, 206, -1, 186, 208, -1, + 186, 62, 61, 192, -1, 186, 25, -1, 187, -1, + 187, 165, 20, 174, -1, 187, 208, -1, 187, 62, + 61, 192, -1, -1, 187, 165, 166, 184, 181, 188, + 172, -1, -1, 187, 165, 50, 184, 176, 189, 172, + -1, -1, 187, 165, 45, 184, 176, 190, 172, -1, + -1, 187, 165, 47, 184, 176, 191, 172, -1, 187, + 51, 194, -1, 187, 58, 139, 195, -1, -1, 24, + -1, 56, -1, 55, -1, 53, 139, 193, -1, 54, + 139, 4, -1, 52, 139, 24, -1, 71, 139, 24, + -1, 144, 196, 146, -1, 196, 140, 24, -1, 24, + -1, -1, 22, -1, 24, -1, 197, -1, -1, 176, + 198, -1, 200, 140, 199, -1, 199, -1, 200, -1, + 200, 140, 37, -1, 37, -1, -1, 167, 174, 197, + 142, 201, 143, 171, 168, -1, 29, -1, 149, -1, + 166, 202, 203, -1, 30, -1, 150, -1, 215, 205, + -1, -1, 45, -1, 47, -1, -1, 31, 209, 207, + 202, -1, -1, 63, -1, 3, -1, 4, -1, 7, + -1, 27, -1, 28, -1, 38, -1, 39, -1, 26, + -1, 147, 183, 148, -1, 182, -1, 61, 210, 24, + 140, 24, -1, 154, -1, 197, -1, 212, -1, 211, + -1, 176, 213, -1, 215, 216, -1, 204, 216, -1, + 217, 165, 218, -1, 217, 220, -1, -1, 23, -1, + 72, 214, -1, 72, 8, -1, 73, 21, 213, -1, + 73, 9, 213, 140, 21, 213, 140, 21, 213, -1, + 74, 163, 213, 140, 21, 213, 144, 219, 146, -1, + 74, 163, 213, 140, 21, 213, 144, 146, -1, 75, + 167, 174, 213, 142, 223, 143, 36, 21, 213, 76, + 21, 213, -1, 76, -1, 77, -1, 219, 163, 211, + 140, 21, 213, -1, 163, 211, 140, 21, 213, -1, + 165, 225, -1, 176, 144, 213, 140, 213, 146, -1, + 221, 140, 144, 213, 140, 213, 146, -1, 214, -1, + 222, 140, 214, -1, 222, -1, -1, 60, 59, -1, + 59, -1, 155, 176, 213, 140, 213, -1, 156, 176, + 213, 140, 213, -1, 90, 159, 176, 213, 140, 213, + -1, 91, 160, 176, 213, 140, 213, -1, 49, 214, + -1, 158, 214, 140, 214, -1, 157, 214, 36, 176, + -1, 131, 214, 140, 214, 140, 214, -1, 135, 214, + 140, 176, -1, 136, 214, 140, 214, -1, 137, 214, + 140, 214, 140, 214, -1, 138, 214, 140, 214, 140, + 214, -1, 130, 221, -1, 224, 167, 174, 213, 142, + 223, 143, -1, 228, -1, 140, 222, -1, -1, 35, + -1, -1, 112, 176, 169, -1, 112, 176, 140, 15, + 213, 169, -1, 113, 176, 169, -1, 113, 176, 140, + 15, 213, 169, -1, 114, 214, -1, 227, 115, 176, + 213, -1, 227, 116, 214, 140, 176, 213, -1, 117, + 176, 213, 226, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short yyrline[] = +static const unsigned short int yyrline[] = { - 0, 990, 990, 991, 999, 1000, 1010, 1010, 1010, 1010, - 1010, 1010, 1010, 1010, 1010, 1011, 1011, 1011, 1012, 1012, - 1012, 1012, 1012, 1012, 1013, 1013, 1013, 1013, 1013, 1013, - 1014, 1014, 1014, 1014, 1014, 1014, 1015, 1015, 1015, 1017, - 1017, 1018, 1018, 1019, 1019, 1020, 1020, 1021, 1021, 1025, - 1025, 1026, 1026, 1027, 1027, 1028, 1028, 1029, 1029, 1030, - 1030, 1031, 1031, 1032, 1033, 1038, 1038, 1038, 1038, 1039, - 1039, 1039, 1039, 1040, 1040, 1041, 1041, 1044, 1048, 1053, - 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1062, 1063, 1064, - 1065, 1066, 1067, 1068, 1069, 1078, 1079, 1085, 1086, 1094, - 1102, 1103, 1108, 1109, 1110, 1115, 1129, 1129, 1130, 1130, - 1132, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1143, 1143, - 1143, 1143, 1143, 1143, 1144, 1148, 1152, 1160, 1168, 1181, - 1186, 1198, 1208, 1212, 1222, 1226, 1237, 1242, 1248, 1249, - 1253, 1257, 1268, 1294, 1308, 1338, 1364, 1385, 1398, 1408, - 1413, 1474, 1481, 1489, 1495, 1501, 1505, 1509, 1517, 1529, - 1550, 1558, 1564, 1575, 1581, 1586, 1591, 1600, 1606, 1612, - 1621, 1625, 1633, 1633, 1643, 1651, 1656, 1660, 1664, 1668, - 1683, 1705, 1708, 1711, 1711, 1719, 1719, 1727, 1727, 1735, - 1735, 1744, 1747, 1750, 1754, 1767, 1768, 1770, 1774, 1783, - 1787, 1792, 1794, 1799, 1804, 1813, 1813, 1814, 1814, 1816, - 1823, 1829, 1836, 1840, 1846, 1851, 1856, 1951, 1951, 1953, - 1961, 1961, 1963, 1968, 1969, 1970, 1972, 1972, 1982, 1986, - 1991, 1995, 1999, 2003, 2007, 2011, 2015, 2019, 2023, 2048, - 2052, 2066, 2070, 2076, 2076, 2082, 2087, 2091, 2100, 2111, - 2120, 2132, 2145, 2149, 2153, 2158, 2167, 2186, 2195, 2251, - 2255, 2262, 2273, 2286, 2295, 2304, 2314, 2318, 2325, 2325, - 2327, 2331, 2336, 2355, 2370, 2384, 2395, 2406, 2419, 2428, - 2439, 2447, 2452, 2458, 2464, 2470, 2485, 2544, 2551, 2554, - 2559, 2563, 2570, 2575, 2581, 2586, 2592, 2600, 2612, 2627 + 0, 988, 988, 989, 999, 999, 999, 999, 999, 999, + 999, 999, 999, 1000, 1000, 1000, 1001, 1001, 1001, 1001, + 1001, 1001, 1002, 1002, 1002, 1002, 1002, 1002, 1003, 1003, + 1003, 1005, 1005, 1006, 1006, 1007, 1007, 1008, 1008, 1009, + 1009, 1013, 1013, 1014, 1014, 1015, 1015, 1016, 1016, 1017, + 1017, 1018, 1018, 1019, 1019, 1020, 1021, 1026, 1026, 1026, + 1026, 1027, 1027, 1027, 1027, 1028, 1028, 1029, 1029, 1032, + 1036, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1050, + 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1066, 1067, 1073, + 1074, 1082, 1090, 1091, 1096, 1097, 1098, 1103, 1117, 1117, + 1118, 1118, 1120, 1130, 1130, 1130, 1130, 1130, 1130, 1130, + 1131, 1131, 1131, 1131, 1131, 1131, 1132, 1136, 1140, 1148, + 1156, 1169, 1174, 1186, 1196, 1200, 1210, 1214, 1225, 1230, + 1236, 1237, 1241, 1245, 1256, 1282, 1296, 1326, 1352, 1373, + 1386, 1396, 1401, 1462, 1469, 1477, 1483, 1489, 1495, 1501, + 1505, 1509, 1517, 1529, 1550, 1558, 1564, 1575, 1580, 1585, + 1594, 1600, 1606, 1615, 1619, 1627, 1627, 1637, 1645, 1650, + 1654, 1658, 1662, 1677, 1699, 1702, 1705, 1705, 1713, 1713, + 1721, 1721, 1729, 1729, 1738, 1741, 1744, 1748, 1761, 1762, + 1764, 1768, 1777, 1781, 1786, 1788, 1793, 1798, 1807, 1807, + 1808, 1808, 1810, 1817, 1823, 1830, 1834, 1840, 1845, 1850, + 1945, 1945, 1947, 1955, 1955, 1957, 1962, 1963, 1964, 1966, + 1966, 1976, 1980, 1985, 1989, 1993, 1997, 2001, 2005, 2009, + 2013, 2017, 2042, 2046, 2060, 2064, 2070, 2070, 2076, 2081, + 2085, 2094, 2105, 2114, 2126, 2139, 2143, 2147, 2152, 2161, + 2180, 2189, 2245, 2249, 2256, 2267, 2280, 2289, 2298, 2308, + 2312, 2319, 2319, 2321, 2325, 2330, 2349, 2364, 2375, 2386, + 2399, 2408, 2419, 2427, 2432, 2438, 2444, 2450, 2465, 2524, + 2531, 2534, 2539, 2543, 2550, 2555, 2561, 2566, 2572, 2580, + 2592, 2607 }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { @@ -1625,27 +1664,26 @@ "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", - "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP", - "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", - "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", - "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", - "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", - "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", - "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT", + "XOR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", + "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", + "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", + "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", + "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", + "PHI_TOK", "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "'='", "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", - "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", - "CastOps", "ShiftOps", "IPredicates", "FPredicates", "SIntType", - "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage", - "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", "OptSection", - "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV", - "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", - "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList", - "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle", - "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName", - "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", - "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto", - "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", + "INTVAL", "ArithmeticOps", "LogicalOps", "CastOps", "ShiftOps", + "IPredicates", "FPredicates", "SIntType", "UIntType", "IntType", + "FPType", "OptAssign", "OptLinkage", "OptCallingConv", "OptAlign", + "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes", + "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType", + "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr", + "ConstVector", "GlobalType", "Module", "FunctionList", "ConstPool", "@1", + "@2", "@3", "@4", "AsmBlock", "BigOrLittle", "TargetDefinition", + "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal", + "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", + "END", "Function", "FnDeclareLinkage", "FunctionProto", "@5", + "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile", @@ -1656,7 +1694,7 @@ # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short yytoknum[] = +static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -1671,45 +1709,45 @@ 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 398, 399, 61, 44, 92, 40, 41, - 91, 120, 93, 60, 62, 123, 125, 42, 99 + 385, 386, 387, 388, 389, 390, 391, 392, 393, 61, + 44, 92, 40, 41, 91, 120, 93, 60, 62, 123, + 125, 42, 99 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { - 0, 159, 160, 160, 161, 161, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 163, 163, 163, 164, 164, - 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, - 165, 165, 165, 165, 165, 165, 166, 166, 166, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 168, - 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, - 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, - 170, 170, 170, 171, 171, 172, 172, 173, 173, 174, - 174, 174, 174, 174, 174, 174, 174, 175, 175, 175, - 175, 175, 175, 175, 175, 176, 176, 177, 177, 178, - 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, - 184, 185, 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 187, 187, 188, 188, - 188, 188, 189, 189, 189, 189, 189, 189, 189, 189, - 189, 189, 189, 189, 189, 189, 189, 189, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 191, 191, 192, 192, 193, 194, 194, 194, 194, 194, - 195, 195, 195, 196, 195, 197, 195, 198, 195, 199, - 195, 195, 195, 195, 200, 201, 201, 202, 202, 202, - 202, 203, 204, 204, 204, 205, 205, 206, 206, 207, - 208, 208, 209, 209, 209, 209, 210, 211, 211, 212, - 213, 213, 214, 215, 215, 215, 217, 216, 218, 218, - 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, - 219, 220, 220, 221, 221, 222, 223, 223, 224, 225, - 225, 225, 226, 226, 226, 226, 226, 226, 226, 226, - 226, 227, 227, 228, 229, 229, 230, 230, 231, 231, - 232, 232, 233, 233, 233, 233, 233, 233, 233, 233, - 233, 233, 233, 233, 233, 233, 233, 233, 234, 234, - 235, 235, 236, 236, 236, 236, 236, 236, 236, 236 + 0, 153, 154, 154, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 156, 156, 156, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 158, 158, + 158, 159, 159, 159, 159, 159, 159, 159, 159, 159, + 159, 160, 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 161, 161, 161, + 161, 162, 162, 162, 162, 163, 163, 164, 164, 165, + 165, 166, 166, 166, 166, 166, 166, 166, 166, 167, + 167, 167, 167, 167, 167, 167, 167, 168, 168, 169, + 169, 170, 171, 171, 172, 172, 173, 173, 174, 174, + 175, 175, 176, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 178, 178, 178, 179, 179, + 180, 180, 180, 180, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, + 182, 182, 182, 183, 183, 184, 184, 185, 186, 186, + 186, 186, 186, 187, 187, 187, 188, 187, 189, 187, + 190, 187, 191, 187, 187, 187, 187, 192, 193, 193, + 194, 194, 194, 194, 195, 196, 196, 196, 197, 197, + 198, 198, 199, 200, 200, 201, 201, 201, 201, 202, + 203, 203, 204, 205, 205, 206, 207, 207, 207, 209, + 208, 210, 210, 211, 211, 211, 211, 211, 211, 211, + 211, 211, 211, 211, 212, 212, 213, 213, 214, 215, + 215, 216, 217, 217, 217, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 219, 219, 220, 221, 221, 222, + 222, 223, 223, 224, 224, 225, 225, 225, 225, 225, + 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, + 226, 226, 227, 227, 228, 228, 228, 228, 228, 228, + 228, 228 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1721,580 +1759,542 @@ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 1, 1, 2, 0, 2, 0, + 3, 2, 0, 1, 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, - 1, 1, 1, 1, 2, 0, 2, 0, 3, 2, - 0, 1, 0, 3, 1, 2, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, - 5, 3, 2, 5, 4, 2, 1, 3, 1, 3, - 1, 0, 4, 3, 3, 4, 4, 3, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 6, 5, - 8, 6, 6, 6, 7, 7, 6, 6, 8, 8, - 3, 1, 1, 1, 1, 2, 2, 4, 2, 1, - 4, 2, 4, 0, 7, 0, 7, 0, 7, 0, - 7, 3, 4, 0, 1, 1, 1, 3, 3, 3, - 3, 3, 3, 1, 0, 1, 1, 1, 0, 2, - 3, 1, 1, 3, 1, 0, 8, 1, 1, 3, - 1, 1, 2, 0, 1, 1, 0, 4, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 5, 1, 1, 1, 1, 2, 2, 2, 3, 2, - 0, 1, 2, 2, 3, 9, 9, 8, 13, 1, - 1, 6, 5, 2, 6, 7, 1, 3, 1, 0, - 2, 1, 5, 5, 5, 6, 6, 2, 4, 4, - 6, 4, 4, 6, 6, 2, 7, 1, 2, 0, - 1, 0, 3, 6, 3, 6, 2, 4, 6, 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 4, 5, 5, 3, 2, 5, 4, 2, 1, 3, + 1, 3, 1, 0, 4, 3, 3, 4, 4, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 6, 5, 8, 6, 6, 7, 7, 6, + 6, 8, 8, 3, 1, 1, 1, 1, 2, 2, + 4, 2, 1, 4, 2, 4, 0, 7, 0, 7, + 0, 7, 0, 7, 3, 4, 0, 1, 1, 1, + 3, 3, 3, 3, 3, 3, 1, 0, 1, 1, + 1, 0, 2, 3, 1, 1, 3, 1, 0, 8, + 1, 1, 3, 1, 1, 2, 0, 1, 1, 0, + 4, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 5, 1, 1, 1, 1, 2, 2, + 2, 3, 2, 0, 1, 2, 2, 3, 9, 9, + 8, 13, 1, 1, 6, 5, 2, 6, 7, 1, + 3, 1, 0, 2, 1, 5, 5, 6, 6, 2, + 4, 4, 6, 4, 4, 6, 6, 2, 7, 1, + 2, 0, 1, 0, 3, 6, 3, 6, 2, 4, + 6, 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned short yydefact[] = +static const unsigned short int yydefact[] = { - 193, 0, 86, 179, 1, 178, 226, 79, 80, 81, - 82, 83, 84, 85, 0, 87, 250, 175, 176, 250, - 205, 206, 0, 0, 0, 86, 0, 181, 223, 0, - 0, 88, 89, 90, 91, 92, 93, 0, 0, 251, - 247, 78, 220, 221, 222, 246, 0, 0, 0, 0, - 191, 0, 0, 0, 0, 0, 0, 0, 77, 224, - 225, 87, 194, 177, 94, 2, 3, 107, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 0, 0, 0, 0, 241, 0, 0, 106, - 125, 110, 242, 126, 217, 218, 219, 291, 249, 0, - 0, 0, 0, 204, 192, 182, 180, 172, 173, 0, - 0, 0, 0, 227, 127, 0, 0, 0, 109, 132, - 136, 0, 0, 141, 135, 290, 0, 271, 0, 0, - 0, 0, 87, 259, 260, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 0, 0, 0, 0, 0, 0, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 0, 0, 36, 37, 38, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 248, 87, 263, 0, 287, - 199, 196, 195, 197, 198, 200, 203, 0, 187, 189, - 185, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 0, 0, 0, 0, 183, 0, 0, 0, - 0, 0, 131, 215, 140, 138, 0, 0, 277, 270, - 253, 252, 0, 0, 68, 72, 67, 71, 66, 70, - 65, 69, 73, 74, 0, 0, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 0, 63, 64, 59, - 60, 61, 62, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 0, 97, 97, 296, 0, 0, 285, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 201, 102, 102, 102, 155, 156, - 4, 5, 153, 154, 157, 152, 148, 149, 0, 0, + 186, 0, 78, 172, 1, 171, 219, 71, 72, 73, + 74, 75, 76, 77, 0, 79, 243, 168, 169, 243, + 198, 199, 0, 0, 0, 78, 0, 174, 216, 0, + 0, 80, 81, 82, 83, 84, 85, 0, 0, 244, + 240, 70, 213, 214, 215, 239, 0, 0, 0, 0, + 184, 0, 0, 0, 0, 0, 0, 0, 69, 217, + 218, 79, 187, 170, 86, 2, 3, 99, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 0, 0, 0, 0, 234, 0, 0, 98, + 117, 102, 235, 118, 210, 211, 212, 283, 242, 0, + 0, 0, 0, 197, 185, 175, 173, 165, 166, 0, + 0, 0, 0, 220, 119, 0, 0, 0, 101, 124, + 128, 0, 0, 133, 127, 282, 0, 264, 0, 0, + 0, 0, 79, 252, 253, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, + 0, 0, 0, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 0, 0, 28, 29, 30, + 0, 0, 0, 0, 0, 0, 0, 0, 241, 79, + 256, 0, 279, 192, 189, 188, 190, 191, 193, 196, + 0, 180, 182, 178, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 0, 0, 0, 0, 176, + 0, 0, 0, 0, 0, 123, 208, 132, 130, 0, + 0, 269, 263, 246, 245, 0, 0, 60, 64, 59, + 63, 58, 62, 57, 61, 65, 66, 0, 0, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 0, + 55, 56, 51, 52, 53, 54, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 0, 89, 89, 288, + 0, 0, 277, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 194, 94, 94, 94, + 149, 150, 145, 146, 148, 147, 151, 144, 140, 141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 151, 150, 102, 108, 108, 134, - 0, 137, 214, 208, 211, 212, 0, 0, 128, 230, - 231, 232, 237, 233, 234, 235, 236, 228, 0, 239, - 244, 243, 245, 0, 254, 0, 0, 0, 0, 0, - 292, 0, 294, 289, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, - 0, 188, 190, 186, 0, 0, 0, 0, 0, 0, - 0, 143, 171, 0, 0, 147, 0, 144, 0, 0, - 0, 0, 0, 184, 129, 130, 133, 207, 209, 0, - 100, 139, 229, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 299, 0, 0, 0, 281, 282, - 0, 0, 0, 0, 0, 279, 278, 0, 297, 0, - 0, 0, 104, 102, 0, 0, 289, 0, 0, 0, - 0, 0, 142, 145, 146, 0, 0, 0, 0, 0, - 213, 210, 101, 95, 0, 238, 0, 0, 269, 0, - 0, 97, 98, 97, 266, 288, 0, 0, 0, 0, - 0, 272, 273, 274, 269, 0, 99, 105, 103, 0, - 0, 0, 0, 0, 0, 0, 170, 0, 0, 0, - 0, 0, 0, 216, 0, 0, 0, 268, 0, 275, - 276, 0, 293, 295, 0, 0, 0, 280, 283, 284, - 0, 298, 0, 0, 159, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 96, 240, 0, 0, 0, 267, - 264, 0, 286, 0, 0, 0, 167, 0, 0, 161, - 162, 163, 158, 166, 0, 257, 0, 0, 0, 265, - 164, 165, 0, 0, 0, 255, 0, 256, 0, 0, - 160, 168, 169, 0, 0, 0, 0, 0, 0, 262, - 0, 0, 261, 258 + 0, 0, 0, 0, 0, 143, 142, 94, 100, 100, + 126, 0, 129, 207, 201, 204, 205, 0, 0, 120, + 223, 224, 225, 230, 226, 227, 228, 229, 221, 0, + 232, 237, 236, 238, 0, 247, 0, 0, 0, 0, + 0, 284, 0, 286, 281, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, + 0, 181, 183, 179, 0, 0, 0, 0, 0, 0, + 0, 135, 164, 0, 0, 139, 0, 136, 0, 0, + 0, 0, 177, 121, 122, 125, 200, 202, 0, 92, + 131, 222, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 291, 0, 0, 0, 273, 274, 0, + 0, 0, 0, 271, 270, 0, 289, 0, 0, 0, + 96, 94, 0, 0, 281, 0, 0, 0, 0, 0, + 134, 137, 138, 0, 0, 0, 0, 206, 203, 93, + 87, 0, 231, 0, 0, 262, 0, 0, 89, 90, + 89, 259, 280, 0, 0, 0, 0, 0, 265, 266, + 262, 0, 91, 97, 95, 0, 0, 0, 0, 0, + 0, 0, 163, 0, 0, 0, 0, 0, 209, 0, + 0, 0, 261, 0, 267, 268, 0, 285, 287, 0, + 0, 0, 272, 275, 276, 0, 290, 0, 0, 153, + 0, 0, 0, 0, 0, 0, 0, 0, 88, 233, + 0, 0, 0, 260, 257, 0, 278, 0, 0, 0, + 160, 0, 0, 155, 156, 152, 159, 0, 250, 0, + 0, 0, 258, 157, 158, 0, 0, 0, 248, 0, + 249, 0, 0, 154, 161, 162, 0, 0, 0, 0, + 0, 0, 255, 0, 0, 254, 251 }; /* YYDEFGOTO[NTERM-NUM]. */ -static const short yydefgoto[] = +static const short int yydefgoto[] = { - -1, 86, 302, 319, 320, 321, 322, 323, 256, 273, - 212, 213, 244, 214, 25, 15, 37, 503, 360, 442, - 463, 381, 443, 87, 88, 215, 90, 91, 121, 226, - 392, 349, 393, 109, 1, 2, 3, 326, 297, 295, - 296, 63, 193, 50, 104, 197, 92, 408, 334, 335, - 336, 38, 96, 16, 44, 17, 61, 18, 28, 413, - 350, 93, 352, 474, 19, 40, 41, 185, 557, 98, - 279, 507, 508, 186, 187, 424, 188, 189 + -1, 86, 311, 312, 313, 314, 249, 266, 205, 206, + 237, 207, 25, 15, 37, 488, 351, 430, 450, 371, + 431, 87, 88, 208, 90, 91, 121, 219, 382, 340, + 383, 109, 1, 2, 3, 317, 289, 287, 288, 63, + 186, 50, 104, 190, 92, 397, 325, 326, 327, 38, + 96, 16, 44, 17, 61, 18, 28, 402, 341, 93, + 343, 461, 19, 40, 41, 178, 540, 98, 272, 492, + 493, 179, 180, 413, 181, 182 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -529 -static const short yypact[] = +#define YYPACT_NINF -514 +static const short int yypact[] = { - -529, 21, 408, 495, -529, -529, -529, -529, -529, -529, - -529, -529, -529, -529, -24, 145, 43, -529, -529, -8, - -529, -529, -20, -63, 30, 137, -51, -529, 152, 73, - 147, -529, -529, -529, -529, -529, -529, 1211, -3, -529, - -529, 176, -529, -529, -529, -529, -32, 57, 71, 72, - -529, 35, 73, 1211, 46, 46, 46, 46, -529, -529, - -529, 145, -529, -529, -529, -529, -529, 74, -529, -529, - -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, - -529, -529, 217, 219, 4, 90, -529, 176, 77, -529, - -529, -105, -529, -529, -529, -529, -529, 1316, -529, 202, - 67, 223, 204, 205, -529, -529, -529, -529, -529, 1231, - 1231, 1231, 1276, -529, -529, 82, 83, 637, -529, -529, - -105, -117, 87, 1018, -529, -529, 1231, -529, 179, 1321, - 15, 178, 145, -529, -529, -529, -529, -529, -529, -529, - -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, - -529, -529, -529, 195, 378, 1231, 1231, 1231, 1231, -529, - -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, - -529, 1231, 1231, -529, -529, -529, 1231, 1231, 1231, 1231, - 1231, 1231, 1231, 1231, 1231, -529, 145, -529, 11, -529, - -529, -529, -529, -529, -529, -529, -529, -98, -529, -529, - -529, 109, 157, 235, 168, 238, 173, 240, 201, 244, - 245, 250, 203, 254, 252, 544, -529, 1231, 1231, 106, - -111, 1231, -529, 1059, -529, 115, 113, 730, -529, -529, - 74, -529, 730, 730, -529, -529, -529, -529, -529, -529, - -529, -529, -529, -529, 730, 1211, -529, -529, -529, -529, - -529, -529, -529, -529, -529, -529, 1231, -529, -529, -529, - -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, - -529, -529, -529, 1231, 117, 124, -529, 730, 121, 129, - 135, 136, 139, 140, 141, 730, 730, 730, 267, 158, - 1211, 1231, 1231, 282, -529, 161, 161, 161, -529, -529, - -529, -529, -529, -529, -529, -529, -529, -529, 195, 378, - 160, 162, 163, 164, 165, 965, 1276, 695, 285, 167, - 170, 171, 172, 174, -529, -529, 161, -64, -87, -529, - 169, -105, -529, 176, -529, 175, 190, 1116, -529, -529, - -529, -529, -529, -529, -529, -529, -529, 253, 1276, -529, - -529, -529, -529, 182, -529, 194, 730, 730, 730, -1, - -529, 5, -529, 196, 730, 193, 1231, 1231, 1231, 1231, - 1231, 198, 199, 200, 1231, 1231, 730, 730, 207, -529, - -11, -529, -529, -529, 206, 208, 1276, 1276, 1276, 1276, - 1276, -529, -529, -66, -78, -529, -85, -529, 1276, 1276, - 1276, 1276, 1276, -529, -529, -529, -529, -529, -529, 1170, - 290, -529, -529, 323, -77, 327, 328, 209, 212, 216, - 730, 346, 730, 1231, -529, 218, 730, 220, -529, -529, - 222, 224, 730, 730, 730, -529, -529, 215, -529, 1231, - 331, 347, -529, 161, 1276, 1276, 196, 225, 227, 229, - 230, 1276, -529, -529, -529, 231, 234, 246, 329, 247, - -529, -529, -529, 312, 248, -529, 730, 730, 1231, 730, - 730, 255, -529, 255, -529, 257, 730, 264, 1231, 1231, - 1231, -529, -529, -529, 1231, 730, -529, -529, -529, 265, - 268, 232, 1276, 1276, 1276, 1276, -529, 1276, 1276, 1276, - 1231, 1276, 386, -529, 375, 269, 270, 257, 251, -529, - -529, 361, -529, -529, 1231, 271, 730, -529, -529, -529, - 272, -529, 1276, 1276, -529, 273, 275, 276, 279, 277, - 281, 283, 287, 291, -529, -529, 407, 114, 398, -529, - -529, 292, -529, 296, 297, 1276, -529, 1276, 1276, -529, - -529, -529, -529, -529, 730, -529, 872, 153, 427, -529, - -529, -529, 307, 308, 309, -529, 313, -529, 872, 730, - -529, -529, -529, 440, 318, 389, 730, 446, 447, -529, - 730, 730, -529, -529 + -514, 47, 80, 817, -514, -514, -514, -514, -514, -514, + -514, -514, -514, -514, -3, 79, 67, -514, -514, -9, + -514, -514, 33, -46, 42, 139, -29, -514, -2, 95, + 126, -514, -514, -514, -514, -514, -514, 1112, -18, -514, + -514, 96, -514, -514, -514, -514, -7, 29, 56, 61, + -514, 34, 95, 1112, 74, 74, 74, 74, -514, -514, + -514, 79, -514, -514, -514, -514, -514, 45, -514, -514, + -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, + -514, -514, 209, 211, 2, 538, -514, 96, 77, -514, + -514, -118, -514, -514, -514, -514, -514, 1252, -514, 201, + 102, 224, 206, 215, -514, -514, -514, -514, -514, 1153, + 1153, 1153, 1173, -514, -514, 112, 115, 598, -514, -514, + -118, -111, 99, 643, -514, -514, 1153, -514, 207, 1214, + 14, 239, 79, -514, -514, -514, -514, -514, -514, -514, + -514, -514, -514, -514, -514, -514, -514, 110, 190, 1153, + 1153, 1153, 1153, -514, -514, -514, -514, -514, -514, -514, + -514, -514, -514, -514, -514, 1153, 1153, -514, -514, -514, + 1153, 1153, 1153, 1153, 1153, 1153, 1153, 1153, -514, 79, + -514, 48, -514, -514, -514, -514, -514, -514, -514, -514, + -94, -514, -514, -514, 138, 171, 173, 187, 189, 195, + 218, 220, 230, 258, 260, 232, 234, 267, 393, -514, + 1153, 1153, 129, -99, 1153, -514, 967, -514, 140, 135, + 691, -514, -514, 45, -514, 691, 691, -514, -514, -514, + -514, -514, -514, -514, -514, -514, -514, 691, 1112, -514, + -514, -514, -514, -514, -514, -514, -514, -514, -514, 1153, + -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, + -514, -514, -514, -514, -514, -514, 1153, 145, 146, -514, + 691, 158, 163, 164, 165, 167, 169, 170, 691, 691, + 243, 172, 1112, 1153, 1153, 287, -514, 174, 174, 174, + -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, + 110, 190, 176, 177, 188, 191, 192, 914, 1173, 618, + 289, 193, 194, 196, 197, -514, -514, 174, -119, -60, + -514, 181, -118, -514, 96, -514, 175, 198, 1008, -514, + -514, -514, -514, -514, -514, -514, -514, -514, 274, 1173, + -514, -514, -514, -514, 200, -514, 203, 691, 691, 691, + 0, -514, 13, -514, 204, 691, 202, 1153, 1153, 1153, + 1153, 1153, 205, 212, 1153, 1153, 691, 691, 213, -514, + -17, -514, -514, -514, 214, 216, 1173, 1173, 1173, 1173, + 1173, -514, -514, 15, -32, -514, -69, -514, 1173, 1173, + 1173, 1173, -514, -514, -514, -514, -514, -514, 1059, 313, + -514, -514, 327, -31, 333, 334, 217, 222, 223, 691, + 356, 691, 1153, -514, 225, 691, 226, -514, -514, 227, + 238, 691, 691, -514, -514, 228, -514, 1153, 357, 376, + -514, 174, 1173, 1173, 204, 244, 248, 249, 254, 1173, + -514, -514, -514, 255, 256, 347, 257, -514, -514, -514, + 345, 263, -514, 691, 691, 1153, 691, 691, 266, -514, + 266, -514, 268, 691, 269, 1153, 1153, 1153, -514, -514, + 1153, 691, -514, -514, -514, 272, 273, 264, 1173, 1173, + 1173, 1173, -514, 1173, 1173, 1153, 1173, 410, -514, 392, + 280, 277, 268, 283, -514, -514, 366, -514, -514, 1153, + 281, 691, -514, -514, -514, 291, -514, 1173, 1173, -514, + 295, 293, 297, 298, 296, 299, 300, 301, -514, -514, + 419, 51, 405, -514, -514, 304, -514, 302, 303, 1173, + -514, 1173, 1173, -514, -514, -514, -514, 691, -514, 827, + 85, 430, -514, -514, -514, 309, 311, 312, -514, 316, + -514, 827, 691, -514, -514, -514, 436, 318, 385, 691, + 442, 443, -514, 691, 691, -514, -514 }; /* YYPGOTO[NTERM-NUM]. */ -static const short yypgoto[] = +static const short int yypgoto[] = { - -529, -529, -529, 372, 374, 379, 381, 382, 188, 166, - -130, -128, -510, -529, 439, 456, -123, -529, -270, 88, - -529, -285, -529, -49, -529, -37, -529, -68, -36, -529, - -110, 284, -298, 60, -529, -529, -529, -529, -529, -529, - -529, 445, -529, -529, -529, -529, 3, -529, 91, -529, - -529, 441, -529, -529, -529, -529, -529, 498, -529, -529, - -528, -202, 40, -119, -529, 484, -529, -529, -529, -529, - -529, 81, 24, -529, -529, 59, -529, -529 + -514, -514, 368, 369, 370, 371, 185, 168, -130, -129, + -503, -514, 429, 461, -110, -514, -264, 88, -514, -281, + -514, -50, -514, -37, -514, -41, 39, -514, -107, 282, + -289, 22, -514, -514, -514, -514, -514, -514, -514, 437, + -514, -514, -514, -514, 7, -514, 90, -514, -514, 432, + -514, -514, -514, -514, -514, 493, -514, -514, -513, -195, + 38, -117, -514, 478, -514, -514, -514, -514, -514, 86, + 30, -514, -514, 65, -514, -514 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -175 -static const short yytable[] = +#define YYTABLE_NINF -168 +static const short int yytable[] = { - 89, 242, 216, 243, 106, 362, 26, 228, 116, 245, - 231, 382, 383, 325, 420, 39, 89, 120, 394, 396, - 422, 4, 42, 440, 232, 351, 94, 556, 566, 221, - 351, 351, 46, 47, 48, 221, 233, 29, 276, 222, - 574, 403, 351, -108, 26, 330, 441, 568, 293, 120, - 414, 49, 124, 280, 294, 120, 421, 281, 282, 283, - 284, 451, 421, 290, 288, 289, 39, 405, 451, 451, - 124, 454, 198, 199, 200, 351, 453, 465, 107, 108, - 451, 220, 51, 351, 351, 351, 452, 225, 404, 227, - 122, 52, 227, 124, 58, 65, 66, 62, 118, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 20, 99, 21, 110, 111, 112, 274, 275, - 227, 277, 191, 192, 234, 235, 236, 237, 238, 239, - 240, 241, 291, 292, 278, 227, 298, 299, 81, 227, - 227, 227, 227, 285, 286, 287, 227, 227, 43, 327, - 328, 64, 95, 331, 351, 351, 351, 53, 488, 117, - -68, -68, 351, 234, 235, 236, 237, 238, 239, 240, - 241, -67, -67, 378, 351, 351, -66, -66, 7, 8, - 9, 10, 54, 12, 55, 103, 333, 56, 234, 235, - 236, 237, 238, 239, 240, 241, 356, 59, 20, 60, - 21, 512, 100, 513, -65, -65, 300, 301, 89, 30, - 31, 32, 33, 34, 35, 36, 101, 102, 351, 357, - 351, 114, -109, 115, 351, 123, 190, 194, 195, 196, - 351, 351, 351, 217, 218, 223, 358, 82, 229, -72, - 83, 376, -71, 84, -70, 85, 119, 427, -69, 429, - 430, 431, -75, 89, 377, 227, 436, -76, 303, 304, - 329, 337, 338, 359, 351, 351, 555, 351, 351, 331, - 361, 364, 353, 354, 351, 365, 446, 447, 448, 449, - 450, 366, 367, 351, 355, 368, 369, 370, 455, 456, - 457, 458, 459, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 374, 375, 567, 379, 380, 386, 397, - 387, 388, 389, 390, 351, 398, 412, 363, 399, 400, - 401, 409, 402, 406, 440, 371, 372, 373, 415, 227, - 428, 227, 227, 227, 489, 490, 407, 435, 227, 410, - 416, 496, 423, 426, 432, 433, 434, 464, 466, 467, - 472, 487, 351, 439, 444, 486, 445, 468, 469, 517, - 518, 519, 470, 484, 476, 500, 478, 351, 479, 502, - 480, 492, 333, 493, 351, 494, 495, 497, 351, 351, - 498, 524, 525, 526, 527, 528, 227, 529, 530, 531, - 534, 533, 499, 501, 504, 539, 417, 418, 419, 535, - 538, 511, 485, 514, 425, 257, 258, 242, -174, 243, - 516, 522, 543, 544, 523, 536, 437, 438, 421, 545, - 537, 542, 547, 540, 546, 548, 549, 242, 554, 243, - 550, 227, 551, 5, 558, 562, 552, 563, 564, 6, - 553, 227, 227, 227, 559, 560, 561, 227, 569, 7, - 8, 9, 10, 11, 12, 13, 570, 571, 572, 573, - 471, 576, 473, 532, 577, 578, 477, 580, 581, 180, - 14, 181, 481, 482, 483, 385, 182, 227, 183, 184, - 97, 57, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 384, 105, 462, 324, - 461, 27, 113, 45, 475, 491, 505, 506, 520, 509, - 510, 0, 0, 0, 0, -78, 515, 20, 0, 21, - 0, 0, 0, 0, 0, 521, 6, -78, -78, 0, - 0, 0, 0, 0, 0, 0, -78, -78, -78, -78, - -78, -78, -78, 0, 0, -78, 22, 0, 0, 65, - 66, 0, 0, 23, 0, 0, 541, 24, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 0, 21, 0, - 305, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 306, 307, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 565, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 575, - 0, 0, 0, 0, 0, 0, 579, 0, 0, 0, - 582, 583, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 308, 309, 65, 66, 0, 118, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, - 0, 21, 0, 0, 0, 0, 0, 310, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 0, 311, 173, 174, 175, 81, 312, 313, 314, 0, - 0, 0, 0, 0, 315, 0, 0, 316, 0, 317, - 65, 66, 318, 118, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 79, 80, 20, 0, 21, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 339, 340, 65, 66, 341, 0, 0, - 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, - 0, 0, 20, 0, 21, 0, 342, 343, 344, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 345, 346, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, - 84, 347, 85, 219, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 308, 309, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 0, 0, 83, 0, 0, 84, 0, - 85, 395, 0, 310, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 0, 311, 173, 174, - 175, 0, 312, 313, 314, 339, 340, 0, 0, 341, - 0, 0, 0, 348, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 342, 343, - 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 345, 346, 0, 0, 0, 0, 0, 0, 0, 0, + 89, 235, 236, 106, 353, 209, 116, 372, 373, 221, + 26, 94, 224, 316, 39, 409, 89, 428, 539, 384, + 386, 42, 238, 225, -100, 342, 549, 393, 411, 214, + 342, 342, 124, 124, 269, 226, 392, 551, 557, 215, + 429, 214, 342, 59, 120, 60, 285, 4, 26, 273, + 403, 321, 286, 274, 275, 276, 277, 410, 29, 280, + 281, 227, 228, 229, 230, 231, 232, 233, 234, 282, + 410, 439, 191, 192, 193, 342, 120, 110, 111, 112, + -167, 442, 120, 342, 342, 46, 47, 48, 394, 220, + 39, 124, 220, 51, 122, 227, 228, 229, 230, 231, + 232, 233, 234, 52, 49, 5, 107, 108, 439, 439, + 58, 6, 267, 268, 220, 270, 441, 452, 20, 62, + 21, 7, 8, 9, 10, 11, 12, 13, 271, 220, + 64, 95, 99, 220, 220, 220, 220, 278, 279, 220, + 220, 43, 14, 30, 31, 32, 33, 34, 35, 36, + 474, 117, 342, 342, 342, 439, 213, 184, 185, 53, + 342, 440, 218, 283, 284, 290, 291, 368, 100, 318, + 319, 342, 342, 322, -60, -60, -64, -64, 103, 324, + 7, 8, 9, 10, 54, 12, 55, -101, 347, 56, + -59, -59, -63, -63, 497, 101, 498, 538, -58, -58, + 102, 89, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 348, 114, 342, 115, 342, 250, 251, 123, + 342, -62, -62, -57, -57, 183, 342, 342, 187, 349, + 188, 550, 366, -61, -61, 292, 293, 294, 295, 189, + 416, 216, 418, 419, 420, 89, 367, 220, 424, 227, + 228, 229, 230, 231, 232, 233, 234, 210, 342, 342, + 211, 342, 342, 344, 345, -67, 222, -68, 342, 434, + 435, 436, 437, 438, 296, 346, 342, 320, 329, 364, + 328, 443, 444, 445, 446, 350, 352, 322, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 355, 356, 357, 358, 342, 359, 354, 360, + 361, 369, 365, 387, 370, 398, 362, 363, 376, 377, + 220, 417, 220, 220, 220, 475, 476, 423, 220, 395, + 378, 396, 482, 379, 380, 388, 389, 401, 390, 391, + 404, 399, 342, 405, 412, 421, 415, 428, 502, 503, + 504, 451, 422, 427, 453, 454, 432, 342, 433, 455, + 459, 324, 456, 457, 342, 463, 465, 466, 342, 342, + 470, 510, 511, 512, 513, 220, 514, 515, 467, 517, + 473, 472, 523, 485, 478, 406, 407, 408, 479, 480, + 471, 235, 236, 414, 481, 483, 484, 486, 65, 66, + 527, 528, 487, 489, 425, 426, 496, 509, 499, 501, + 235, 236, 507, 508, 518, 20, 519, 21, 220, 297, + 520, 521, 545, 410, 546, 547, 522, 524, 220, 220, + 220, 298, 299, 220, 526, 529, 530, 531, 532, 533, + 537, 541, 534, 535, 536, 543, 544, 458, 516, 460, + 542, 552, 553, 464, 554, 555, 556, 559, 560, 468, + 469, 561, 220, 563, 564, 174, 175, 176, 177, 375, + 97, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 300, 301, 374, 57, 449, 448, 105, + 315, 490, 491, 113, 494, 495, 27, 45, 462, 477, + 505, 500, 0, 0, 0, 0, 0, 0, 0, 506, + 302, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 0, 303, 167, 168, 169, 0, 304, + 305, 306, 0, 0, 0, 0, 0, 307, 0, 525, + 308, 0, 309, 65, 66, 310, 118, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 548, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, + 558, 0, 0, 0, 0, 0, 0, 562, 0, 0, + 0, 565, 566, 65, 66, 0, 118, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 20, 0, 21, 65, 66, 0, 118, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 79, 80, + 20, 0, 21, 0, 0, 0, 81, 0, 65, 66, + 0, 118, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 20, 81, 21, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, + 217, 0, 83, 0, 0, 84, 0, 85, 119, 0, + 0, 81, 0, 0, 330, 331, 65, 66, 332, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 347, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 20, 0, 21, 0, 333, 334, 335, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 336, + 337, 0, 0, 0, 0, 0, 0, 0, 0, 82, + 0, 0, 83, 0, 0, 84, 0, 85, 212, 0, + 0, 0, 338, 0, 0, 0, 0, 0, 0, 82, + 0, 0, 83, 0, 0, 84, 0, 85, 385, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 300, 301, 0, 82, 0, 0, 83, 0, 0, + 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 302, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 0, 303, 167, 168, 169, 0, 304, 305, 306, + 330, 331, 0, 0, 332, 0, 0, -70, 339, 20, + 0, 21, 0, 0, 0, 0, 0, 0, 6, -70, + -70, 0, 0, 333, 334, 335, 0, 0, -70, -70, + -70, -70, -70, -70, -70, 336, 337, -70, 22, 0, + 0, 0, 0, 0, 0, 23, 0, 0, 0, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 338, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 308, 309, - 65, 66, 0, 118, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 79, 80, 20, 0, 21, - 0, 0, 0, 0, 0, 310, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 0, 311, - 173, 174, 175, 81, 312, 313, 314, 0, 0, 0, - 0, 0, 0, 65, 66, 348, 118, 68, 69, 70, + 0, 0, 0, 0, 0, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 300, 301, 65, + 66, 0, 118, 194, 195, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 79, 80, 20, 0, 21, 0, + 0, 0, 0, 0, 302, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 0, 303, 167, + 168, 169, 81, 304, 305, 306, 0, 0, 0, 0, + 0, 0, 65, 66, 339, 118, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, + 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 323, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 81, 118, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 224, 0, 0, 0, 0, - 0, 0, 0, 0, 65, 66, 81, 118, 68, 69, + 0, 0, 0, 0, 0, 400, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 82, 81, 0, 83, 0, + 381, 84, 0, 85, 65, 66, 0, 118, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 332, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, - 0, 0, 82, 0, 0, 83, 0, 391, 84, 0, - 85, 65, 66, 0, 118, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 411, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 81, 82, 0, 0, 83, 0, - 0, 84, 0, 85, 0, 65, 66, 0, 118, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 460, 0, 83, - 0, 0, 84, 0, 85, 0, 65, 66, 81, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 20, 0, 21, 65, 66, 0, 118, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 20, 0, 21, 0, 0, 0, 81, - 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, - 0, 85, 0, 0, 0, 0, 0, 0, 0, 81, - 0, 65, 66, 0, 118, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 79, 80, 20, 0, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, - 83, 0, 0, 84, 81, 85, 65, 66, 0, 230, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, - 0, 125, 0, 0, 0, 0, 0, 0, 82, 0, - 0, 83, 0, 0, 84, 126, 85, 0, 0, 81, - 0, 0, 0, 0, 0, 127, 128, 0, 82, 0, - 0, 83, 0, 0, 84, 0, 85, 0, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 447, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 81, 82, 0, + 0, 83, 0, 0, 84, 0, 85, 65, 66, 0, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, + 0, 0, 83, 0, 0, 84, 0, 85, 65, 66, + 81, 118, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 20, 0, 21, 65, 66, + 0, 118, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 79, 80, 20, 0, 21, 0, 0, + 82, 81, 0, 83, 0, 0, 84, 0, 85, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 66, 81, 223, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, - 0, 85, 0, 0, 155, 156, 157, 0, 0, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 0, 0, 0, 0, 0, 0, 0, 82, 0, - 0, 83, 0, 0, 84, 0, 85 + 0, 85, 81, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 125, 0, 0, + 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, + 84, 126, 85, 0, 0, 0, 0, 0, 0, 0, + 0, 127, 128, 0, 82, 0, 0, 83, 0, 0, + 84, 0, 85, 0, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 82, 0, 0, 83, 0, + 0, 84, 0, 85, 149, 150, 151, 0, 0, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + 173 }; -static const short yycheck[] = +static const short int yycheck[] = { - 37, 131, 112, 131, 53, 275, 3, 126, 4, 132, - 129, 296, 297, 215, 15, 23, 53, 85, 316, 317, - 15, 0, 30, 34, 9, 227, 29, 537, 556, 146, - 232, 233, 52, 53, 54, 146, 21, 61, 157, 156, - 568, 326, 244, 148, 41, 156, 57, 557, 146, 117, - 348, 71, 157, 172, 152, 123, 57, 176, 177, 178, - 179, 146, 57, 186, 183, 184, 23, 154, 146, 146, - 157, 156, 109, 110, 111, 277, 154, 154, 32, 33, - 146, 117, 145, 285, 286, 287, 152, 123, 152, 126, - 87, 61, 129, 157, 145, 5, 6, 24, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 145, 24, 55, 56, 57, 155, 156, - 157, 158, 55, 56, 10, 11, 12, 13, 14, 15, - 16, 17, 121, 122, 171, 172, 27, 28, 48, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 156, 217, - 218, 4, 155, 221, 356, 357, 358, 20, 443, 155, - 3, 4, 364, 10, 11, 12, 13, 14, 15, 16, - 17, 3, 4, 292, 376, 377, 3, 4, 41, 42, - 43, 44, 45, 46, 47, 150, 223, 50, 10, 11, - 12, 13, 14, 15, 16, 17, 245, 45, 22, 47, - 24, 471, 145, 473, 3, 4, 3, 4, 245, 64, - 65, 66, 67, 68, 69, 70, 145, 145, 420, 256, - 422, 4, 148, 4, 426, 148, 24, 4, 24, 24, - 432, 433, 434, 151, 151, 148, 273, 147, 59, 4, - 150, 290, 4, 153, 4, 155, 156, 366, 4, 368, - 369, 370, 7, 290, 291, 292, 375, 7, 4, 7, - 154, 146, 149, 146, 466, 467, 152, 469, 470, 337, - 146, 150, 232, 233, 476, 146, 386, 387, 388, 389, - 390, 146, 146, 485, 244, 146, 146, 146, 398, 399, - 400, 401, 402, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 36, 146, 152, 24, 146, 148, 24, - 148, 148, 148, 148, 516, 148, 63, 277, 148, 148, - 148, 146, 148, 154, 34, 285, 286, 287, 146, 366, - 367, 368, 369, 370, 444, 445, 333, 374, 375, 149, - 146, 451, 146, 150, 146, 146, 146, 24, 21, 21, - 4, 4, 554, 146, 148, 24, 148, 148, 146, 478, - 479, 480, 146, 148, 146, 36, 146, 569, 146, 57, - 146, 146, 409, 146, 576, 146, 146, 146, 580, 581, - 146, 149, 492, 493, 494, 495, 423, 497, 498, 499, - 4, 501, 146, 146, 146, 514, 356, 357, 358, 24, - 149, 146, 439, 146, 364, 27, 28, 537, 0, 537, - 146, 146, 522, 523, 146, 146, 376, 377, 57, 146, - 150, 149, 146, 152, 149, 146, 149, 557, 21, 557, - 149, 468, 149, 25, 36, 545, 149, 547, 548, 31, - 149, 478, 479, 480, 152, 149, 149, 484, 21, 41, - 42, 43, 44, 45, 46, 47, 149, 149, 149, 146, - 420, 21, 422, 500, 146, 76, 426, 21, 21, 97, - 62, 97, 432, 433, 434, 309, 97, 514, 97, 97, - 41, 25, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 308, 52, 410, 215, - 409, 3, 61, 19, 423, 446, 466, 467, 484, 469, - 470, -1, -1, -1, -1, 20, 476, 22, -1, 24, - -1, -1, -1, -1, -1, 485, 31, 32, 33, -1, - -1, -1, -1, -1, -1, -1, 41, 42, 43, 44, - 45, 46, 47, -1, -1, 50, 51, -1, -1, 5, - 6, -1, -1, 58, -1, -1, 516, 62, -1, -1, - -1, -1, -1, -1, -1, -1, 22, -1, 24, -1, - 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 38, 39, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 554, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 569, - -1, -1, -1, -1, -1, -1, 576, -1, -1, -1, - 580, 581, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 5, 6, -1, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - -1, 24, -1, -1, -1, -1, -1, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - -1, 137, 138, 139, 140, 48, 142, 143, 144, -1, - -1, -1, -1, -1, 150, -1, -1, 153, -1, 155, - 5, 6, 158, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 3, 4, 5, 6, 7, -1, -1, - -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, - -1, -1, 22, -1, 24, -1, 26, 27, 28, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 147, -1, -1, 150, -1, -1, - 153, 61, 155, 156, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 147, -1, -1, 150, -1, -1, 153, -1, - 155, 156, -1, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, -1, 137, 138, 139, - 140, -1, 142, 143, 144, 3, 4, -1, -1, 7, - -1, -1, -1, 153, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, - 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 38, 39, -1, -1, -1, -1, -1, -1, -1, -1, + 37, 131, 131, 53, 268, 112, 4, 288, 289, 126, + 3, 29, 129, 208, 23, 15, 53, 34, 521, 308, + 309, 30, 132, 9, 142, 220, 539, 146, 15, 140, + 225, 226, 151, 151, 151, 21, 317, 540, 551, 150, + 57, 140, 237, 45, 85, 47, 140, 0, 41, 166, + 339, 150, 146, 170, 171, 172, 173, 57, 61, 176, + 177, 10, 11, 12, 13, 14, 15, 16, 17, 179, + 57, 140, 109, 110, 111, 270, 117, 55, 56, 57, + 0, 150, 123, 278, 279, 52, 53, 54, 148, 126, + 23, 151, 129, 139, 87, 10, 11, 12, 13, 14, + 15, 16, 17, 61, 71, 25, 32, 33, 140, 140, + 139, 31, 149, 150, 151, 152, 148, 148, 22, 24, + 24, 41, 42, 43, 44, 45, 46, 47, 165, 166, + 4, 149, 139, 170, 171, 172, 173, 174, 175, 176, + 177, 150, 62, 64, 65, 66, 67, 68, 69, 70, + 431, 149, 347, 348, 349, 140, 117, 55, 56, 20, + 355, 146, 123, 115, 116, 27, 28, 284, 139, 210, + 211, 366, 367, 214, 3, 4, 3, 4, 144, 216, + 41, 42, 43, 44, 45, 46, 47, 142, 238, 50, + 3, 4, 3, 4, 458, 139, 460, 146, 3, 4, + 139, 238, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 249, 4, 409, 4, 411, 27, 28, 142, + 415, 3, 4, 3, 4, 24, 421, 422, 4, 266, + 24, 146, 282, 3, 4, 3, 4, 3, 4, 24, + 357, 142, 359, 360, 361, 282, 283, 284, 365, 10, + 11, 12, 13, 14, 15, 16, 17, 145, 453, 454, + 145, 456, 457, 225, 226, 7, 59, 7, 463, 376, + 377, 378, 379, 380, 7, 237, 471, 148, 143, 36, + 140, 388, 389, 390, 391, 140, 140, 328, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 144, 140, 140, 140, 501, 140, 270, 140, + 140, 24, 140, 24, 140, 140, 278, 279, 142, 142, + 357, 358, 359, 360, 361, 432, 433, 364, 365, 148, + 142, 324, 439, 142, 142, 142, 142, 63, 142, 142, + 140, 143, 537, 140, 140, 140, 144, 34, 465, 466, + 467, 24, 140, 140, 21, 21, 142, 552, 142, 142, + 4, 398, 140, 140, 559, 140, 140, 140, 563, 564, + 142, 478, 479, 480, 481, 412, 483, 484, 140, 486, + 4, 24, 499, 36, 140, 347, 348, 349, 140, 140, + 427, 521, 521, 355, 140, 140, 140, 140, 5, 6, + 507, 508, 57, 140, 366, 367, 140, 143, 140, 140, + 540, 540, 140, 140, 4, 22, 24, 24, 455, 26, + 140, 144, 529, 57, 531, 532, 143, 146, 465, 466, + 467, 38, 39, 470, 143, 140, 143, 140, 140, 143, + 21, 36, 143, 143, 143, 143, 143, 409, 485, 411, + 146, 21, 143, 415, 143, 143, 140, 21, 140, 421, + 422, 76, 499, 21, 21, 97, 97, 97, 97, 301, + 41, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 300, 25, 399, 398, 52, + 208, 453, 454, 61, 456, 457, 3, 19, 412, 434, + 470, 463, -1, -1, -1, -1, -1, -1, -1, 471, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, -1, 131, 132, 133, 134, -1, 136, + 137, 138, -1, -1, -1, -1, -1, 144, -1, 501, + 147, -1, 149, 5, 6, 152, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 537, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, + 552, -1, -1, -1, -1, -1, -1, 559, -1, -1, + -1, 563, 564, 5, 6, -1, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, 5, 6, -1, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, -1, -1, -1, 48, -1, 5, 6, + -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 48, 24, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, + 37, -1, 144, -1, -1, 147, -1, 149, 150, -1, + -1, 48, -1, -1, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, 24, -1, 26, 27, 28, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 141, + -1, -1, 144, -1, -1, 147, -1, 149, 150, -1, + -1, -1, 61, -1, -1, -1, -1, -1, -1, 141, + -1, -1, 144, -1, -1, 147, -1, 149, 150, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, -1, 141, -1, -1, 144, -1, -1, + 147, -1, 149, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, -1, 131, 132, 133, 134, -1, 136, 137, 138, + 3, 4, -1, -1, 7, -1, -1, 20, 147, 22, + -1, 24, -1, -1, -1, -1, -1, -1, 31, 32, + 33, -1, -1, 26, 27, 28, -1, -1, 41, 42, + 43, 44, 45, 46, 47, 38, 39, 50, 51, -1, + -1, -1, -1, -1, -1, 58, -1, -1, -1, 62, + -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 5, 6, -1, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, - -1, -1, -1, -1, -1, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, -1, 137, - 138, 139, 140, 48, 142, 143, 144, -1, -1, -1, - -1, -1, -1, 5, 6, 153, 8, 9, 10, 11, + -1, -1, -1, -1, -1, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 5, + 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, + -1, -1, -1, -1, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, -1, 131, 132, + 133, 134, 48, 136, 137, 138, -1, -1, -1, -1, + -1, -1, 5, 6, 147, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, + -1, -1, -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, - -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, + -1, -1, -1, -1, -1, 141, 48, -1, 144, -1, + 146, 147, -1, 149, 5, 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, - -1, -1, 147, -1, -1, 150, -1, 152, 153, -1, - 155, 5, 6, -1, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, - 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 48, 147, -1, -1, 150, -1, - -1, 153, -1, 155, -1, 5, 6, -1, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, -1, 24, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 147, 37, -1, 150, - -1, -1, 153, -1, 155, -1, 5, 6, 48, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, 5, 6, -1, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, -1, -1, -1, 48, - -1, -1, -1, 147, -1, -1, 150, -1, -1, 153, - -1, 155, -1, -1, -1, -1, -1, -1, -1, 48, - -1, 5, 6, -1, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, - 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 147, -1, -1, - 150, -1, -1, 153, 48, 155, 5, 6, -1, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, - -1, 35, -1, -1, -1, -1, -1, -1, 147, -1, - -1, 150, -1, -1, 153, 49, 155, -1, -1, 48, - -1, -1, -1, -1, -1, 59, 60, -1, 147, -1, - -1, 150, -1, -1, 153, -1, 155, -1, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 147, -1, -1, 150, -1, -1, 153, - -1, 155, -1, -1, 118, 119, 120, -1, -1, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, -1, -1, -1, -1, -1, -1, -1, 147, -1, - -1, 150, -1, -1, 153, -1, 155 + -1, -1, -1, -1, -1, -1, -1, 48, 141, -1, + -1, 144, -1, -1, 147, -1, 149, 5, 6, -1, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, + -1, -1, 144, -1, -1, 147, -1, 149, 5, 6, + 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, 5, 6, + -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, + 141, 48, -1, 144, -1, -1, 147, -1, 149, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, + 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 141, -1, -1, 144, -1, -1, 147, + -1, 149, 48, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, + -1, -1, -1, -1, 141, -1, -1, 144, -1, -1, + 147, 49, 149, -1, -1, -1, -1, -1, -1, -1, + -1, 59, 60, -1, 141, -1, -1, 144, -1, -1, + 147, -1, 149, -1, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 141, -1, -1, 144, -1, + -1, 147, -1, 149, 112, 113, 114, -1, -1, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { - 0, 193, 194, 195, 0, 25, 31, 41, 42, 43, - 44, 45, 46, 47, 62, 174, 212, 214, 216, 223, - 22, 24, 51, 58, 62, 173, 205, 216, 217, 61, - 64, 65, 66, 67, 68, 69, 70, 175, 210, 23, - 224, 225, 30, 156, 213, 224, 52, 53, 54, 71, - 202, 145, 61, 20, 45, 47, 50, 174, 145, 45, - 47, 215, 24, 200, 4, 5, 6, 8, 9, 10, + 0, 185, 186, 187, 0, 25, 31, 41, 42, 43, + 44, 45, 46, 47, 62, 166, 204, 206, 208, 215, + 22, 24, 51, 58, 62, 165, 197, 208, 209, 61, + 64, 65, 66, 67, 68, 69, 70, 167, 202, 23, + 216, 217, 30, 150, 205, 216, 52, 53, 54, 71, + 194, 139, 61, 20, 45, 47, 50, 166, 139, 45, + 47, 207, 24, 192, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 48, 147, 150, 153, 155, 160, 182, 183, 184, - 185, 186, 205, 220, 29, 155, 211, 173, 228, 145, - 145, 145, 145, 150, 203, 200, 182, 32, 33, 192, - 192, 192, 192, 210, 4, 4, 4, 155, 8, 156, - 186, 187, 205, 148, 157, 35, 49, 59, 60, 72, + 21, 48, 141, 144, 147, 149, 154, 174, 175, 176, + 177, 178, 197, 212, 29, 149, 203, 165, 220, 139, + 139, 139, 139, 144, 195, 192, 174, 32, 33, 184, + 184, 184, 184, 202, 4, 4, 4, 149, 8, 150, + 178, 179, 197, 142, 151, 35, 49, 59, 60, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 118, 119, 120, 123, 124, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 112, + 113, 114, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 162, 163, 164, 165, 166, 226, 232, 233, 235, 236, - 24, 55, 56, 201, 4, 24, 24, 204, 184, 184, - 184, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 169, 170, 172, 184, 189, 151, 151, 156, - 187, 146, 156, 148, 37, 187, 188, 184, 222, 59, - 8, 222, 9, 21, 10, 11, 12, 13, 14, 15, - 16, 17, 169, 170, 171, 175, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 167, 27, 28, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 168, 184, 184, 222, 184, 184, 229, - 222, 222, 222, 222, 222, 184, 184, 184, 222, 222, - 175, 121, 122, 146, 152, 198, 199, 197, 27, 28, - 3, 4, 161, 4, 7, 26, 38, 39, 96, 97, - 123, 137, 142, 143, 144, 150, 153, 155, 158, 162, - 163, 164, 165, 166, 190, 220, 196, 186, 186, 154, - 156, 186, 37, 184, 207, 208, 209, 146, 149, 3, - 4, 7, 26, 27, 28, 38, 39, 61, 153, 190, - 219, 220, 221, 221, 221, 221, 182, 184, 184, 146, - 177, 146, 177, 221, 150, 146, 146, 146, 146, 146, - 146, 221, 221, 221, 36, 146, 182, 184, 222, 24, - 146, 180, 180, 180, 167, 168, 148, 148, 148, 148, - 148, 152, 189, 191, 191, 156, 191, 24, 148, 148, - 148, 148, 148, 180, 152, 154, 154, 205, 206, 146, - 149, 37, 63, 218, 191, 146, 146, 221, 221, 221, - 15, 57, 15, 146, 234, 221, 150, 222, 184, 222, - 222, 222, 146, 146, 146, 184, 222, 221, 221, 146, - 34, 57, 178, 181, 148, 148, 189, 189, 189, 189, - 189, 146, 152, 154, 156, 189, 189, 189, 189, 189, - 37, 207, 178, 179, 24, 154, 21, 21, 148, 146, - 146, 221, 4, 221, 222, 230, 146, 221, 146, 146, - 146, 221, 221, 221, 148, 184, 24, 4, 180, 189, - 189, 234, 146, 146, 146, 146, 189, 146, 146, 146, - 36, 146, 57, 176, 146, 221, 221, 230, 231, 221, - 221, 146, 177, 177, 146, 221, 146, 222, 222, 222, - 231, 221, 146, 146, 149, 189, 189, 189, 189, 189, - 189, 189, 184, 189, 4, 24, 146, 150, 149, 222, - 152, 221, 149, 189, 189, 146, 149, 146, 146, 149, - 149, 149, 149, 149, 21, 152, 171, 227, 36, 152, - 149, 149, 189, 189, 189, 221, 219, 152, 171, 21, - 149, 149, 149, 146, 219, 221, 21, 146, 76, 221, - 21, 21, 221, 221 + 135, 136, 137, 138, 155, 156, 157, 158, 218, 224, + 225, 227, 228, 24, 55, 56, 193, 4, 24, 24, + 196, 176, 176, 176, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 161, 162, 164, 176, 181, + 145, 145, 150, 179, 140, 150, 142, 37, 179, 180, + 176, 214, 59, 8, 214, 9, 21, 10, 11, 12, + 13, 14, 15, 16, 17, 161, 162, 163, 167, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 159, + 27, 28, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 160, 176, 176, 214, + 176, 176, 221, 214, 214, 214, 214, 214, 176, 176, + 214, 214, 167, 115, 116, 140, 146, 190, 191, 189, + 27, 28, 3, 4, 3, 4, 7, 26, 38, 39, + 90, 91, 117, 131, 136, 137, 138, 144, 147, 149, + 152, 155, 156, 157, 158, 182, 212, 188, 178, 178, + 148, 150, 178, 37, 176, 199, 200, 201, 140, 143, + 3, 4, 7, 26, 27, 28, 38, 39, 61, 147, + 182, 211, 212, 213, 213, 213, 213, 174, 176, 176, + 140, 169, 140, 169, 213, 144, 140, 140, 140, 140, + 140, 140, 213, 213, 36, 140, 174, 176, 214, 24, + 140, 172, 172, 172, 159, 160, 142, 142, 142, 142, + 142, 146, 181, 183, 183, 150, 183, 24, 142, 142, + 142, 142, 172, 146, 148, 148, 197, 198, 140, 143, + 37, 63, 210, 183, 140, 140, 213, 213, 213, 15, + 57, 15, 140, 226, 213, 144, 214, 176, 214, 214, + 214, 140, 140, 176, 214, 213, 213, 140, 34, 57, + 170, 173, 142, 142, 181, 181, 181, 181, 181, 140, + 146, 148, 150, 181, 181, 181, 181, 37, 199, 170, + 171, 24, 148, 21, 21, 142, 140, 140, 213, 4, + 213, 214, 222, 140, 213, 140, 140, 140, 213, 213, + 142, 176, 24, 4, 172, 181, 181, 226, 140, 140, + 140, 140, 181, 140, 140, 36, 140, 57, 168, 140, + 213, 213, 222, 223, 213, 213, 140, 169, 169, 140, + 213, 140, 214, 214, 214, 223, 213, 140, 140, 143, + 181, 181, 181, 181, 181, 181, 176, 181, 4, 24, + 140, 144, 143, 214, 146, 213, 143, 181, 181, 140, + 143, 140, 140, 143, 143, 143, 143, 21, 146, 163, + 219, 36, 146, 143, 143, 181, 181, 181, 213, 211, + 146, 163, 21, 143, 143, 143, 140, 211, 213, 21, + 140, 76, 213, 21, 21, 213, 213 }; -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -2324,26 +2324,59 @@ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up");\ + { \ + yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif #endif + /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -2366,19 +2399,13 @@ YYFPRINTF Args; \ } while (0) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value); \ + yysymprint (stderr, \ + Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -2390,12 +2417,12 @@ #if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (short *bottom, short *top) +yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) - short *bottom; - short *top; + short int *bottom; + short int *top; #endif { YYFPRINTF (stderr, "Stack now"); @@ -2425,13 +2452,13 @@ #endif { int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ @@ -2445,8 +2472,7 @@ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -2461,13 +2487,9 @@ if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -2489,7 +2511,7 @@ const char *yystr; # endif { - register const char *yys = yystr; + const char *yys = yystr; while (*yys++ != '\0') continue; @@ -2514,8 +2536,8 @@ const char *yysrc; # endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -2525,7 +2547,55 @@ # endif # endif -#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* YYERROR_VERBOSE */ @@ -2549,15 +2619,15 @@ (void) yyvaluep; if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - } + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif switch (yytype) { default: @@ -2573,10 +2643,11 @@ #if defined (__STDC__) || defined (__cplusplus) static void -yydestruct (int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yytype, yyvaluep) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif @@ -2584,6 +2655,10 @@ /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + switch (yytype) { @@ -2611,10 +2686,10 @@ -/* The lookahead symbol. */ +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -2645,12 +2720,12 @@ #endif { - register int yystate; - register int yyn; + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: @@ -2662,14 +2737,14 @@ to reallocate them elsewhere. */ /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp; @@ -2726,14 +2801,14 @@ these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + short int *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), @@ -2744,21 +2819,21 @@ } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - short *yyss1 = yyss; + short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); @@ -2790,18 +2865,18 @@ yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2816,7 +2891,7 @@ else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -2836,8 +2911,8 @@ if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -2887,712 +2962,702 @@ switch (yyn) { case 3: -#line 991 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" +#line 989 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! + if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); - yyval.SIntVal = (int32_t)yyvsp[0].UIntVal; + (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal); CHECK_FOR_ERROR ;} break; - case 5: -#line 1000 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { - if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range! - GEN_ERROR("Value too large for type!"); - yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val; - CHECK_FOR_ERROR -;} + case 31: +#line 1005 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} + break; + + case 32: +#line 1005 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} + break; + + case 33: +#line 1006 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} + break; + + case 34: +#line 1006 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} + break; + + case 35: +#line 1007 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} + break; + + case 36: +#line 1007 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} + break; + + case 37: +#line 1008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} + break; + + case 38: +#line 1008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 39: -#line 1017 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_EQ; ;} +#line 1009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 40: -#line 1017 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_NE; ;} +#line 1009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 41: -#line 1018 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_SLT; ;} +#line 1013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 42: -#line 1018 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_SGT; ;} +#line 1013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 43: -#line 1019 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_SLE; ;} +#line 1014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 44: -#line 1019 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_SGE; ;} +#line 1014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 45: -#line 1020 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_ULT; ;} +#line 1015 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 46: -#line 1020 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_UGT; ;} +#line 1015 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 47: -#line 1021 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_ULE; ;} +#line 1016 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 48: -#line 1021 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.IPredicate = ICmpInst::ICMP_UGE; ;} +#line 1016 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 49: -#line 1025 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;} +#line 1017 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 50: -#line 1025 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_ONE; ;} +#line 1017 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 51: -#line 1026 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_OLT; ;} +#line 1018 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 52: -#line 1026 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_OGT; ;} +#line 1018 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 53: -#line 1027 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_OLE; ;} +#line 1019 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 54: -#line 1027 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_OGE; ;} +#line 1019 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 55: -#line 1028 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_ORD; ;} +#line 1020 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 56: -#line 1028 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_UNO; ;} +#line 1021 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; - case 57: -#line 1029 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;} + case 69: +#line 1032 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = (yyvsp[-1].StrVal); + CHECK_FOR_ERROR + ;} break; - case 58: -#line 1029 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_UNE; ;} + case 70: +#line 1036 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = 0; + CHECK_FOR_ERROR + ;} break; - case 59: -#line 1030 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_ULT; ;} + case 71: +#line 1041 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; - case 60: -#line 1030 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_UGT; ;} + case 72: +#line 1042 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; - case 61: -#line 1031 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_ULE; ;} + case 73: +#line 1043 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; - case 62: -#line 1031 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_UGE; ;} + case 74: +#line 1044 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; - case 63: -#line 1032 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;} + case 75: +#line 1045 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; - case 64: -#line 1033 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;} + case 76: +#line 1046 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 77: -#line 1044 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { - yyval.StrVal = yyvsp[-1].StrVal; - CHECK_FOR_ERROR - ;} +#line 1047 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 78: -#line 1048 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { - yyval.StrVal = 0; - CHECK_FOR_ERROR - ;} +#line 1048 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 79: -#line 1053 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Linkage = GlobalValue::InternalLinkage; ;} +#line 1050 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::C; ;} break; case 80: -#line 1054 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;} +#line 1051 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::C; ;} break; case 81: -#line 1055 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Linkage = GlobalValue::WeakLinkage; ;} +#line 1052 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::CSRet; ;} break; case 82: -#line 1056 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Linkage = GlobalValue::AppendingLinkage; ;} +#line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 83: -#line 1057 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Linkage = GlobalValue::DLLImportLinkage; ;} +#line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 84: -#line 1058 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Linkage = GlobalValue::DLLExportLinkage; ;} +#line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 85: -#line 1059 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;} +#line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 86: -#line 1060 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Linkage = GlobalValue::ExternalLinkage; ;} - break; - - case 87: -#line 1062 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.UIntVal = CallingConv::C; ;} - break; - - case 88: -#line 1063 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.UIntVal = CallingConv::C; ;} - break; - - case 89: -#line 1064 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.UIntVal = CallingConv::CSRet; ;} - break; - - case 90: -#line 1065 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.UIntVal = CallingConv::Fast; ;} - break; - - case 91: -#line 1066 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.UIntVal = CallingConv::Cold; ;} - break; - - case 92: -#line 1067 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.UIntVal = CallingConv::X86_StdCall; ;} - break; - - case 93: -#line 1068 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.UIntVal = CallingConv::X86_FastCall; ;} - break; - - case 94: -#line 1069 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" +#line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) + if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) GEN_ERROR("Calling conv too large!"); - yyval.UIntVal = yyvsp[0].UInt64Val; + (yyval.UIntVal) = (yyvsp[0].UInt64Val); CHECK_FOR_ERROR ;} break; - case 95: -#line 1078 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.UIntVal = 0; ;} + case 87: +#line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = 0; ;} break; - case 96: -#line 1079 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 88: +#line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.UIntVal = yyvsp[0].UInt64Val; - if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) + (yyval.UIntVal) = (yyvsp[0].UInt64Val); + if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) GEN_ERROR("Alignment must be a power of two!"); CHECK_FOR_ERROR ;} break; - case 97: -#line 1085 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.UIntVal = 0; ;} + case 89: +#line 1073 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = 0; ;} break; - case 98: -#line 1086 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 90: +#line 1074 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.UIntVal = yyvsp[0].UInt64Val; - if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) + (yyval.UIntVal) = (yyvsp[0].UInt64Val); + if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) GEN_ERROR("Alignment must be a power of two!"); CHECK_FOR_ERROR ;} break; - case 99: -#line 1094 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 91: +#line 1082 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i) - if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\') + for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) + if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') GEN_ERROR("Invalid character in section name!"); - yyval.StrVal = yyvsp[0].StrVal; + (yyval.StrVal) = (yyvsp[0].StrVal); CHECK_FOR_ERROR ;} break; - case 100: -#line 1102 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.StrVal = 0; ;} + case 92: +#line 1090 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = 0; ;} break; - case 101: -#line 1103 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.StrVal = yyvsp[0].StrVal; ;} + case 93: +#line 1091 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = (yyvsp[0].StrVal); ;} break; - case 102: -#line 1108 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 94: +#line 1096 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" {;} break; - case 103: -#line 1109 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 95: +#line 1097 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" {;} break; - case 104: -#line 1110 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 96: +#line 1098 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - CurGV->setSection(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + CurGV->setSection((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; - case 105: -#line 1115 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 97: +#line 1103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) + if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) GEN_ERROR("Alignment must be a power of two!"); - CurGV->setAlignment(yyvsp[0].UInt64Val); + CurGV->setAlignment((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR ;} break; - case 107: -#line 1129 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;} + case 99: +#line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; - case 109: -#line 1130 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;} + case 101: +#line 1118 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; - case 110: -#line 1132 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 102: +#line 1120 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); - yyval.TypeVal = yyvsp[0].TypeVal; + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); + (yyval.TypeVal) = (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; - case 124: -#line 1144 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 116: +#line 1132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.TypeVal = new PATypeHolder(OpaqueType::get()); + (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR ;} break; - case 125: -#line 1148 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 117: +#line 1136 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); + (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); CHECK_FOR_ERROR ;} break; - case 126: -#line 1152 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 118: +#line 1140 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... - const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); + const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.TypeVal = new PATypeHolder(tmp); + (yyval.TypeVal) = new PATypeHolder(tmp); ;} break; - case 127: -#line 1160 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 119: +#line 1148 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Type UpReference - if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range!"); + if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder - UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector... - yyval.TypeVal = new PATypeHolder(OT); + UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... + (yyval.TypeVal) = new PATypeHolder(OT); UR_OUT("New Upreference!\n"); CHECK_FOR_ERROR ;} break; - case 128: -#line 1168 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 120: +#line 1156 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Function derived type? std::vector Params; - for (std::list::iterator I = yyvsp[-1].TypeList->begin(), - E = yyvsp[-1].TypeList->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), + E = (yyvsp[-1].TypeList)->end(); I != E; ++I) Params.push_back(*I); bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(FunctionType::get(*yyvsp[-3].TypeVal,Params,isVarArg))); - delete yyvsp[-1].TypeList; // Delete the argument list - delete yyvsp[-3].TypeVal; // Delete the return type handle + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg))); + delete (yyvsp[-1].TypeList); // Delete the argument list + delete (yyvsp[-3].TypeVal); // Delete the return type handle CHECK_FOR_ERROR ;} break; - case 129: -#line 1181 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 121: +#line 1169 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Sized array type? - yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); - delete yyvsp[-1].TypeVal; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 130: -#line 1186 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 122: +#line 1174 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Packed array type? - const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); - if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) + const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); + if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) GEN_ERROR("Unsigned result not equal to signed result"); if (!ElemTy->isPrimitiveType()) GEN_ERROR("Elemental type of a PackedType must be primitive"); - if (!isPowerOf2_32(yyvsp[-3].UInt64Val)) + if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) GEN_ERROR("Vector length should be a power of 2!"); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); - delete yyvsp[-1].TypeVal; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 131: -#line 1198 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 123: +#line 1186 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; - for (std::list::iterator I = yyvsp[-1].TypeList->begin(), - E = yyvsp[-1].TypeList->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), + E = (yyvsp[-1].TypeList)->end(); I != E; ++I) Elements.push_back(*I); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); - delete yyvsp[-1].TypeList; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); + delete (yyvsp[-1].TypeList); CHECK_FOR_ERROR ;} break; - case 132: -#line 1208 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 124: +#line 1196 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? - yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); + (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR ;} break; - case 133: -#line 1212 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 125: +#line 1200 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; - for (std::list::iterator I = yyvsp[-2].TypeList->begin(), - E = yyvsp[-2].TypeList->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[-2].TypeList)->begin(), + E = (yyvsp[-2].TypeList)->end(); I != E; ++I) Elements.push_back(*I); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); - delete yyvsp[-2].TypeList; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); + delete (yyvsp[-2].TypeList); CHECK_FOR_ERROR ;} break; - case 134: -#line 1222 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 126: +#line 1210 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? - yyval.TypeVal = new PATypeHolder(StructType::get(std::vector(), true)); + (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR ;} break; - case 135: -#line 1226 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 127: +#line 1214 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Pointer type? - if (*yyvsp[-1].TypeVal == Type::LabelTy) + if (*(yyvsp[-1].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); - delete yyvsp[-1].TypeVal; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 136: -#line 1237 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 128: +#line 1225 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.TypeList = new std::list(); - yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; + (yyval.TypeList) = new std::list(); + (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; - case 137: -#line 1242 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 129: +#line 1230 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; + ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; - case 139: -#line 1249 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 131: +#line 1237 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy); + ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); CHECK_FOR_ERROR ;} break; - case 140: -#line 1253 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 132: +#line 1241 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - (yyval.TypeList = new std::list())->push_back(Type::VoidTy); + ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR ;} break; - case 141: -#line 1257 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 133: +#line 1245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.TypeList = new std::list(); + (yyval.TypeList) = new std::list(); CHECK_FOR_ERROR ;} break; - case 142: -#line 1268 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 134: +#line 1256 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast(yyvsp[-3].TypeVal->get()); + const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*yyvsp[-3].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); const Type *ETy = ATy->getElementType(); int NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized array initialized with " + - utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + + utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { - if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); } - yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector); - delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); + delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR ;} break; - case 143: -#line 1294 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 135: +#line 1282 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*yyvsp[-2].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); int NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +"!"); - yyval.ConstVal = ConstantArray::get(ATy, std::vector()); - delete yyvsp[-2].TypeVal; + (yyval.ConstVal) = ConstantArray::get(ATy, std::vector()); + delete (yyvsp[-2].TypeVal); CHECK_FOR_ERROR ;} break; - case 144: -#line 1308 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 136: +#line 1296 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*yyvsp[-2].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); int NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); - char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); - if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal)) + char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); + if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) GEN_ERROR("Can't build string constant of size " + - itostr((int)(EndStr-yyvsp[0].StrVal)) + + itostr((int)(EndStr-(yyvsp[0].StrVal))) + " when array has size " + itostr(NumElements) + "!"); std::vector Vals; if (ETy == Type::SByteTy) { - for (signed char *C = (signed char *)yyvsp[0].StrVal; C != (signed char *)EndStr; ++C) + for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C) Vals.push_back(ConstantInt::get(ETy, *C)); } else if (ETy == Type::UByteTy) { - for (unsigned char *C = (unsigned char *)yyvsp[0].StrVal; + for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); C != (unsigned char*)EndStr; ++C) Vals.push_back(ConstantInt::get(ETy, *C)); } else { - free(yyvsp[0].StrVal); + free((yyvsp[0].StrVal)); GEN_ERROR("Cannot build string arrays of non byte sized elements!"); } - free(yyvsp[0].StrVal); - yyval.ConstVal = ConstantArray::get(ATy, Vals); - delete yyvsp[-2].TypeVal; + free((yyvsp[0].StrVal)); + (yyval.ConstVal) = ConstantArray::get(ATy, Vals); + delete (yyvsp[-2].TypeVal); CHECK_FOR_ERROR ;} break; - case 145: -#line 1338 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 137: +#line 1326 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr - const PackedType *PTy = dyn_cast(yyvsp[-3].TypeVal->get()); + const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make packed constant with type: '" + - (*yyvsp[-3].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); const Type *ETy = PTy->getElementType(); int NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized packed initialized with " + - utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + + utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { - if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); } - yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector); - delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector)); + delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR ;} break; - case 146: -#line 1364 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 138: +#line 1352 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get()); + const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*yyvsp[-3].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); - if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes()) + if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) GEN_ERROR("Illegal number of initializers for structure type!"); // Check to ensure that constants are compatible with the type initializer! - for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i) - if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i)) + for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) + if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) GEN_ERROR("Expected type '" + STy->getElementType(i)->getDescription() + "' for element #" + utostr(i) + " of structure initializer!"); - yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector); - delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); + delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR ;} break; - case 147: -#line 1385 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 139: +#line 1373 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - const StructType *STy = dyn_cast(yyvsp[-2].TypeVal->get()); + const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*yyvsp[-2].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); if (STy->getNumContainedTypes() != 0) GEN_ERROR("Illegal number of initializers for structure type!"); - yyval.ConstVal = ConstantStruct::get(STy, std::vector()); - delete yyvsp[-2].TypeVal; + (yyval.ConstVal) = ConstantStruct::get(STy, std::vector()); + delete (yyvsp[-2].TypeVal); CHECK_FOR_ERROR ;} break; - case 148: -#line 1398 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 140: +#line 1386 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - const PointerType *PTy = dyn_cast(yyvsp[-1].TypeVal->get()); + const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make null pointer constant with type: '" + - (*yyvsp[-1].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-1].TypeVal))->getDescription() + "'!"); - yyval.ConstVal = ConstantPointerNull::get(PTy); - delete yyvsp[-1].TypeVal; + (yyval.ConstVal) = ConstantPointerNull::get(PTy); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 149: -#line 1408 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 141: +#line 1396 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); - delete yyvsp[-1].TypeVal; + (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 150: -#line 1413 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 142: +#line 1401 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - const PointerType *Ty = dyn_cast(yyvsp[-1].TypeVal->get()); + const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); if (Ty == 0) GEN_ERROR("Global const reference must be a pointer type!"); @@ -3606,7 +3671,7 @@ Function *SavedCurFn = CurFun.CurrentFunction; CurFun.CurrentFunction = 0; - Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal); + Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR CurFun.CurrentFunction = SavedCurFn; @@ -3621,14 +3686,14 @@ // First check to see if the forward references value is already created! PerModuleInfo::GlobalRefsType::iterator I = - CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal)); + CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); if (I != CurModule.GlobalRefs.end()) { V = I->second; // Placeholder already exists, use it... - yyvsp[0].ValIDVal.destroy(); + (yyvsp[0].ValIDVal).destroy(); } else { std::string Name; - if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name; + if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name; // Create the forward referenced global. GlobalValue *GV; @@ -3643,308 +3708,318 @@ } // Keep track of the fact that we have a forward ref to recycle it - CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV)); + CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV)); V = GV; } } - yyval.ConstVal = cast(V); - delete yyvsp[-1].TypeVal; // Free the type handle + (yyval.ConstVal) = cast(V); + delete (yyvsp[-1].TypeVal); // Free the type handle CHECK_FOR_ERROR ;} break; - case 151: -#line 1474 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 143: +#line 1462 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType()) + if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) GEN_ERROR("Mismatched types for constant expression!"); - yyval.ConstVal = yyvsp[0].ConstVal; - delete yyvsp[-1].TypeVal; + (yyval.ConstVal) = (yyvsp[0].ConstVal); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 152: -#line 1481 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 144: +#line 1469 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - const Type *Ty = yyvsp[-1].TypeVal->get(); + const Type *Ty = (yyvsp[-1].TypeVal)->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) GEN_ERROR("Cannot create a null initialized value of this type!"); - yyval.ConstVal = Constant::getNullValue(Ty); - delete yyvsp[-1].TypeVal; + (yyval.ConstVal) = Constant::getNullValue(Ty); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 153: -#line 1489 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 145: +#line 1477 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // integral constants - if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) + if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val); + (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); CHECK_FOR_ERROR ;} break; - case 154: -#line 1495 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { // integral constants - if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) + case 146: +#line 1483 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val); + (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); CHECK_FOR_ERROR ;} break; - case 155: -#line 1501 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { // Boolean constants - yyval.ConstVal = ConstantBool::getTrue(); + case 147: +#line 1489 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) + GEN_ERROR("Constant value doesn't fit in type!"); + (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); CHECK_FOR_ERROR ;} break; - case 156: -#line 1505 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { // Boolean constants - yyval.ConstVal = ConstantBool::getFalse(); - CHECK_FOR_ERROR - ;} + case 148: +#line 1495 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) + GEN_ERROR("Constant value doesn't fit in type!"); + (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); + CHECK_FOR_ERROR + ;} break; - case 157: -#line 1509 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 149: +#line 1501 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + (yyval.ConstVal) = ConstantBool::getTrue(); + CHECK_FOR_ERROR + ;} + break; + + case 150: +#line 1505 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + (yyval.ConstVal) = ConstantBool::getFalse(); + CHECK_FOR_ERROR + ;} + break; + + case 151: +#line 1509 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants - if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal)) + if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) GEN_ERROR("Floating point constant invalid for type!!"); - yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal); + (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); CHECK_FOR_ERROR ;} break; - case 158: -#line 1517 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 152: +#line 1517 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - Constant *Val = yyvsp[-3].ConstVal; - const Type *Ty = yyvsp[-1].TypeVal->get(); + Constant *Val = (yyvsp[-3].ConstVal); + const Type *Ty = (yyvsp[-1].TypeVal)->get(); if (!Val->getType()->isFirstClassType()) GEN_ERROR("cast constant expression from a non-primitive type: '" + Val->getType()->getDescription() + "'!"); if (!Ty->isFirstClassType()) GEN_ERROR("cast constant expression to a non-primitive type: '" + Ty->getDescription() + "'!"); - yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get()); - delete yyvsp[-1].TypeVal; + (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get()); + delete (yyvsp[-1].TypeVal); ;} break; - case 159: -#line 1529 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 153: +#line 1529 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!isa(yyvsp[-2].ConstVal->getType())) + if (!isa((yyvsp[-2].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand!"); const Type *IdxTy = - GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true); + GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true); if (!IdxTy) GEN_ERROR("Index list invalid for constant getelementptr!"); std::vector IdxVec; - for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i) - if (Constant *C = dyn_cast((*yyvsp[-1].ValueList)[i])) + for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) + if (Constant *C = dyn_cast((*(yyvsp[-1].ValueList))[i])) IdxVec.push_back(C); else GEN_ERROR("Indices to constant getelementptr must be constants!"); - delete yyvsp[-1].ValueList; + delete (yyvsp[-1].ValueList); - yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec); + (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec); CHECK_FOR_ERROR ;} break; - case 160: -#line 1550 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 154: +#line 1550 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[-5].ConstVal->getType() != Type::BoolTy) + if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) GEN_ERROR("Select condition must be of boolean type!"); - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Select operand types must match!"); - yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; - case 161: -#line 1558 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 155: +#line 1558 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Binary operator types must match!"); CHECK_FOR_ERROR; - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); ;} break; - case 162: -#line 1564 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 156: +#line 1564 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Logical operator types must match!"); - if (!yyvsp[-3].ConstVal->getType()->isIntegral()) { - if (!isa(yyvsp[-3].ConstVal->getType()) || - !cast(yyvsp[-3].ConstVal->getType())->getElementType()->isIntegral()) + if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) { + if (!isa((yyvsp[-3].ConstVal)->getType()) || + !cast((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); - CHECK_FOR_ERROR - ;} - break; - - case 163: -#line 1575 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) - GEN_ERROR("setcc operand types must match!"); - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; - case 164: -#line 1581 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 157: +#line 1575 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("icmp operand types must match!"); - yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); ;} break; - case 165: -#line 1586 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 158: +#line 1580 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match!"); - yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); ;} break; - case 166: -#line 1591 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 159: +#line 1585 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[-1].ConstVal->getType() != Type::UByteTy) + if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) GEN_ERROR("Shift count for shift constant must be unsigned byte!"); - if (!yyvsp[-3].ConstVal->getType()->isInteger()) + if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); CHECK_FOR_ERROR; - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; - case 167: -#line 1600 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 160: +#line 1594 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid extractelement operands!"); - yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; - case 168: -#line 1606 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 161: +#line 1600 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid insertelement operands!"); - yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; - case 169: -#line 1612 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 162: +#line 1606 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid shufflevector operands!"); - yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; - case 170: -#line 1621 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 163: +#line 1615 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); + ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; - case 171: -#line 1625 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 164: +#line 1619 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ConstVector = new std::vector(); - yyval.ConstVector->push_back(yyvsp[0].ConstVal); + (yyval.ConstVector) = new std::vector(); + (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; - case 172: -#line 1633 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.BoolVal = false; ;} + case 165: +#line 1627 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = false; ;} break; - case 173: -#line 1633 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.BoolVal = true; ;} + case 166: +#line 1627 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = true; ;} break; - case 174: -#line 1643 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 167: +#line 1637 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; + (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); CurModule.ModuleDone(); CHECK_FOR_ERROR; ;} break; - case 175: -#line 1651 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 168: +#line 1645 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ModuleVal = yyvsp[-1].ModuleVal; + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); CHECK_FOR_ERROR ;} break; - case 176: -#line 1656 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 169: +#line 1650 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ModuleVal = yyvsp[-1].ModuleVal; + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR ;} break; - case 177: -#line 1660 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 170: +#line 1654 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ModuleVal = yyvsp[-3].ModuleVal; + (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); CHECK_FOR_ERROR ;} break; - case 178: -#line 1664 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 171: +#line 1658 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ModuleVal = yyvsp[-1].ModuleVal; + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR ;} break; - case 179: -#line 1668 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 172: +#line 1662 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ModuleVal = CurModule.CurrentModule; + (yyval.ModuleVal) = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. if (!CurModule.LateResolveTypes.empty()) { const ValID &DID = CurModule.LateResolveTypes.begin()->first; @@ -3958,8 +4033,8 @@ ;} break; - case 180: -#line 1683 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 173: +#line 1677 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: @@ -3970,130 +4045,130 @@ // If types are not resolved eagerly, then the two types will not be // determined to be the same type! // - ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal); + ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); - if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { + if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { CHECK_FOR_ERROR // If this is a named type that is not a redefinition, add it to the slot // table. - CurModule.Types.push_back(*yyvsp[0].TypeVal); + CurModule.Types.push_back(*(yyvsp[0].TypeVal)); } - delete yyvsp[0].TypeVal; + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; - case 181: -#line 1705 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 174: +#line 1699 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Function prototypes can be in const pool CHECK_FOR_ERROR ;} break; - case 182: -#line 1708 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 175: +#line 1702 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Asm blocks can be in the const pool CHECK_FOR_ERROR ;} break; - case 183: -#line 1711 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 176: +#line 1705 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[0].ConstVal == 0) + if ((yyvsp[0].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant!"); - CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal); + CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; - case 184: -#line 1716 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 177: +#line 1710 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; - case 185: -#line 1719 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 178: +#line 1713 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); + CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR - delete yyvsp[0].TypeVal; + delete (yyvsp[0].TypeVal); ;} break; - case 186: -#line 1723 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 179: +#line 1717 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 187: -#line 1727 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 180: +#line 1721 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::DLLImportLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); + CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR - delete yyvsp[0].TypeVal; + delete (yyvsp[0].TypeVal); ;} break; - case 188: -#line 1731 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 181: +#line 1725 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 189: -#line 1735 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 182: +#line 1729 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurGV = - ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalWeakLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); + ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR - delete yyvsp[0].TypeVal; + delete (yyvsp[0].TypeVal); ;} break; - case 190: -#line 1740 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 183: +#line 1734 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 191: -#line 1744 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 184: +#line 1738 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 192: -#line 1747 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 185: +#line 1741 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 193: -#line 1750 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 186: +#line 1744 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { ;} break; - case 194: -#line 1754 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 187: +#line 1748 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); - char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); - std::string NewAsm(yyvsp[0].StrVal, EndStr); - free(yyvsp[0].StrVal); + char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); + std::string NewAsm((yyvsp[0].StrVal), EndStr); + free((yyvsp[0].StrVal)); if (AsmSoFar.empty()) CurModule.CurrentModule->setModuleInlineAsm(NewAsm); @@ -4103,171 +4178,171 @@ ;} break; - case 195: -#line 1767 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Endianness = Module::BigEndian; ;} + case 188: +#line 1761 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Endianness) = Module::BigEndian; ;} break; - case 196: -#line 1768 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.Endianness = Module::LittleEndian; ;} + case 189: +#line 1762 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Endianness) = Module::LittleEndian; ;} break; - case 197: -#line 1770 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 190: +#line 1764 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness); + CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); CHECK_FOR_ERROR ;} break; - case 198: -#line 1774 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 191: +#line 1768 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[0].UInt64Val == 32) + if ((yyvsp[0].UInt64Val) == 32) CurModule.CurrentModule->setPointerSize(Module::Pointer32); - else if (yyvsp[0].UInt64Val == 64) + else if ((yyvsp[0].UInt64Val) == 64) CurModule.CurrentModule->setPointerSize(Module::Pointer64); else - GEN_ERROR("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!"); + GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!"); CHECK_FOR_ERROR ;} break; - case 199: -#line 1783 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 192: +#line 1777 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); ;} break; - case 200: -#line 1787 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 193: +#line 1781 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); ;} break; - case 202: -#line 1794 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 195: +#line 1788 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; - case 203: -#line 1799 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 196: +#line 1793 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; - case 204: -#line 1804 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 197: +#line 1798 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 208: -#line 1814 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.StrVal = 0; ;} + case 201: +#line 1808 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = 0; ;} break; - case 209: -#line 1816 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 202: +#line 1810 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (*yyvsp[-1].TypeVal == Type::VoidTy) + if (*(yyvsp[-1].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid!"); - yyval.ArgVal = new std::pair(yyvsp[-1].TypeVal, yyvsp[0].StrVal); + (yyval.ArgVal) = new std::pair((yyvsp[-1].TypeVal), (yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; - case 210: -#line 1823 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 203: +#line 1817 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ArgList = yyvsp[-2].ArgList; - yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal); - delete yyvsp[0].ArgVal; + (yyval.ArgList) = (yyvsp[-2].ArgList); + (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); + delete (yyvsp[0].ArgVal); CHECK_FOR_ERROR ;} break; - case 211: -#line 1829 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 204: +#line 1823 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ArgList = new std::vector >(); - yyval.ArgList->push_back(*yyvsp[0].ArgVal); - delete yyvsp[0].ArgVal; + (yyval.ArgList) = new std::vector >(); + (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); + delete (yyvsp[0].ArgVal); CHECK_FOR_ERROR ;} break; - case 212: -#line 1836 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 205: +#line 1830 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ArgList = yyvsp[0].ArgList; + (yyval.ArgList) = (yyvsp[0].ArgList); CHECK_FOR_ERROR ;} break; - case 213: -#line 1840 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 206: +#line 1834 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ArgList = yyvsp[-2].ArgList; - yyval.ArgList->push_back(std::pairpush_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); CHECK_FOR_ERROR ;} break; - case 214: -#line 1846 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 207: +#line 1840 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ArgList = new std::vector >(); - yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); + (yyval.ArgList) = new std::vector >(); + (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); CHECK_FOR_ERROR ;} break; - case 215: -#line 1851 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 208: +#line 1845 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ArgList = 0; + (yyval.ArgList) = 0; CHECK_FOR_ERROR ;} break; - case 216: -#line 1857 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 209: +#line 1851 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - UnEscapeLexed(yyvsp[-5].StrVal); - std::string FunctionName(yyvsp[-5].StrVal); - free(yyvsp[-5].StrVal); // Free strdup'd memory! + UnEscapeLexed((yyvsp[-5].StrVal)); + std::string FunctionName((yyvsp[-5].StrVal)); + free((yyvsp[-5].StrVal)); // Free strdup'd memory! - if (!(*yyvsp[-6].TypeVal)->isFirstClassType() && *yyvsp[-6].TypeVal != Type::VoidTy) + if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy) GEN_ERROR("LLVM functions cannot return aggregate types!"); std::vector ParamTypeList; - if (yyvsp[-3].ArgList) { // If there are arguments... - for (std::vector >::iterator I = yyvsp[-3].ArgList->begin(); - I != yyvsp[-3].ArgList->end(); ++I) + if ((yyvsp[-3].ArgList)) { // If there are arguments... + for (std::vector >::iterator I = (yyvsp[-3].ArgList)->begin(); + I != (yyvsp[-3].ArgList)->end(); ++I) ParamTypeList.push_back(I->first->get()); } bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; if (isVarArg) ParamTypeList.pop_back(); - const FunctionType *FT = FunctionType::get(*yyvsp[-6].TypeVal, ParamTypeList, isVarArg); + const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg); const PointerType *PFT = PointerType::get(FT); - delete yyvsp[-6].TypeVal; + delete (yyvsp[-6].TypeVal); ValID ID; if (!FunctionName.empty()) { @@ -4311,24 +4386,24 @@ // another function. Fn->setLinkage(CurFun.Linkage); } - Fn->setCallingConv(yyvsp[-7].UIntVal); - Fn->setAlignment(yyvsp[0].UIntVal); - if (yyvsp[-1].StrVal) { - Fn->setSection(yyvsp[-1].StrVal); - free(yyvsp[-1].StrVal); + Fn->setCallingConv((yyvsp[-7].UIntVal)); + Fn->setAlignment((yyvsp[0].UIntVal)); + if ((yyvsp[-1].StrVal)) { + Fn->setSection((yyvsp[-1].StrVal)); + free((yyvsp[-1].StrVal)); } // Add all of the arguments we parsed to the function... - if (yyvsp[-3].ArgList) { // Is null if empty... + if ((yyvsp[-3].ArgList)) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert(yyvsp[-3].ArgList->back().first->get() == Type::VoidTy && yyvsp[-3].ArgList->back().second == 0&& + assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&& "Not a varargs marker!"); - delete yyvsp[-3].ArgList->back().first; - yyvsp[-3].ArgList->pop_back(); // Delete the last entry + delete (yyvsp[-3].ArgList)->back().first; + (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); - for (std::vector >::iterator I = yyvsp[-3].ArgList->begin(); - I != yyvsp[-3].ArgList->end(); ++I, ++ArgIt) { + for (std::vector >::iterator I = (yyvsp[-3].ArgList)->begin(); + I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) { delete I->first; // Delete the typeholder... setValueName(ArgIt, I->second); // Insert arg into symtab... @@ -4336,140 +4411,140 @@ InsertValue(ArgIt); } - delete yyvsp[-3].ArgList; // We're now done with the argument list + delete (yyvsp[-3].ArgList); // We're now done with the argument list } CHECK_FOR_ERROR ;} break; - case 219: -#line 1953 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 212: +#line 1947 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.FunctionVal = CurFun.CurrentFunction; + (yyval.FunctionVal) = CurFun.CurrentFunction; // Make sure that we keep track of the linkage type even if there was a // previous "declare". - yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage); + (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); ;} break; - case 222: -#line 1963 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 215: +#line 1957 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.FunctionVal = yyvsp[-1].FunctionVal; + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; - case 224: -#line 1969 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 217: +#line 1963 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} break; - case 225: -#line 1970 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 218: +#line 1964 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;} break; - case 226: -#line 1972 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 219: +#line 1966 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; - case 227: -#line 1972 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 220: +#line 1966 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.FunctionVal = CurFun.CurrentFunction; + (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); CHECK_FOR_ERROR ;} break; - case 228: -#line 1982 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 221: +#line 1976 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.BoolVal = false; + (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 229: -#line 1986 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 222: +#line 1980 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.BoolVal = true; + (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 230: -#line 1991 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 223: +#line 1985 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant - yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); + (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); CHECK_FOR_ERROR ;} break; - case 231: -#line 1995 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 224: +#line 1989 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); + (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR ;} break; - case 232: -#line 1999 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 225: +#line 1993 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? - yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); + (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); CHECK_FOR_ERROR ;} break; - case 233: -#line 2003 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 226: +#line 1997 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValIDVal = ValID::create(ConstantBool::getTrue()); + (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR ;} break; - case 234: -#line 2007 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 227: +#line 2001 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValIDVal = ValID::create(ConstantBool::getFalse()); + (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR ;} break; - case 235: -#line 2011 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 228: +#line 2005 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValIDVal = ValID::createNull(); + (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR ;} break; - case 236: -#line 2015 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 229: +#line 2009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValIDVal = ValID::createUndef(); + (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR ;} break; - case 237: -#line 2019 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 230: +#line 2013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. - yyval.ValIDVal = ValID::createZeroInit(); + (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR ;} break; - case 238: -#line 2023 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 231: +#line 2017 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector - const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); - int NumElements = yyvsp[-1].ConstVector->size(); + const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); + int NumElements = (yyvsp[-1].ConstVector)->size(); PackedType* pt = PackedType::get(ETy, NumElements); PATypeHolder* PTy = new PATypeHolder( @@ -4481,112 +4556,112 @@ ); // Verify all elements are correct type! - for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { - if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '" + - (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); } - yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector)); - delete PTy; delete yyvsp[-1].ConstVector; + (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); + delete PTy; delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR ;} break; - case 239: -#line 2048 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 232: +#line 2042 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); + (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; - case 240: -#line 2052 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 233: +#line 2046 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - char *End = UnEscapeLexed(yyvsp[-2].StrVal, true); - std::string AsmStr = std::string(yyvsp[-2].StrVal, End); - End = UnEscapeLexed(yyvsp[0].StrVal, true); - std::string Constraints = std::string(yyvsp[0].StrVal, End); - yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal); - free(yyvsp[-2].StrVal); - free(yyvsp[0].StrVal); + char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); + std::string AsmStr = std::string((yyvsp[-2].StrVal), End); + End = UnEscapeLexed((yyvsp[0].StrVal), true); + std::string Constraints = std::string((yyvsp[0].StrVal), End); + (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); + free((yyvsp[-2].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; - case 241: -#line 2066 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 234: +#line 2060 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? - yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); + (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); CHECK_FOR_ERROR ;} break; - case 242: -#line 2070 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 235: +#line 2064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? - yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); + (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; - case 245: -#line 2082 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 238: +#line 2076 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal; + (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 246: -#line 2087 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 239: +#line 2081 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.FunctionVal = yyvsp[-1].FunctionVal; + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; - case 247: -#line 2091 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 240: +#line 2085 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks - yyval.FunctionVal = yyvsp[-1].FunctionVal; + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; - case 248: -#line 2100 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 241: +#line 2094 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); + setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); CHECK_FOR_ERROR - InsertValue(yyvsp[0].TermInstVal); + InsertValue((yyvsp[0].TermInstVal)); - yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); - InsertValue(yyvsp[-2].BasicBlockVal); - yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal; + (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); + InsertValue((yyvsp[-2].BasicBlockVal)); + (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); CHECK_FOR_ERROR ;} break; - case 249: -#line 2111 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 242: +#line 2105 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (CastInst *CI1 = dyn_cast(yyvsp[0].InstVal)) + if (CastInst *CI1 = dyn_cast((yyvsp[0].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) if (CI2->getParent() == 0) - yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2); - yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); - yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; + (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); + (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); + (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); CHECK_FOR_ERROR ;} break; - case 250: -#line 2120 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 243: +#line 2114 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.BasicBlockVal = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); + (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the @@ -4594,15 +4669,15 @@ // referenced. Function::BasicBlockListType &BBL = CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); + BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); CHECK_FOR_ERROR ;} break; - case 251: -#line 2132 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 244: +#line 2126 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.BasicBlockVal = getBBVal(ValID::create(yyvsp[0].StrVal), true); + (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true); CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the @@ -4610,97 +4685,97 @@ // referenced. Function::BasicBlockListType &BBL = CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); + BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); CHECK_FOR_ERROR ;} break; - case 252: -#line 2145 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 245: +#line 2139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Return with a result... - yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); + (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 253: -#line 2149 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 246: +#line 2143 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Return with no result... - yyval.TermInstVal = new ReturnInst(); + (yyval.TermInstVal) = new ReturnInst(); CHECK_FOR_ERROR ;} break; - case 254: -#line 2153 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 247: +#line 2147 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.TermInstVal = new BranchInst(tmpBB); + (yyval.TermInstVal) = new BranchInst(tmpBB); ;} break; - case 255: -#line 2158 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 248: +#line 2152 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); + BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal); + BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal = getVal(Type::BoolTy, yyvsp[-6].ValIDVal); + Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)); CHECK_FOR_ERROR - yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal); + (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); ;} break; - case 256: -#line 2167 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 249: +#line 2161 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); + Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR - SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size()); - yyval.TermInstVal = S; + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); + (yyval.TermInstVal) = S; - std::vector >::iterator I = yyvsp[-1].JumpTable->begin(), - E = yyvsp[-1].JumpTable->end(); + std::vector >::iterator I = (yyvsp[-1].JumpTable)->begin(), + E = (yyvsp[-1].JumpTable)->end(); for (; I != E; ++I) { if (ConstantInt *CI = dyn_cast(I->first)) S->addCase(CI, I->second); else GEN_ERROR("Switch case is constant, but not a simple integer!"); } - delete yyvsp[-1].JumpTable; + delete (yyvsp[-1].JumpTable); CHECK_FOR_ERROR ;} break; - case 257: -#line 2186 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 250: +#line 2180 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); + Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); - yyval.TermInstVal = S; + (yyval.TermInstVal) = S; CHECK_FOR_ERROR ;} break; - case 258: -#line 2196 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 251: +#line 2190 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; - if (!(PFTy = dyn_cast(yyvsp[-10].TypeVal->get())) || + if (!(PFTy = dyn_cast((yyvsp[-10].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - if (yyvsp[-7].ValueList) { - for (std::vector::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end(); + if ((yyvsp[-7].ValueList)) { + for (std::vector::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end(); I != E; ++I) ParamTypes.push_back((*I)->getType()); } @@ -4708,27 +4783,27 @@ bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - Ty = FunctionType::get(yyvsp[-10].TypeVal->get(), ParamTypes, isVarArg); + Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg); PFTy = PointerType::get(Ty); } - Value *V = getVal(PFTy, yyvsp[-9].ValIDVal); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR - BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal); + BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR - BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal); + BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR // Create the call node... - if (!yyvsp[-7].ValueList) { // Has no arguments? - yyval.TermInstVal = new InvokeInst(V, Normal, Except, std::vector()); + if (!(yyvsp[-7].ValueList)) { // Has no arguments? + (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector()); } else { // Has arguments? // Loop through FunctionType's arguments and ensure they are specified // correctly! // FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end(); + std::vector::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) if ((*ArgI)->getType() != *I) @@ -4738,355 +4813,337 @@ if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - yyval.TermInstVal = new InvokeInst(V, Normal, Except, *yyvsp[-7].ValueList); + (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList)); } - cast(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal); + cast((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal)); - delete yyvsp[-10].TypeVal; - delete yyvsp[-7].ValueList; + delete (yyvsp[-10].TypeVal); + delete (yyvsp[-7].ValueList); CHECK_FOR_ERROR ;} break; - case 259: -#line 2251 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 252: +#line 2245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.TermInstVal = new UnwindInst(); + (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR ;} break; - case 260: -#line 2255 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 253: +#line 2249 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.TermInstVal = new UnreachableInst(); + (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR ;} break; - case 261: -#line 2262 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 254: +#line 2256 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.JumpTable = yyvsp[-5].JumpTable; - Constant *V = cast(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); + (yyval.JumpTable) = (yyvsp[-5].JumpTable); + Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); + (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); ;} break; - case 262: -#line 2273 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 255: +#line 2267 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.JumpTable = new std::vector >(); - Constant *V = cast(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); + (yyval.JumpTable) = new std::vector >(); + Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); + (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); ;} break; - case 263: -#line 2286 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 256: +#line 2280 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... - setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); + setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); CHECK_FOR_ERROR - InsertValue(yyvsp[0].InstVal); - yyval.InstVal = yyvsp[0].InstVal; + InsertValue((yyvsp[0].InstVal)); + (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR ;} break; - case 264: -#line 2295 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 257: +#line 2289 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes - yyval.PHIList = new std::list >(); - Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal); + (yyval.PHIList) = new std::list >(); + Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR - yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB)); - delete yyvsp[-5].TypeVal; + (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); + delete (yyvsp[-5].TypeVal); ;} break; - case 265: -#line 2304 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 258: +#line 2298 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.PHIList = yyvsp[-6].PHIList; - Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); + (yyval.PHIList) = (yyvsp[-6].PHIList); + Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR - yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB)); + (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); ;} break; - case 266: -#line 2314 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 259: +#line 2308 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { // Used for call statements, and memory insts... - yyval.ValueList = new std::vector(); - yyval.ValueList->push_back(yyvsp[0].ValueVal); + (yyval.ValueList) = new std::vector(); + (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); ;} break; - case 267: -#line 2318 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 260: +#line 2312 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValueList = yyvsp[-2].ValueList; - yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal); + (yyval.ValueList) = (yyvsp[-2].ValueList); + (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 269: -#line 2325 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { yyval.ValueList = 0; ;} + case 262: +#line 2319 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.ValueList) = 0; ;} break; - case 270: -#line 2327 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 263: +#line 2321 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.BoolVal = true; + (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 271: -#line 2331 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 264: +#line 2325 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.BoolVal = false; + (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 272: -#line 2336 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 265: +#line 2330 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && - !isa((*yyvsp[-3].TypeVal).get())) + if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && + !isa((*(yyvsp[-3].TypeVal)).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*yyvsp[-3].TypeVal).get()) && - (yyvsp[-4].BinaryOpVal == Instruction::URem || - yyvsp[-4].BinaryOpVal == Instruction::SRem || - yyvsp[-4].BinaryOpVal == Instruction::FRem)) + if (isa((*(yyvsp[-3].TypeVal)).get()) && + ((yyvsp[-4].BinaryOpVal) == Instruction::URem || + (yyvsp[-4].BinaryOpVal) == Instruction::SRem || + (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) GEN_ERROR("U/S/FRem not supported on packed types!"); - Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR - Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete yyvsp[-3].TypeVal; + delete (yyvsp[-3].TypeVal); ;} break; - case 273: -#line 2355 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 266: +#line 2349 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!(*yyvsp[-3].TypeVal)->isIntegral()) { - if (!isa(yyvsp[-3].TypeVal->get()) || - !cast(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral()) + if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { + if (!isa((yyvsp[-3].TypeVal)->get()) || + !cast((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete yyvsp[-3].TypeVal; + delete (yyvsp[-3].TypeVal); ;} break; - case 274: -#line 2370 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" - { - if(isa((*yyvsp[-3].TypeVal).get())) { - GEN_ERROR( - "PackedTypes currently not supported in setcc instructions!"); - } - Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); - CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); - CHECK_FOR_ERROR - yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) - GEN_ERROR("binary operator returned null!"); - delete yyvsp[-3].TypeVal; - ;} - break; - - case 275: -#line 2384 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 267: +#line 2364 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (isa((*yyvsp[-3].TypeVal).get())) + if (isa((*(yyvsp[-3].TypeVal)).get())) GEN_ERROR("Packed types not supported by icmp instruction"); - Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("icmp operator returned null!"); ;} break; - case 276: -#line 2395 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 268: +#line 2375 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (isa((*yyvsp[-3].TypeVal).get())) + if (isa((*(yyvsp[-3].TypeVal)).get())) GEN_ERROR("Packed types not supported by fcmp instruction"); - Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("fcmp operator returned null!"); ;} break; - case 277: -#line 2406 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 269: +#line 2386 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { cerr << "WARNING: Use of eliminated 'not' instruction:" << " Replacing with 'xor'.\n"; - Value *Ones = ConstantIntegral::getAllOnesValue(yyvsp[0].ValueVal->getType()); + Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType()); if (Ones == 0) GEN_ERROR("Expected integral type for not instruction!"); - yyval.InstVal = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal, Ones); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones); + if ((yyval.InstVal) == 0) GEN_ERROR("Could not create a xor instruction!"); CHECK_FOR_ERROR ;} break; - case 278: -#line 2419 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 270: +#line 2399 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[0].ValueVal->getType() != Type::UByteTy) + if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) GEN_ERROR("Shift amount must be ubyte!"); - if (!yyvsp[-2].ValueVal->getType()->isInteger()) + if (!(yyvsp[-2].ValueVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); CHECK_FOR_ERROR; - yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 279: -#line 2428 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 271: +#line 2408 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - Value* Val = yyvsp[-2].ValueVal; - const Type* Ty = yyvsp[0].TypeVal->get(); + Value* Val = (yyvsp[-2].ValueVal); + const Type* Ty = (yyvsp[0].TypeVal)->get(); if (!Val->getType()->isFirstClassType()) GEN_ERROR("cast from a non-primitive type: '" + Val->getType()->getDescription() + "'!"); if (!Ty->isFirstClassType()) GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!"); - yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, yyvsp[-2].ValueVal, yyvsp[0].TypeVal->get()); - delete yyvsp[0].TypeVal; + (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get()); + delete (yyvsp[0].TypeVal); ;} break; - case 280: -#line 2439 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 272: +#line 2419 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[-4].ValueVal->getType() != Type::BoolTy) + if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) GEN_ERROR("select condition must be boolean!"); - if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType()) + if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) GEN_ERROR("select value types should match!"); - yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 281: -#line 2447 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 273: +#line 2427 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); - delete yyvsp[0].TypeVal; + (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; - case 282: -#line 2452 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 274: +#line 2432 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid extractelement operands!"); - yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 283: -#line 2458 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 275: +#line 2438 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid insertelement operands!"); - yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 284: -#line 2464 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 276: +#line 2444 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid shufflevector operands!"); - yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 285: -#line 2470 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 277: +#line 2450 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - const Type *Ty = yyvsp[0].PHIList->front().first->getType(); + const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) GEN_ERROR("PHI node operands must be of first class type!"); - yyval.InstVal = new PHINode(Ty); - ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size()); - while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) { - if (yyvsp[0].PHIList->front().first->getType() != Ty) + (yyval.InstVal) = new PHINode(Ty); + ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); + while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { + if ((yyvsp[0].PHIList)->front().first->getType() != Ty) GEN_ERROR("All elements of a PHI node must be of the same type!"); - cast(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second); - yyvsp[0].PHIList->pop_front(); + cast((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); + (yyvsp[0].PHIList)->pop_front(); } - delete yyvsp[0].PHIList; // Free the list... + delete (yyvsp[0].PHIList); // Free the list... CHECK_FOR_ERROR ;} break; - case 286: -#line 2485 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 278: +#line 2465 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast(yyvsp[-4].TypeVal->get())) || + if (!(PFTy = dyn_cast((yyvsp[-4].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - if (yyvsp[-1].ValueList) { - for (std::vector::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end(); + if ((yyvsp[-1].ValueList)) { + for (std::vector::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end(); I != E; ++I) ParamTypes.push_back((*I)->getType()); } @@ -5094,31 +5151,31 @@ bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy) + if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy) GEN_ERROR("LLVM functions cannot return aggregate types!"); - Ty = FunctionType::get(yyvsp[-4].TypeVal->get(), ParamTypes, isVarArg); + Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg); PFTy = PointerType::get(Ty); } - Value *V = getVal(PFTy, yyvsp[-3].ValIDVal); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR // Create the call node... - if (!yyvsp[-1].ValueList) { // Has no arguments? + if (!(yyvsp[-1].ValueList)) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " "expects arguments!"); - yyval.InstVal = new CallInst(V, std::vector()); + (yyval.InstVal) = new CallInst(V, std::vector()); } else { // Has arguments? // Loop through FunctionType's arguments and ensure they are specified // correctly! // FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end(); + std::vector::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) if ((*ArgI)->getType() != *I) @@ -5128,162 +5185,163 @@ if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - yyval.InstVal = new CallInst(V, *yyvsp[-1].ValueList); + (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList)); } - cast(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal); - cast(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal); - delete yyvsp[-4].TypeVal; - delete yyvsp[-1].ValueList; + cast((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal)); + cast((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal)); + delete (yyvsp[-4].TypeVal); + delete (yyvsp[-1].ValueList); CHECK_FOR_ERROR ;} break; - case 287: -#line 2544 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 279: +#line 2524 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.InstVal = yyvsp[0].InstVal; + (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR ;} break; - case 288: -#line 2551 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 280: +#line 2531 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValueList = yyvsp[0].ValueList; + (yyval.ValueList) = (yyvsp[0].ValueList); CHECK_FOR_ERROR ;} break; - case 289: -#line 2554 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 281: +#line 2534 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.ValueList = new std::vector(); + (yyval.ValueList) = new std::vector(); CHECK_FOR_ERROR ;} break; - case 290: -#line 2559 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 282: +#line 2539 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.BoolVal = true; + (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 291: -#line 2563 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 283: +#line 2543 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.BoolVal = false; + (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 292: -#line 2570 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 284: +#line 2550 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); - delete yyvsp[-1].TypeVal; + (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 293: -#line 2575 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 285: +#line 2555 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); + Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); - delete yyvsp[-4].TypeVal; + (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); + delete (yyvsp[-4].TypeVal); ;} break; - case 294: -#line 2581 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 286: +#line 2561 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); - delete yyvsp[-1].TypeVal; + (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 295: -#line 2586 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 287: +#line 2566 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); + Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); - delete yyvsp[-4].TypeVal; + (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); + delete (yyvsp[-4].TypeVal); ;} break; - case 296: -#line 2592 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 288: +#line 2572 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!isa(yyvsp[0].ValueVal->getType())) + if (!isa((yyvsp[0].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + - yyvsp[0].ValueVal->getType()->getDescription() + "!"); - yyval.InstVal = new FreeInst(yyvsp[0].ValueVal); + (yyvsp[0].ValueVal)->getType()->getDescription() + "!"); + (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 297: -#line 2600 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 289: +#line 2580 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!isa(yyvsp[-1].TypeVal->get())) + if (!isa((yyvsp[-1].TypeVal)->get())) GEN_ERROR("Can't load from nonpointer type: " + - (*yyvsp[-1].TypeVal)->getDescription()); - if (!cast(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType()) + (*(yyvsp[-1].TypeVal))->getDescription()); + if (!cast((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) GEN_ERROR("Can't load from pointer of non-first-class type: " + - (*yyvsp[-1].TypeVal)->getDescription()); - Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); + (*(yyvsp[-1].TypeVal))->getDescription()); + Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-3].BoolVal); - delete yyvsp[-1].TypeVal; + (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); + delete (yyvsp[-1].TypeVal); ;} break; - case 298: -#line 2612 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 290: +#line 2592 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - const PointerType *PT = dyn_cast(yyvsp[-1].TypeVal->get()); + const PointerType *PT = dyn_cast((yyvsp[-1].TypeVal)->get()); if (!PT) GEN_ERROR("Can't store to a nonpointer type: " + - (*yyvsp[-1].TypeVal)->getDescription()); + (*(yyvsp[-1].TypeVal))->getDescription()); const Type *ElTy = PT->getElementType(); - if (ElTy != yyvsp[-3].ValueVal->getType()) - GEN_ERROR("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() + + if (ElTy != (yyvsp[-3].ValueVal)->getType()) + GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + "' into space of type '" + ElTy->getDescription() + "'!"); - Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, tmpVal, yyvsp[-5].BoolVal); - delete yyvsp[-1].TypeVal; + (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); + delete (yyvsp[-1].TypeVal); ;} break; - case 299: -#line 2627 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" + case 291: +#line 2607 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" { - if (!isa(yyvsp[-2].TypeVal->get())) + if (!isa((yyvsp[-2].TypeVal)->get())) GEN_ERROR("getelementptr insn requires pointer operand!"); - if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true)) + if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true)) GEN_ERROR("Invalid getelementptr indices for type '" + - (*yyvsp[-2].TypeVal)->getDescription()+ "'!"); - Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal); + (*(yyvsp[-2].TypeVal))->getDescription()+ "'!"); + Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new GetElementPtrInst(tmpVal, *yyvsp[0].ValueList); - delete yyvsp[-2].TypeVal; - delete yyvsp[0].ValueList; + (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList)); + delete (yyvsp[-2].TypeVal); + delete (yyvsp[0].ValueList); ;} break; + default: break; } -/* Line 1000 of yacc.c. */ -#line 5287 "llvmAsmParser.tab.c" +/* Line 1126 of yacc.c. */ +#line 5345 "llvmAsmParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -5322,12 +5380,36 @@ if (YYPACT_NINF < yyn && yyn < YYLAST) { - YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; @@ -5335,81 +5417,91 @@ /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); - yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { - yysize = 0; + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; break; } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - if (yycount < 5) + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else - yyerror ("syntax error; also virtual memory exhausted"); + { + yyerror (YY_("syntax error")); + goto yyexhaustedlab; + } } else #endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); + yyerror (YY_("syntax error")); } if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ + /* Return failure if at end of input. */ if (yychar == YYEOF) - for (;;) - { - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - } + YYABORT; } else { - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); + yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; - } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -5419,14 +5511,13 @@ `---------------------------------------------------*/ yyerrorlab: -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ if (0) goto yyerrorlab; -#endif - yyvsp -= yylen; +yyvsp -= yylen; yyssp -= yylen; yystate = *yyssp; goto yyerrlab1; @@ -5456,8 +5547,8 @@ if (yyssp == yyss) YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); + + yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -5466,11 +5557,12 @@ if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + yystate = yyn; goto yynewstate; @@ -5490,16 +5582,25 @@ goto yyreturn; #ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK; + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); @@ -5508,7 +5609,7 @@ } -#line 2642 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" +#line 2622 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.30 llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.31 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.30 Fri Dec 8 12:07:08 2006 +++ llvm/lib/AsmParser/llvmAsmParser.h.cvs Sat Dec 23 00:05:40 2006 @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ +/* A Bison parser, made by GNU Bison 2.1. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -116,63 +116,58 @@ AND = 342, OR = 343, XOR = 344, - SETLE = 345, - SETGE = 346, - SETLT = 347, - SETGT = 348, - SETEQ = 349, - SETNE = 350, - ICMP = 351, - FCMP = 352, - EQ = 353, - NE = 354, - SLT = 355, - SGT = 356, - SLE = 357, - SGE = 358, - ULT = 359, - UGT = 360, - ULE = 361, - UGE = 362, - OEQ = 363, - ONE = 364, - OLT = 365, - OGT = 366, - OLE = 367, - OGE = 368, - ORD = 369, - UNO = 370, - UEQ = 371, - UNE = 372, - MALLOC = 373, - ALLOCA = 374, - FREE = 375, - LOAD = 376, - STORE = 377, - GETELEMENTPTR = 378, - TRUNC = 379, - ZEXT = 380, - SEXT = 381, - FPTRUNC = 382, - FPEXT = 383, - BITCAST = 384, - UITOFP = 385, - SITOFP = 386, - FPTOUI = 387, - FPTOSI = 388, - INTTOPTR = 389, - PTRTOINT = 390, - PHI_TOK = 391, - SELECT = 392, - SHL = 393, - LSHR = 394, - ASHR = 395, - VAARG = 396, - EXTRACTELEMENT = 397, - INSERTELEMENT = 398, - SHUFFLEVECTOR = 399 + ICMP = 345, + FCMP = 346, + EQ = 347, + NE = 348, + SLT = 349, + SGT = 350, + SLE = 351, + SGE = 352, + ULT = 353, + UGT = 354, + ULE = 355, + UGE = 356, + OEQ = 357, + ONE = 358, + OLT = 359, + OGT = 360, + OLE = 361, + OGE = 362, + ORD = 363, + UNO = 364, + UEQ = 365, + UNE = 366, + MALLOC = 367, + ALLOCA = 368, + FREE = 369, + LOAD = 370, + STORE = 371, + GETELEMENTPTR = 372, + TRUNC = 373, + ZEXT = 374, + SEXT = 375, + FPTRUNC = 376, + FPEXT = 377, + BITCAST = 378, + UITOFP = 379, + SITOFP = 380, + FPTOUI = 381, + FPTOSI = 382, + INTTOPTR = 383, + PTRTOINT = 384, + PHI_TOK = 385, + SELECT = 386, + SHL = 387, + LSHR = 388, + ASHR = 389, + VAARG = 390, + EXTRACTELEMENT = 391, + INSERTELEMENT = 392, + SHUFFLEVECTOR = 393 }; #endif +/* Tokens. */ #define ESINT64VAL 258 #define EUINT64VAL 259 #define SINTVAL 260 @@ -260,67 +255,61 @@ #define AND 342 #define OR 343 #define XOR 344 -#define SETLE 345 -#define SETGE 346 -#define SETLT 347 -#define SETGT 348 -#define SETEQ 349 -#define SETNE 350 -#define ICMP 351 -#define FCMP 352 -#define EQ 353 -#define NE 354 -#define SLT 355 -#define SGT 356 -#define SLE 357 -#define SGE 358 -#define ULT 359 -#define UGT 360 -#define ULE 361 -#define UGE 362 -#define OEQ 363 -#define ONE 364 -#define OLT 365 -#define OGT 366 -#define OLE 367 -#define OGE 368 -#define ORD 369 -#define UNO 370 -#define UEQ 371 -#define UNE 372 -#define MALLOC 373 -#define ALLOCA 374 -#define FREE 375 -#define LOAD 376 -#define STORE 377 -#define GETELEMENTPTR 378 -#define TRUNC 379 -#define ZEXT 380 -#define SEXT 381 -#define FPTRUNC 382 -#define FPEXT 383 -#define BITCAST 384 -#define UITOFP 385 -#define SITOFP 386 -#define FPTOUI 387 -#define FPTOSI 388 -#define INTTOPTR 389 -#define PTRTOINT 390 -#define PHI_TOK 391 -#define SELECT 392 -#define SHL 393 -#define LSHR 394 -#define ASHR 395 -#define VAARG 396 -#define EXTRACTELEMENT 397 -#define INSERTELEMENT 398 -#define SHUFFLEVECTOR 399 +#define ICMP 345 +#define FCMP 346 +#define EQ 347 +#define NE 348 +#define SLT 349 +#define SGT 350 +#define SLE 351 +#define SGE 352 +#define ULT 353 +#define UGT 354 +#define ULE 355 +#define UGE 356 +#define OEQ 357 +#define ONE 358 +#define OLT 359 +#define OGT 360 +#define OLE 361 +#define OGE 362 +#define ORD 363 +#define UNO 364 +#define UEQ 365 +#define UNE 366 +#define MALLOC 367 +#define ALLOCA 368 +#define FREE 369 +#define LOAD 370 +#define STORE 371 +#define GETELEMENTPTR 372 +#define TRUNC 373 +#define ZEXT 374 +#define SEXT 375 +#define FPTRUNC 376 +#define FPEXT 377 +#define BITCAST 378 +#define UITOFP 379 +#define SITOFP 380 +#define FPTOUI 381 +#define FPTOSI 382 +#define INTTOPTR 383 +#define PTRTOINT 384 +#define PHI_TOK 385 +#define SELECT 386 +#define SHL 387 +#define LSHR 388 +#define ASHR 389 +#define VAARG 390 +#define EXTRACTELEMENT 391 +#define INSERTELEMENT 392 +#define SHUFFLEVECTOR 393 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 855 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y" +#line 855 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -363,8 +352,8 @@ llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; } YYSTYPE; -/* Line 1275 of yacc.c. */ -#line 368 "llvmAsmParser.tab.h" +/* Line 1447 of yacc.c. */ +#line 357 "llvmAsmParser.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.290 llvm/lib/AsmParser/llvmAsmParser.y:1.291 --- llvm/lib/AsmParser/llvmAsmParser.y:1.290 Wed Dec 20 11:20:09 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Sat Dec 23 00:05:40 2006 @@ -958,9 +958,8 @@ %token RET BR SWITCH INVOKE UNWIND UNREACHABLE // Binary Operators -%type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories +%type ArithmeticOps LogicalOps // Binops Subcatagories %token ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR -%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators %token ICMP FCMP %type IPredicates %type FPredicates @@ -999,7 +998,6 @@ // ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM; LogicalOps : AND | OR | XOR; -SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; CastOps : TRUNC | ZEXT | SEXT | FPTRUNC | FPEXT | BITCAST | UITOFP | SITOFP | FPTOUI | FPTOSI | INTTOPTR | PTRTOINT; ShiftOps : SHL | LSHR | ASHR; @@ -1574,12 +1572,6 @@ $$ = ConstantExpr::get($1, $3, $5); CHECK_FOR_ERROR } - | SetCondOps '(' ConstVal ',' ConstVal ')' { - if ($3->getType() != $5->getType()) - GEN_ERROR("setcc operand types must match!"); - $$ = ConstantExpr::get($1, $3, $5); - CHECK_FOR_ERROR - } | ICMP IPredicates '(' ConstVal ',' ConstVal ')' { if ($4->getType() != $6->getType()) GEN_ERROR("icmp operand types must match!"); @@ -2369,20 +2361,6 @@ GEN_ERROR("binary operator returned null!"); delete $2; } - | SetCondOps Types ValueRef ',' ValueRef { - if(isa((*$2).get())) { - GEN_ERROR( - "PackedTypes currently not supported in setcc instructions!"); - } - Value* tmpVal1 = getVal(*$2, $3); - CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*$2, $5); - CHECK_FOR_ERROR - $$ = new SetCondInst($1, tmpVal1, tmpVal2); - if ($$ == 0) - GEN_ERROR("binary operator returned null!"); - delete $2; - } | ICMP IPredicates Types ValueRef ',' ValueRef { if (isa((*$3).get())) GEN_ERROR("Packed types not supported by icmp instruction"); Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.38 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.39 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.38 Fri Dec 8 12:07:09 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Sat Dec 23 00:05:40 2006 @@ -926,7 +926,6 @@ // EUINT64VAL - A positive number within uns. long long range %token EUINT64VAL -%type EINT64VAL %token SINTVAL // Signed 32 bit ints... %token UINTVAL // Unsigned 32 bit ints... @@ -959,9 +958,8 @@ %token RET BR SWITCH INVOKE UNWIND UNREACHABLE // Binary Operators -%type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories +%type ArithmeticOps LogicalOps // Binops Subcatagories %token ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR -%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators %token ICMP FCMP %type IPredicates %type FPredicates @@ -995,21 +993,11 @@ CHECK_FOR_ERROR }; - -EINT64VAL : ESINT64VAL; // These have same type and can't cause problems... -EINT64VAL : EUINT64VAL { - if ($1 > (uint64_t)INT64_MAX) // Outside of my range! - GEN_ERROR("Value too large for type!"); - $$ = (int64_t)$1; - CHECK_FOR_ERROR -}; - // Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM; LogicalOps : AND | OR | XOR; -SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; CastOps : TRUNC | ZEXT | SEXT | FPTRUNC | FPEXT | BITCAST | UITOFP | SITOFP | FPTOUI | FPTOSI | INTTOPTR | PTRTOINT; ShiftOps : SHL | LSHR | ASHR; @@ -1486,7 +1474,13 @@ delete $1; CHECK_FOR_ERROR } - | SIntType EINT64VAL { // integral constants + | SIntType ESINT64VAL { // integral constants + if (!ConstantInt::isValueValidForType($1, $2)) + GEN_ERROR("Constant value doesn't fit in type!"); + $$ = ConstantInt::get($1, $2); + CHECK_FOR_ERROR + } + | SIntType EUINT64VAL { // integral constants if (!ConstantInt::isValueValidForType($1, $2)) GEN_ERROR("Constant value doesn't fit in type!"); $$ = ConstantInt::get($1, $2); @@ -1498,6 +1492,12 @@ $$ = ConstantInt::get($1, $2); CHECK_FOR_ERROR } + | UIntType ESINT64VAL { + if (!ConstantInt::isValueValidForType($1, $2)) + GEN_ERROR("Constant value doesn't fit in type!"); + $$ = ConstantInt::get($1, $2); + CHECK_FOR_ERROR + } | BOOL TRUETOK { // Boolean constants $$ = ConstantBool::getTrue(); CHECK_FOR_ERROR @@ -1572,12 +1572,6 @@ $$ = ConstantExpr::get($1, $3, $5); CHECK_FOR_ERROR } - | SetCondOps '(' ConstVal ',' ConstVal ')' { - if ($3->getType() != $5->getType()) - GEN_ERROR("setcc operand types must match!"); - $$ = ConstantExpr::get($1, $3, $5); - CHECK_FOR_ERROR - } | ICMP IPredicates '(' ConstVal ',' ConstVal ')' { if ($4->getType() != $6->getType()) GEN_ERROR("icmp operand types must match!"); @@ -2367,20 +2361,6 @@ GEN_ERROR("binary operator returned null!"); delete $2; } - | SetCondOps Types ValueRef ',' ValueRef { - if(isa((*$2).get())) { - GEN_ERROR( - "PackedTypes currently not supported in setcc instructions!"); - } - Value* tmpVal1 = getVal(*$2, $3); - CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*$2, $5); - CHECK_FOR_ERROR - $$ = new SetCondInst($1, tmpVal1, tmpVal2); - if ($$ == 0) - GEN_ERROR("binary operator returned null!"); - delete $2; - } | ICMP IPredicates Types ValueRef ',' ValueRef { if (isa((*$3).get())) GEN_ERROR("Packed types not supported by icmp instruction"); From reid at x10sys.com Sat Dec 23 00:06:54 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp ConstantFolding.h Constants.cpp Instruction.cpp Instructions.cpp SymbolTable.cpp Verifier.cpp Message-ID: <200612230606.kBN66sWi021988@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.118 -> 1.119 ConstantFolding.h updated: 1.50 -> 1.51 Constants.cpp updated: 1.190 -> 1.191 Instruction.cpp updated: 1.60 -> 1.61 Instructions.cpp updated: 1.56 -> 1.57 SymbolTable.cpp updated: 1.63 -> 1.64 Verifier.cpp updated: 1.178 -> 1.179 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+699 -944) ConstantFolding.cpp | 1377 +++++++++++++++++++++------------------------------- ConstantFolding.h | 4 Constants.cpp | 65 -- Instruction.cpp | 54 +- Instructions.cpp | 137 ++--- SymbolTable.cpp | 2 Verifier.cpp | 4 7 files changed, 699 insertions(+), 944 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.118 llvm/lib/VMCore/ConstantFolding.cpp:1.119 --- llvm/lib/VMCore/ConstantFolding.cpp:1.118 Tue Dec 19 01:41:40 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Sat Dec 23 00:05:41 2006 @@ -30,517 +30,6 @@ #include using namespace llvm; -namespace { - struct VISIBILITY_HIDDEN ConstRules { - ConstRules() {} - virtual ~ConstRules() {} - - // Binary Operators... - virtual Constant *add(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *sub(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *mul(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *urem(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *srem(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *frem(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *udiv(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *sdiv(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *fdiv(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *op_and(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *op_or (const Constant *V1, const Constant *V2) const = 0; - virtual Constant *op_xor(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *shl(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *lshr(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *ashr(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *lessthan(const Constant *V1, const Constant *V2) const =0; - virtual Constant *equalto(const Constant *V1, const Constant *V2) const = 0; - - // ConstRules::get - Return an instance of ConstRules for the specified - // constant operands. - // - static ConstRules &get(const Constant *V1, const Constant *V2); - private: - ConstRules(const ConstRules &); // Do not implement - ConstRules &operator=(const ConstRules &); // Do not implement - }; -} - - -//===----------------------------------------------------------------------===// -// TemplateRules Class -//===----------------------------------------------------------------------===// -// -// TemplateRules - Implement a subclass of ConstRules that provides all -// operations as noops. All other rules classes inherit from this class so -// that if functionality is needed in the future, it can simply be added here -// and to ConstRules without changing anything else... -// -// This class also provides subclasses with typesafe implementations of methods -// so that don't have to do type casting. -// -namespace { -template -class VISIBILITY_HIDDEN TemplateRules : public ConstRules { - - - //===--------------------------------------------------------------------===// - // Redirecting functions that cast to the appropriate types - //===--------------------------------------------------------------------===// - - virtual Constant *add(const Constant *V1, const Constant *V2) const { - return SubClassName::Add((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *sub(const Constant *V1, const Constant *V2) const { - return SubClassName::Sub((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *mul(const Constant *V1, const Constant *V2) const { - return SubClassName::Mul((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *udiv(const Constant *V1, const Constant *V2) const { - return SubClassName::UDiv((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *sdiv(const Constant *V1, const Constant *V2) const { - return SubClassName::SDiv((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *fdiv(const Constant *V1, const Constant *V2) const { - return SubClassName::FDiv((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *urem(const Constant *V1, const Constant *V2) const { - return SubClassName::URem((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *srem(const Constant *V1, const Constant *V2) const { - return SubClassName::SRem((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *frem(const Constant *V1, const Constant *V2) const { - return SubClassName::FRem((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *op_and(const Constant *V1, const Constant *V2) const { - return SubClassName::And((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *op_or(const Constant *V1, const Constant *V2) const { - return SubClassName::Or((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *op_xor(const Constant *V1, const Constant *V2) const { - return SubClassName::Xor((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *shl(const Constant *V1, const Constant *V2) const { - return SubClassName::Shl((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *lshr(const Constant *V1, const Constant *V2) const { - return SubClassName::LShr((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *ashr(const Constant *V1, const Constant *V2) const { - return SubClassName::AShr((const ArgType *)V1, (const ArgType *)V2); - } - - virtual Constant *lessthan(const Constant *V1, const Constant *V2) const { - return SubClassName::LessThan((const ArgType *)V1, (const ArgType *)V2); - } - virtual Constant *equalto(const Constant *V1, const Constant *V2) const { - return SubClassName::EqualTo((const ArgType *)V1, (const ArgType *)V2); - } - - - //===--------------------------------------------------------------------===// - // Default "noop" implementations - //===--------------------------------------------------------------------===// - - static Constant *Add (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Sub (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Mul (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *SDiv(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *UDiv(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *FDiv(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *URem(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *SRem(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *FRem(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *And (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Xor (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shl (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *LShr(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *AShr(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *LessThan(const ArgType *V1, const ArgType *V2) { - return 0; - } - static Constant *EqualTo(const ArgType *V1, const ArgType *V2) { - return 0; - } - -public: - virtual ~TemplateRules() {} -}; -} // end anonymous namespace - - -//===----------------------------------------------------------------------===// -// EmptyRules Class -//===----------------------------------------------------------------------===// -// -// EmptyRules provides a concrete base class of ConstRules that does nothing -// -namespace { -struct VISIBILITY_HIDDEN EmptyRules - : public TemplateRules { - static Constant *EqualTo(const Constant *V1, const Constant *V2) { - if (V1 == V2) return ConstantBool::getTrue(); - return 0; - } -}; -} // end anonymous namespace - - - -//===----------------------------------------------------------------------===// -// BoolRules Class -//===----------------------------------------------------------------------===// -// -// BoolRules provides a concrete base class of ConstRules for the 'bool' type. -// -namespace { -struct VISIBILITY_HIDDEN BoolRules - : public TemplateRules { - - static Constant *LessThan(const ConstantBool *V1, const ConstantBool *V2) { - return ConstantBool::get(V1->getValue() < V2->getValue()); - } - - static Constant *EqualTo(const Constant *V1, const Constant *V2) { - return ConstantBool::get(V1 == V2); - } - - static Constant *And(const ConstantBool *V1, const ConstantBool *V2) { - return ConstantBool::get(V1->getValue() & V2->getValue()); - } - - static Constant *Or(const ConstantBool *V1, const ConstantBool *V2) { - return ConstantBool::get(V1->getValue() | V2->getValue()); - } - - static Constant *Xor(const ConstantBool *V1, const ConstantBool *V2) { - return ConstantBool::get(V1->getValue() ^ V2->getValue()); - } -}; -} // end anonymous namespace - - -//===----------------------------------------------------------------------===// -// NullPointerRules Class -//===----------------------------------------------------------------------===// -// -// NullPointerRules provides a concrete base class of ConstRules for null -// pointers. -// -namespace { -struct VISIBILITY_HIDDEN NullPointerRules - : public TemplateRules { - static Constant *EqualTo(const Constant *V1, const Constant *V2) { - return ConstantBool::getTrue(); // Null pointers are always equal - } -}; -} // end anonymous namespace - -//===----------------------------------------------------------------------===// -// ConstantPackedRules Class -//===----------------------------------------------------------------------===// - -/// DoVectorOp - Given two packed constants and a function pointer, apply the -/// function pointer to each element pair, producing a new ConstantPacked -/// constant. -static Constant *EvalVectorOp(const ConstantPacked *V1, - const ConstantPacked *V2, - Constant *(*FP)(Constant*, Constant*)) { - std::vector Res; - for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i) - Res.push_back(FP(const_cast(V1->getOperand(i)), - const_cast(V2->getOperand(i)))); - return ConstantPacked::get(Res); -} - -/// PackedTypeRules provides a concrete base class of ConstRules for -/// ConstantPacked operands. -/// -namespace { -struct VISIBILITY_HIDDEN ConstantPackedRules - : public TemplateRules { - - static Constant *Add(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getAdd); - } - static Constant *Sub(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getSub); - } - static Constant *Mul(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getMul); - } - static Constant *UDiv(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getUDiv); - } - static Constant *SDiv(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getSDiv); - } - static Constant *FDiv(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getFDiv); - } - static Constant *URem(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getURem); - } - static Constant *SRem(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getSRem); - } - static Constant *FRem(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getFRem); - } - static Constant *And(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getAnd); - } - static Constant *Or (const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getOr); - } - static Constant *Xor(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getXor); - } - static Constant *LessThan(const ConstantPacked *V1, const ConstantPacked *V2){ - return 0; - } - static Constant *EqualTo(const ConstantPacked *V1, const ConstantPacked *V2) { - for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i) { - Constant *C = - ConstantExpr::getSetEQ(const_cast(V1->getOperand(i)), - const_cast(V2->getOperand(i))); - if (ConstantBool *CB = dyn_cast(C)) - return CB; - } - // Otherwise, could not decide from any element pairs. - return 0; - } -}; -} // end anonymous namespace - - -//===----------------------------------------------------------------------===// -// GeneralPackedRules Class -//===----------------------------------------------------------------------===// - -/// GeneralPackedRules provides a concrete base class of ConstRules for -/// PackedType operands, where both operands are not ConstantPacked. The usual -/// cause for this is that one operand is a ConstantAggregateZero. -/// -namespace { -struct VISIBILITY_HIDDEN GeneralPackedRules - : public TemplateRules { -}; -} // end anonymous namespace - - -//===----------------------------------------------------------------------===// -// DirectIntRules Class -//===----------------------------------------------------------------------===// -// -// DirectIntRules provides implementations of functions that are valid on -// integer types, but not all types in general. -// -namespace { -template -struct VISIBILITY_HIDDEN DirectIntRules - : public TemplateRules > { - - static Constant *Add(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = (BuiltinType)V1->getZExtValue() + - (BuiltinType)V2->getZExtValue(); - return ConstantInt::get(*Ty, R); - } - - static Constant *Sub(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = (BuiltinType)V1->getZExtValue() - - (BuiltinType)V2->getZExtValue(); - return ConstantInt::get(*Ty, R); - } - - static Constant *Mul(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = (BuiltinType)V1->getZExtValue() * - (BuiltinType)V2->getZExtValue(); - return ConstantInt::get(*Ty, R); - } - - static Constant *LessThan(const ConstantInt *V1, const ConstantInt *V2) { - bool R = (BuiltinType)V1->getZExtValue() < (BuiltinType)V2->getZExtValue(); - return ConstantBool::get(R); - } - - static Constant *EqualTo(const ConstantInt *V1, const ConstantInt *V2) { - bool R = (BuiltinType)V1->getZExtValue() == (BuiltinType)V2->getZExtValue(); - return ConstantBool::get(R); - } - - static Constant *UDiv(const ConstantInt *V1, const ConstantInt *V2) { - if (V2->isNullValue()) // X / 0 - return 0; - BuiltinType R = (BuiltinType)(V1->getZExtValue() / V2->getZExtValue()); - return ConstantInt::get(*Ty, R); - } - - static Constant *SDiv(const ConstantInt *V1, const ConstantInt *V2) { - if (V2->isNullValue()) // X / 0 - return 0; - if (V2->isAllOnesValue() && // MIN_INT / -1 - (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1->getSExtValue()) - return 0; - BuiltinType R = (BuiltinType)(V1->getSExtValue() / V2->getSExtValue()); - return ConstantInt::get(*Ty, R); - } - - static Constant *URem(const ConstantInt *V1, - const ConstantInt *V2) { - if (V2->isNullValue()) return 0; // X / 0 - BuiltinType R = (BuiltinType)(V1->getZExtValue() % V2->getZExtValue()); - return ConstantInt::get(*Ty, R); - } - - static Constant *SRem(const ConstantInt *V1, - const ConstantInt *V2) { - if (V2->isNullValue()) return 0; // X % 0 - if (V2->isAllOnesValue() && // MIN_INT % -1 - (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1->getSExtValue()) - return 0; - BuiltinType R = (BuiltinType)(V1->getSExtValue() % V2->getSExtValue()); - return ConstantInt::get(*Ty, R); - } - - static Constant *And(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = - (BuiltinType)V1->getZExtValue() & (BuiltinType)V2->getZExtValue(); - return ConstantInt::get(*Ty, R); - } - static Constant *Or(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = - (BuiltinType)V1->getZExtValue() | (BuiltinType)V2->getZExtValue(); - return ConstantInt::get(*Ty, R); - } - static Constant *Xor(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = - (BuiltinType)V1->getZExtValue() ^ (BuiltinType)V2->getZExtValue(); - return ConstantInt::get(*Ty, R); - } - - static Constant *Shl(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = - (BuiltinType)V1->getZExtValue() << (BuiltinType)V2->getZExtValue(); - return ConstantInt::get(*Ty, R); - } - - static Constant *LShr(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = BuiltinType(V1->getZExtValue() >> V2->getZExtValue()); - return ConstantInt::get(*Ty, R); - } - - static Constant *AShr(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = BuiltinType(V1->getSExtValue() >> V2->getZExtValue()); - return ConstantInt::get(*Ty, R); - } -}; -} // end anonymous namespace - - -//===----------------------------------------------------------------------===// -// DirectFPRules Class -//===----------------------------------------------------------------------===// -// -/// DirectFPRules provides implementations of functions that are valid on -/// floating point types, but not all types in general. -/// -namespace { -template -struct VISIBILITY_HIDDEN DirectFPRules - : public TemplateRules > { - - static Constant *Add(const ConstantFP *V1, const ConstantFP *V2) { - BuiltinType R = (BuiltinType)V1->getValue() + - (BuiltinType)V2->getValue(); - return ConstantFP::get(*Ty, R); - } - - static Constant *Sub(const ConstantFP *V1, const ConstantFP *V2) { - BuiltinType R = (BuiltinType)V1->getValue() - (BuiltinType)V2->getValue(); - return ConstantFP::get(*Ty, R); - } - - static Constant *Mul(const ConstantFP *V1, const ConstantFP *V2) { - BuiltinType R = (BuiltinType)V1->getValue() * (BuiltinType)V2->getValue(); - return ConstantFP::get(*Ty, R); - } - - static Constant *LessThan(const ConstantFP *V1, const ConstantFP *V2) { - bool R = (BuiltinType)V1->getValue() < (BuiltinType)V2->getValue(); - return ConstantBool::get(R); - } - - static Constant *EqualTo(const ConstantFP *V1, const ConstantFP *V2) { - bool R = (BuiltinType)V1->getValue() == (BuiltinType)V2->getValue(); - return ConstantBool::get(R); - } - - static Constant *FRem(const ConstantFP *V1, const ConstantFP *V2) { - if (V2->isNullValue()) return 0; - BuiltinType Result = std::fmod((BuiltinType)V1->getValue(), - (BuiltinType)V2->getValue()); - return ConstantFP::get(*Ty, Result); - } - static Constant *FDiv(const ConstantFP *V1, const ConstantFP *V2) { - BuiltinType inf = std::numeric_limits::infinity(); - if (V2->isExactlyValue(0.0)) return ConstantFP::get(*Ty, inf); - if (V2->isExactlyValue(-0.0)) return ConstantFP::get(*Ty, -inf); - BuiltinType R = (BuiltinType)V1->getValue() / (BuiltinType)V2->getValue(); - return ConstantFP::get(*Ty, R); - } -}; -} // end anonymous namespace - -static ManagedStatic EmptyR; -static ManagedStatic BoolR; -static ManagedStatic NullPointerR; -static ManagedStatic ConstantPackedR; -static ManagedStatic GeneralPackedR; -static ManagedStatic > SByteR; -static ManagedStatic > UByteR; -static ManagedStatic > ShortR; -static ManagedStatic > UShortR; -static ManagedStatic > IntR; -static ManagedStatic > UIntR; -static ManagedStatic > LongR; -static ManagedStatic > ULongR; -static ManagedStatic > FloatR; -static ManagedStatic > DoubleR; - -/// ConstRules::get - This method returns the constant rules implementation that -/// implements the semantics of the two specified constants. -ConstRules &ConstRules::get(const Constant *V1, const Constant *V2) { - if (isa(V1) || isa(V2) || - isa(V1) || isa(V2) || - isa(V1) || isa(V2)) - return *EmptyR; - - switch (V1->getType()->getTypeID()) { - default: assert(0 && "Unknown value type for constant folding!"); - case Type::BoolTyID: return *BoolR; - case Type::PointerTyID: return *NullPointerR; - case Type::SByteTyID: return *SByteR; - case Type::UByteTyID: return *UByteR; - case Type::ShortTyID: return *ShortR; - case Type::UShortTyID: return *UShortR; - case Type::IntTyID: return *IntR; - case Type::UIntTyID: return *UIntR; - case Type::LongTyID: return *LongR; - case Type::ULongTyID: return *ULongR; - case Type::FloatTyID: return *FloatR; - case Type::DoubleTyID: return *DoubleR; - case Type::PackedTyID: - if (isa(V1) && isa(V2)) - return *ConstantPackedR; - return *GeneralPackedR; // Constant folding rules for ConstantAggregateZero. - } -} - - //===----------------------------------------------------------------------===// // ConstantFold*Instruction Implementations //===----------------------------------------------------------------------===// @@ -919,6 +408,275 @@ return 0; } +/// EvalVectorOp - Given two packed constants and a function pointer, apply the +/// function pointer to each element pair, producing a new ConstantPacked +/// constant. +static Constant *EvalVectorOp(const ConstantPacked *V1, + const ConstantPacked *V2, + Constant *(*FP)(Constant*, Constant*)) { + std::vector Res; + for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i) + Res.push_back(FP(const_cast(V1->getOperand(i)), + const_cast(V2->getOperand(i)))); + return ConstantPacked::get(Res); +} + +Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, + const Constant *C1, + const Constant *C2) { + // Handle UndefValue up front + if (isa(C1) || isa(C2)) { + switch (Opcode) { + case Instruction::Add: + case Instruction::Sub: + case Instruction::Xor: + return UndefValue::get(C1->getType()); + case Instruction::Mul: + case Instruction::And: + return Constant::getNullValue(C1->getType()); + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: + case Instruction::URem: + case Instruction::SRem: + case Instruction::FRem: + if (!isa(C2)) // undef / X -> 0 + return Constant::getNullValue(C1->getType()); + return const_cast(C2); // X / undef -> undef + case Instruction::Or: // X | undef -> -1 + return ConstantInt::getAllOnesValue(C1->getType()); + case Instruction::LShr: + if (isa(C2) && isa(C1)) + return const_cast(C1); // undef lshr undef -> undef + return Constant::getNullValue(C1->getType()); // X lshr undef -> 0 + // undef lshr X -> 0 + case Instruction::AShr: + if (!isa(C2)) + return const_cast(C1); // undef ashr X --> undef + else if (isa(C1)) + return const_cast(C1); // undef ashr undef -> undef + else + return const_cast(C1); // X ashr undef --> X + case Instruction::Shl: + // undef << X -> 0 or X << undef -> 0 + return Constant::getNullValue(C1->getType()); + } + } + + if (const ConstantExpr *CE1 = dyn_cast(C1)) { + if (isa(C2)) { + // There are many possible foldings we could do here. We should probably + // at least fold add of a pointer with an integer into the appropriate + // getelementptr. This will improve alias analysis a bit. + } else { + // Just implement a couple of simple identities. + switch (Opcode) { + case Instruction::Add: + if (C2->isNullValue()) return const_cast(C1); // X + 0 == X + break; + case Instruction::Sub: + if (C2->isNullValue()) return const_cast(C1); // X - 0 == X + break; + case Instruction::Mul: + if (C2->isNullValue()) return const_cast(C2); // X * 0 == 0 + if (const ConstantInt *CI = dyn_cast(C2)) + if (CI->getZExtValue() == 1) + return const_cast(C1); // X * 1 == X + break; + case Instruction::UDiv: + case Instruction::SDiv: + if (const ConstantInt *CI = dyn_cast(C2)) + if (CI->getZExtValue() == 1) + return const_cast(C1); // X / 1 == X + break; + case Instruction::URem: + case Instruction::SRem: + if (const ConstantInt *CI = dyn_cast(C2)) + if (CI->getZExtValue() == 1) + return Constant::getNullValue(CI->getType()); // X % 1 == 0 + break; + case Instruction::And: + if (cast(C2)->isAllOnesValue()) + return const_cast(C1); // X & -1 == X + if (C2->isNullValue()) return const_cast(C2); // X & 0 == 0 + if (CE1->isCast() && isa(CE1->getOperand(0))) { + GlobalValue *CPR = cast(CE1->getOperand(0)); + + // Functions are at least 4-byte aligned. If and'ing the address of a + // function with a constant < 4, fold it to zero. + if (const ConstantInt *CI = dyn_cast(C2)) + if (CI->getZExtValue() < 4 && isa(CPR)) + return Constant::getNullValue(CI->getType()); + } + break; + case Instruction::Or: + if (C2->isNullValue()) return const_cast(C1); // X | 0 == X + if (cast(C2)->isAllOnesValue()) + return const_cast(C2); // X | -1 == -1 + break; + case Instruction::Xor: + if (C2->isNullValue()) return const_cast(C1); // X ^ 0 == X + break; + } + } + } else if (isa(C2)) { + // If C2 is a constant expr and C1 isn't, flop them around and fold the + // other way if possible. + switch (Opcode) { + case Instruction::Add: + case Instruction::Mul: + case Instruction::And: + case Instruction::Or: + case Instruction::Xor: + // No change of opcode required. + return ConstantFoldBinaryInstruction(Opcode, C2, C1); + + case Instruction::Shl: + case Instruction::LShr: + case Instruction::AShr: + case Instruction::Sub: + case Instruction::SDiv: + case Instruction::UDiv: + case Instruction::FDiv: + case Instruction::URem: + case Instruction::SRem: + case Instruction::FRem: + default: // These instructions cannot be flopped around. + return 0; + } + } + + // At this point we know neither constant is an UndefValue nor a ConstantExpr + // so look at directly computing the + if (const ConstantBool *CB1 = dyn_cast(C1)) { + if (const ConstantBool *CB2 = dyn_cast(C2)) { + switch (Opcode) { + default: + break; + case Instruction::And: + return ConstantBool::get(CB1->getValue() & CB2->getValue()); + case Instruction::Or: + return ConstantBool::get(CB1->getValue() | CB2->getValue()); + case Instruction::Xor: + return ConstantBool::get(CB1->getValue() ^ CB2->getValue()); + } + } + } else if (const ConstantInt *CI1 = dyn_cast(C1)) { + if (const ConstantInt *CI2 = dyn_cast(C2)) { + uint64_t C1Val = CI1->getZExtValue(); + uint64_t C2Val = CI2->getZExtValue(); + switch (Opcode) { + default: + break; + case Instruction::Add: + return ConstantInt::get(C1->getType(), C1Val + C2Val); + case Instruction::Sub: + return ConstantInt::get(C1->getType(), C1Val - C2Val); + case Instruction::Mul: + return ConstantInt::get(C1->getType(), C1Val * C2Val); + case Instruction::UDiv: + if (CI2->isNullValue()) // X / 0 -> can't fold + return 0; + return ConstantInt::get(C1->getType(), C1Val / C2Val); + case Instruction::SDiv: + if (CI2->isNullValue()) return 0; // X / 0 -> can't fold + if (CI2->isAllOnesValue() && + (((CI1->getType()->getPrimitiveSizeInBits() == 64) && + (CI1->getSExtValue() == INT64_MIN)) || + (CI1->getSExtValue() == -CI1->getSExtValue()))) + return 0; // MIN_INT / -1 -> overflow + return ConstantInt::get(C1->getType(), + CI1->getSExtValue() / CI2->getSExtValue()); + case Instruction::URem: + if (C2->isNullValue()) return 0; // X / 0 -> can't fold + return ConstantInt::get(C1->getType(), C1Val % C2Val); + case Instruction::SRem: + if (CI2->isNullValue()) return 0; // X % 0 -> can't fold + if (CI2->isAllOnesValue() && + (((CI1->getType()->getPrimitiveSizeInBits() == 64) && + (CI1->getSExtValue() == INT64_MIN)) || + (CI1->getSExtValue() == -CI1->getSExtValue()))) + return 0; // MIN_INT % -1 -> overflow + return ConstantInt::get(C1->getType(), + CI1->getSExtValue() % CI2->getSExtValue()); + case Instruction::And: + return ConstantInt::get(C1->getType(), C1Val & C2Val); + case Instruction::Or: + return ConstantInt::get(C1->getType(), C1Val | C2Val); + case Instruction::Xor: + return ConstantInt::get(C1->getType(), C1Val ^ C2Val); + case Instruction::Shl: + return ConstantInt::get(C1->getType(), C1Val << C2Val); + case Instruction::LShr: + return ConstantInt::get(C1->getType(), C1Val >> C2Val); + case Instruction::AShr: + return ConstantInt::get(C1->getType(), + CI1->getSExtValue() >> C2Val); + } + } + } else if (const ConstantFP *CFP1 = dyn_cast(C1)) { + if (const ConstantFP *CFP2 = dyn_cast(C2)) { + double C1Val = CFP1->getValue(); + double C2Val = CFP2->getValue(); + switch (Opcode) { + default: + break; + case Instruction::Add: + return ConstantFP::get(CFP1->getType(), C1Val + C2Val); + case Instruction::Sub: + return ConstantFP::get(CFP1->getType(), C1Val - C2Val); + case Instruction::Mul: + return ConstantFP::get(CFP1->getType(), C1Val * C2Val); + case Instruction::FDiv: + if (CFP2->isExactlyValue(0.0)) + return ConstantFP::get(CFP1->getType(), + std::numeric_limits::infinity()); + if (CFP2->isExactlyValue(-0.0)) + return ConstantFP::get(CFP1->getType(), + -std::numeric_limits::infinity()); + return ConstantFP::get(CFP1->getType(), C1Val / C2Val); + case Instruction::FRem: + if (CFP2->isNullValue()) + return 0; + return ConstantFP::get(CFP1->getType(), std::fmod(C1Val, C2Val)); + } + } + } else if (const ConstantPacked *CP1 = dyn_cast(C1)) { + if (const ConstantPacked *CP2 = dyn_cast(C2)) { + switch (Opcode) { + default: + break; + case Instruction::Add: + return EvalVectorOp(CP1, CP2, ConstantExpr::getAdd); + case Instruction::Sub: + return EvalVectorOp(CP1, CP2, ConstantExpr::getSub); + case Instruction::Mul: + return EvalVectorOp(CP1, CP2, ConstantExpr::getMul); + case Instruction::UDiv: + return EvalVectorOp(CP1, CP2, ConstantExpr::getUDiv); + case Instruction::SDiv: + return EvalVectorOp(CP1, CP2, ConstantExpr::getSDiv); + case Instruction::FDiv: + return EvalVectorOp(CP1, CP2, ConstantExpr::getFDiv); + case Instruction::URem: + return EvalVectorOp(CP1, CP2, ConstantExpr::getURem); + case Instruction::SRem: + return EvalVectorOp(CP1, CP2, ConstantExpr::getSRem); + case Instruction::FRem: + return EvalVectorOp(CP1, CP2, ConstantExpr::getFRem); + case Instruction::And: + return EvalVectorOp(CP1, CP2, ConstantExpr::getAnd); + case Instruction::Or: + return EvalVectorOp(CP1, CP2, ConstantExpr::getOr); + case Instruction::Xor: + return EvalVectorOp(CP1, CP2, ConstantExpr::getXor); + } + } + } + + // We don't know how to fold this + return 0; +} /// isZeroSizedType - This type is zero sized if its an array or structure of /// zero sized types. The only leaf zero sized type is an empty structure. @@ -979,62 +737,126 @@ return 1; } -/// evaluateRelation - This function determines if there is anything we can +/// evaluatFCmpeRelation - This function determines if there is anything we can +/// decide about the two constants provided. This doesn't need to handle simple +/// things like ConstantFP comparisons, but should instead handle ConstantExprs. +/// If we can determine that the two constants have a particular relation to +/// each other, we should return the corresponding FCmpInst predicate, +/// otherwise return FCmpInst::BAD_FCMP_PREDICATE. +/// +/// To simplify this code we canonicalize the relation so that the first +/// operand is always the most "complex" of the two. We consider simple +/// constants (like ConstantFP) to be the simplest, followed by +/// GlobalValues, followed by ConstantExpr's (the most complex). +static FCmpInst::Predicate evaluateFCmpRelation(Constant *V1, Constant *V2) { + assert(V1->getType() == V2->getType() && + "Cannot compare different types of values!"); + if (V1 == V2) return FCmpInst::FCMP_OEQ; + + if (!isa(V1) && !isa(V1)) { + if (!isa(V2) && !isa(V2)) { + // We distilled this down to a simple case, use the standard constant + // folder. + ConstantBool *R = dyn_cast( + ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, V1, V2)); + if (R && R->getValue()) + return FCmpInst::FCMP_OEQ; + R = dyn_cast( + ConstantExpr::getFCmp(FCmpInst::FCMP_OLT, V1, V2)); + if (R && R->getValue()) + return FCmpInst::FCMP_OLT; + R = dyn_cast( + ConstantExpr::getFCmp(FCmpInst::FCMP_OGT, V1, V2)); + if (R && R->getValue()) return FCmpInst::FCMP_OGT; + + // If we couldn't figure it out, bail. + return FCmpInst::BAD_FCMP_PREDICATE; + } + + // If the first operand is simple, swap operands. + FCmpInst::Predicate SwappedPredicate = evaluateFCmpRelation(V2, V1); + if (SwappedPredicate != FCmpInst::BAD_FCMP_PREDICATE) + return FCmpInst::getSwappedPredicate(SwappedPredicate); + + return FCmpInst::BAD_FCMP_PREDICATE; + } + + // Ok, the LHS is known to be a constantexpr. The RHS can be any of a + // constantexpr, a CPR, or a simple constant. + // ConstantExpr *CE1 = cast(V1); + // Constant *CE1Op0 = CE1->getOperand(0); + + // There are MANY other foldings that we could perform here. They will + // probably be added on demand, as they seem needed. + return FCmpInst::BAD_FCMP_PREDICATE; +} + +/// evaluateICmpRelation - This function determines if there is anything we can /// decide about the two constants provided. This doesn't need to handle simple /// things like integer comparisons, but should instead handle ConstantExprs /// and GlobalValues. If we can determine that the two constants have a -/// particular relation to each other, we should return the corresponding SetCC -/// code, otherwise return Instruction::BinaryOpsEnd. +/// particular relation to each other, we should return the corresponding ICmp +/// predicate, otherwise return ICmpInst::BAD_ICMP_PREDICATE. /// /// To simplify this code we canonicalize the relation so that the first /// operand is always the most "complex" of the two. We consider simple /// constants (like ConstantInt) to be the simplest, followed by /// GlobalValues, followed by ConstantExpr's (the most complex). /// -static Instruction::BinaryOps evaluateRelation(Constant *V1, Constant *V2) { +static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2, + bool isSigned) { assert(V1->getType() == V2->getType() && "Cannot compare different types of values!"); - if (V1 == V2) return Instruction::SetEQ; + if (V1 == V2) return ICmpInst::ICMP_EQ; if (!isa(V1) && !isa(V1)) { if (!isa(V2) && !isa(V2)) { // We distilled this down to a simple case, use the standard constant // folder. - ConstantBool *R = dyn_cast(ConstantExpr::getSetEQ(V1, V2)); - if (R && R->getValue()) return Instruction::SetEQ; - R = dyn_cast(ConstantExpr::getSetLT(V1, V2)); - if (R && R->getValue()) return Instruction::SetLT; - R = dyn_cast(ConstantExpr::getSetGT(V1, V2)); - if (R && R->getValue()) return Instruction::SetGT; + ICmpInst::Predicate pred = ICmpInst::ICMP_EQ; + ConstantBool *R = + dyn_cast(ConstantExpr::getICmp(pred, V1, V2)); + if (R && R->getValue()) + return pred; + pred = isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; + R = dyn_cast(ConstantExpr::getICmp(pred, V1, V2)); + if (R && R->getValue()) + return pred; + pred = isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; + R = dyn_cast(ConstantExpr::getICmp(pred, V1, V2)); + if (R && R->getValue()) + return pred; // If we couldn't figure it out, bail. - return Instruction::BinaryOpsEnd; + return ICmpInst::BAD_ICMP_PREDICATE; } // If the first operand is simple, swap operands. - Instruction::BinaryOps SwappedRelation = evaluateRelation(V2, V1); - if (SwappedRelation != Instruction::BinaryOpsEnd) - return SetCondInst::getSwappedCondition(SwappedRelation); + ICmpInst::Predicate SwappedRelation = + evaluateICmpRelation(V2, V1, isSigned); + if (SwappedRelation != ICmpInst::BAD_ICMP_PREDICATE) + return ICmpInst::getSwappedPredicate(SwappedRelation); } else if (const GlobalValue *CPR1 = dyn_cast(V1)) { if (isa(V2)) { // Swap as necessary. - Instruction::BinaryOps SwappedRelation = evaluateRelation(V2, V1); - if (SwappedRelation != Instruction::BinaryOpsEnd) - return SetCondInst::getSwappedCondition(SwappedRelation); + ICmpInst::Predicate SwappedRelation = + evaluateICmpRelation(V2, V1, isSigned); + if (SwappedRelation != ICmpInst::BAD_ICMP_PREDICATE) + return ICmpInst::getSwappedPredicate(SwappedRelation); else - return Instruction::BinaryOpsEnd; + return ICmpInst::BAD_ICMP_PREDICATE; } // Now we know that the RHS is a GlobalValue or simple constant, // which (since the types must match) means that it's a ConstantPointerNull. if (const GlobalValue *CPR2 = dyn_cast(V2)) { if (!CPR1->hasExternalWeakLinkage() || !CPR2->hasExternalWeakLinkage()) - return Instruction::SetNE; + return ICmpInst::ICMP_NE; } else { // GlobalVals can never be null. assert(isa(V2) && "Canonicalization guarantee!"); if (!CPR1->hasExternalWeakLinkage()) - return Instruction::SetNE; + return ICmpInst::ICMP_NE; } } else { // Ok, the LHS is known to be a constantexpr. The RHS can be any of a @@ -1048,30 +870,39 @@ case Instruction::FPExt: case Instruction::FPToUI: case Instruction::FPToSI: - break; // We don't do anything with floating point. - case Instruction::ZExt: - case Instruction::SExt: + break; // We can't evaluate floating point casts or truncations. + case Instruction::UIToFP: case Instruction::SIToFP: - case Instruction::PtrToInt: case Instruction::IntToPtr: case Instruction::BitCast: + case Instruction::ZExt: + case Instruction::SExt: + case Instruction::PtrToInt: // If the cast is not actually changing bits, and the second operand is a // null pointer, do the comparison with the pre-casted value. if (V2->isNullValue() && - (isa(CE1->getType()) || CE1->getType()->isIntegral())) - return evaluateRelation(CE1Op0, - Constant::getNullValue(CE1Op0->getType())); + (isa(CE1->getType()) || CE1->getType()->isIntegral())) { + bool isSigned = CE1->getOpcode() == Instruction::ZExt ? false : + (CE1->getOpcode() == Instruction::SExt ? true : + (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned)); + return evaluateICmpRelation( + CE1Op0, Constant::getNullValue(CE1Op0->getType()), isSigned); + } // If the dest type is a pointer type, and the RHS is a constantexpr cast // from the same type as the src of the LHS, evaluate the inputs. This is - // important for things like "seteq (cast 4 to int*), (cast 5 to int*)", + // important for things like "icmp eq (cast 4 to int*), (cast 5 to int*)", // which happens a lot in compilers with tagged integers. if (ConstantExpr *CE2 = dyn_cast(V2)) - if (isa(CE1->getType()) && CE2->isCast() && + if (CE2->isCast() && isa(CE1->getType()) && CE1->getOperand(0)->getType() == CE2->getOperand(0)->getType() && CE1->getOperand(0)->getType()->isIntegral()) { - return evaluateRelation(CE1->getOperand(0), CE2->getOperand(0)); + bool isSigned = CE1->getOpcode() == Instruction::ZExt ? false : + (CE1->getOpcode() == Instruction::SExt ? true : + (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned)); + return evaluateICmpRelation(CE1->getOperand(0), CE2->getOperand(0), + isSigned); } break; @@ -1085,20 +916,20 @@ if (GV->hasExternalWeakLinkage()) // Weak linkage GVals could be zero or not. We're comparing that // to null pointer so its greater-or-equal - return Instruction::SetGE; + return isSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE; else // If its not weak linkage, the GVal must have a non-zero address // so the result is greater-than - return Instruction::SetGT; + return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; } else if (isa(CE1Op0)) { // If we are indexing from a null pointer, check to see if we have any // non-zero indices. for (unsigned i = 1, e = CE1->getNumOperands(); i != e; ++i) if (!CE1->getOperand(i)->isNullValue()) // Offsetting from null, must not be equal. - return Instruction::SetGT; + return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; // Only zero indexes from null, must still be zero. - return Instruction::SetEQ; + return ICmpInst::ICMP_EQ; } // Otherwise, we can't really say if the first operand is null or not. } else if (const GlobalValue *CPR2 = dyn_cast(V2)) { @@ -1106,11 +937,11 @@ if (CPR2->hasExternalWeakLinkage()) // Weak linkage GVals could be zero or not. We're comparing it to // a null pointer, so its less-or-equal - return Instruction::SetLE; + return isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE; else // If its not weak linkage, the GVal must have a non-zero address // so the result is less-than - return Instruction::SetLT; + return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; } else if (const GlobalValue *CPR1 = dyn_cast(CE1Op0)) { if (CPR1 == CPR2) { // If this is a getelementptr of the same global, then it must be @@ -1120,11 +951,11 @@ assert(CE1->getNumOperands() == 2 && !CE1->getOperand(1)->isNullValue() && "Suprising getelementptr!"); - return Instruction::SetGT; + return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; } else { // If they are different globals, we don't know what the value is, // but they can't be equal. - return Instruction::SetNE; + return ICmpInst::ICMP_NE; } } } else { @@ -1140,7 +971,7 @@ // obviously to the same or different globals. if (isa(CE1Op0) && isa(CE2Op0)) { if (CE1Op0 != CE2Op0) // Don't know relative ordering, but not equal - return Instruction::SetNE; + return ICmpInst::ICMP_NE; // Ok, we know that both getelementptr instructions are based on the // same global. From this, we can precisely determine the relative // ordering of the resultant pointers. @@ -1152,9 +983,9 @@ ++i, ++GTI) switch (IdxCompare(CE1->getOperand(i), CE2->getOperand(i), GTI.getIndexedType())) { - case -1: return Instruction::SetLT; - case 1: return Instruction::SetGT; - case -2: return Instruction::BinaryOpsEnd; + case -1: return isSigned ? ICmpInst::ICMP_SLT:ICmpInst::ICMP_ULT; + case 1: return isSigned ? ICmpInst::ICMP_SGT:ICmpInst::ICMP_UGT; + case -2: return ICmpInst::BAD_ICMP_PREDICATE; } // Ok, we ran out of things they have in common. If any leftovers @@ -1162,283 +993,237 @@ for (; i < CE1->getNumOperands(); ++i) if (!CE1->getOperand(i)->isNullValue()) if (isa(CE1->getOperand(i))) - return Instruction::SetGT; + return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; else - return Instruction::BinaryOpsEnd; // Might be equal. + return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal. for (; i < CE2->getNumOperands(); ++i) if (!CE2->getOperand(i)->isNullValue()) if (isa(CE2->getOperand(i))) - return Instruction::SetLT; + return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; else - return Instruction::BinaryOpsEnd; // Might be equal. - return Instruction::SetEQ; + return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal. + return ICmpInst::ICMP_EQ; } } } - default: break; } } - return Instruction::BinaryOpsEnd; + return ICmpInst::BAD_ICMP_PREDICATE; } -Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, - const Constant *V1, - const Constant *V2) { - Constant *C = 0; - switch (Opcode) { - default: break; - case Instruction::Add: C = ConstRules::get(V1, V2).add(V1, V2); break; - case Instruction::Sub: C = ConstRules::get(V1, V2).sub(V1, V2); break; - case Instruction::Mul: C = ConstRules::get(V1, V2).mul(V1, V2); break; - case Instruction::UDiv: C = ConstRules::get(V1, V2).udiv(V1, V2); break; - case Instruction::SDiv: C = ConstRules::get(V1, V2).sdiv(V1, V2); break; - case Instruction::FDiv: C = ConstRules::get(V1, V2).fdiv(V1, V2); break; - case Instruction::URem: C = ConstRules::get(V1, V2).urem(V1, V2); break; - case Instruction::SRem: C = ConstRules::get(V1, V2).srem(V1, V2); break; - case Instruction::FRem: C = ConstRules::get(V1, V2).frem(V1, V2); break; - case Instruction::And: C = ConstRules::get(V1, V2).op_and(V1, V2); break; - case Instruction::Or: C = ConstRules::get(V1, V2).op_or (V1, V2); break; - case Instruction::Xor: C = ConstRules::get(V1, V2).op_xor(V1, V2); break; - case Instruction::Shl: C = ConstRules::get(V1, V2).shl(V1, V2); break; - case Instruction::LShr: C = ConstRules::get(V1, V2).lshr(V1, V2); break; - case Instruction::AShr: C = ConstRules::get(V1, V2).ashr(V1, V2); break; - case Instruction::SetEQ: - // SetEQ(null,GV) -> false - if (V1->isNullValue()) { - if (const GlobalValue *GV = dyn_cast(V2)) - if (!GV->hasExternalWeakLinkage()) - return ConstantBool::getFalse(); - // SetEQ(GV,null) -> false - } else if (V2->isNullValue()) { - if (const GlobalValue *GV = dyn_cast(V1)) - if (!GV->hasExternalWeakLinkage()) +Constant *llvm::ConstantFoldCompareInstruction(unsigned short predicate, + Constant *C1, Constant *C2) { + + // Handle some degenerate cases first + if (isa(C1) || isa(C2)) + return UndefValue::get(Type::BoolTy); + + // icmp eq/ne(null,GV) -> false/true + if (C1->isNullValue()) { + if (const GlobalValue *GV = dyn_cast(C2)) + if (!GV->hasExternalWeakLinkage()) // External weak GV can be null + if (predicate == ICmpInst::ICMP_EQ) return ConstantBool::getFalse(); - } - C = ConstRules::get(V1, V2).equalto(V1, V2); - break; - case Instruction::SetLT: C = ConstRules::get(V1, V2).lessthan(V1, V2);break; - case Instruction::SetGT: C = ConstRules::get(V1, V2).lessthan(V2, V1);break; - case Instruction::SetNE: - // SetNE(null,GV) -> true - if (V1->isNullValue()) { - if (const GlobalValue *GV = dyn_cast(V2)) - if (!GV->hasExternalWeakLinkage()) + else if (predicate == ICmpInst::ICMP_NE) return ConstantBool::getTrue(); - // SetNE(GV,null) -> true - } else if (V2->isNullValue()) { - if (const GlobalValue *GV = dyn_cast(V1)) - if (!GV->hasExternalWeakLinkage()) + // icmp eq/ne(GV,null) -> false/true + } else if (C2->isNullValue()) { + if (const GlobalValue *GV = dyn_cast(C1)) + if (!GV->hasExternalWeakLinkage()) // External weak GV can be null + if (predicate == ICmpInst::ICMP_EQ) + return ConstantBool::getFalse(); + else if (predicate == ICmpInst::ICMP_NE) return ConstantBool::getTrue(); - } - // V1 != V2 === !(V1 == V2) - C = ConstRules::get(V1, V2).equalto(V1, V2); - if (C) return ConstantExpr::getNot(C); - break; - case Instruction::SetLE: // V1 <= V2 === !(V2 < V1) - C = ConstRules::get(V1, V2).lessthan(V2, V1); - if (C) return ConstantExpr::getNot(C); - break; - case Instruction::SetGE: // V1 >= V2 === !(V1 < V2) - C = ConstRules::get(V1, V2).lessthan(V1, V2); - if (C) return ConstantExpr::getNot(C); - break; } - // If we successfully folded the expression, return it now. - if (C) return C; - - if (SetCondInst::isComparison(Opcode)) { - if (isa(V1) || isa(V2)) - return UndefValue::get(Type::BoolTy); - switch (evaluateRelation(const_cast(V1), - const_cast(V2))) { - default: assert(0 && "Unknown relational!"); - case Instruction::BinaryOpsEnd: - break; // Couldn't determine anything about these constants. - case Instruction::SetEQ: // We know the constants are equal! - // If we know the constants are equal, we can decide the result of this - // computation precisely. - return ConstantBool::get(Opcode == Instruction::SetEQ || - Opcode == Instruction::SetLE || - Opcode == Instruction::SetGE); - case Instruction::SetLT: - // If we know that V1 < V2, we can decide the result of this computation - // precisely. - return ConstantBool::get(Opcode == Instruction::SetLT || - Opcode == Instruction::SetNE || - Opcode == Instruction::SetLE); - case Instruction::SetGT: - // If we know that V1 > V2, we can decide the result of this computation - // precisely. - return ConstantBool::get(Opcode == Instruction::SetGT || - Opcode == Instruction::SetNE || - Opcode == Instruction::SetGE); - case Instruction::SetLE: - // If we know that V1 <= V2, we can only partially decide this relation. - if (Opcode == Instruction::SetGT) return ConstantBool::getFalse(); - if (Opcode == Instruction::SetLT) return ConstantBool::getTrue(); - break; - - case Instruction::SetGE: - // If we know that V1 >= V2, we can only partially decide this relation. - if (Opcode == Instruction::SetLT) return ConstantBool::getFalse(); - if (Opcode == Instruction::SetGT) return ConstantBool::getTrue(); - break; - - case Instruction::SetNE: - // If we know that V1 != V2, we can only partially decide this relation. - if (Opcode == Instruction::SetEQ) return ConstantBool::getFalse(); - if (Opcode == Instruction::SetNE) return ConstantBool::getTrue(); - break; + if (isa(C1) && isa(C2)) { + bool C1Val = cast(C1)->getValue(); + bool C2Val = cast(C2)->getValue(); + switch (predicate) { + default: assert(0 && "Invalid ICmp Predicate"); return 0; + case ICmpInst::ICMP_EQ: return ConstantBool::get(C1Val == C2Val); + case ICmpInst::ICMP_NE: return ConstantBool::get(C1Val != C2Val); + case ICmpInst::ICMP_ULT:return ConstantBool::get(C1Val < C2Val); + case ICmpInst::ICMP_UGT:return ConstantBool::get(C1Val > C2Val); + case ICmpInst::ICMP_ULE:return ConstantBool::get(C1Val <= C2Val); + case ICmpInst::ICMP_UGE:return ConstantBool::get(C1Val >= C2Val); + case ICmpInst::ICMP_SLT:return ConstantBool::get(C1Val < C2Val); + case ICmpInst::ICMP_SGT:return ConstantBool::get(C1Val > C2Val); + case ICmpInst::ICMP_SLE:return ConstantBool::get(C1Val <= C2Val); + case ICmpInst::ICMP_SGE:return ConstantBool::get(C1Val >= C2Val); + } + } else if (isa(C1) && isa(C2)) { + if (ICmpInst::isSignedPredicate(ICmpInst::Predicate(predicate))) { + int64_t V1 = cast(C1)->getSExtValue(); + int64_t V2 = cast(C2)->getSExtValue(); + switch (predicate) { + default: assert(0 && "Invalid ICmp Predicate"); return 0; + case ICmpInst::ICMP_SLT:return ConstantBool::get(V1 < V2); + case ICmpInst::ICMP_SGT:return ConstantBool::get(V1 > V2); + case ICmpInst::ICMP_SLE:return ConstantBool::get(V1 <= V2); + case ICmpInst::ICMP_SGE:return ConstantBool::get(V1 >= V2); + } + } else { + uint64_t V1 = cast(C1)->getZExtValue(); + uint64_t V2 = cast(C2)->getZExtValue(); + switch (predicate) { + default: assert(0 && "Invalid ICmp Predicate"); return 0; + case ICmpInst::ICMP_EQ: return ConstantBool::get(V1 == V2); + case ICmpInst::ICMP_NE: return ConstantBool::get(V1 != V2); + case ICmpInst::ICMP_ULT:return ConstantBool::get(V1 < V2); + case ICmpInst::ICMP_UGT:return ConstantBool::get(V1 > V2); + case ICmpInst::ICMP_ULE:return ConstantBool::get(V1 <= V2); + case ICmpInst::ICMP_UGE:return ConstantBool::get(V1 >= V2); + } } - } - - if (isa(V1) || isa(V2)) { - switch (Opcode) { - case Instruction::Add: - case Instruction::Sub: - case Instruction::Xor: - return UndefValue::get(V1->getType()); - - case Instruction::Mul: - case Instruction::And: - return Constant::getNullValue(V1->getType()); - case Instruction::UDiv: - case Instruction::SDiv: - case Instruction::FDiv: - case Instruction::URem: - case Instruction::SRem: - case Instruction::FRem: - if (!isa(V2)) // undef / X -> 0 - return Constant::getNullValue(V1->getType()); - return const_cast(V2); // X / undef -> undef - case Instruction::Or: // X | undef -> -1 - return ConstantInt::getAllOnesValue(V1->getType()); - case Instruction::LShr: - if (isa(V2) && isa(V1)) - return const_cast(V1); // undef lshr undef -> undef - return Constant::getNullValue(V1->getType()); // X lshr undef -> 0 - // undef lshr X -> 0 - case Instruction::AShr: - if (!isa(V2)) - return const_cast(V1); // undef ashr X --> undef - else if (isa(V1)) - return const_cast(V1); // undef ashr undef -> undef - else - return const_cast(V1); // X ashr undef --> X - case Instruction::Shl: - // undef << X -> 0 or X << undef -> 0 - return Constant::getNullValue(V1->getType()); + } else if (isa(C1) && isa(C2)) { + double C1Val = cast(C1)->getValue(); + double C2Val = cast(C2)->getValue(); + switch (predicate) { + default: assert(0 && "Invalid FCmp Predicate"); return 0; + case FCmpInst::FCMP_FALSE: return ConstantBool::getFalse(); + case FCmpInst::FCMP_TRUE: return ConstantBool::getTrue(); + case FCmpInst::FCMP_UNO: + case FCmpInst::FCMP_ORD: break; // Can't fold these + case FCmpInst::FCMP_UEQ: + case FCmpInst::FCMP_OEQ: return ConstantBool::get(C1Val == C2Val); + case FCmpInst::FCMP_ONE: + case FCmpInst::FCMP_UNE: return ConstantBool::get(C1Val != C2Val); + case FCmpInst::FCMP_OLT: + case FCmpInst::FCMP_ULT: return ConstantBool::get(C1Val < C2Val); + case FCmpInst::FCMP_UGT: + case FCmpInst::FCMP_OGT: return ConstantBool::get(C1Val > C2Val); + case FCmpInst::FCMP_OLE: + case FCmpInst::FCMP_ULE: return ConstantBool::get(C1Val <= C2Val); + case FCmpInst::FCMP_UGE: + case FCmpInst::FCMP_OGE: return ConstantBool::get(C1Val >= C2Val); + } + } else if (ConstantPacked *CP1 = dyn_cast(C1)) { + if (ConstantPacked *CP2 = dyn_cast(C2)) { + if (predicate == FCmpInst::FCMP_OEQ || predicate == FCmpInst::FCMP_UEQ) { + for (unsigned i = 0, e = CP1->getNumOperands(); i != e; ++i) { + Constant *C= ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, + const_cast(CP1->getOperand(i)), + const_cast(CP2->getOperand(i))); + if (ConstantBool *CB = dyn_cast(C)) + return CB; + } + // Otherwise, could not decide from any element pairs. + return 0; + } else if (predicate == ICmpInst::ICMP_EQ) { + for (unsigned i = 0, e = CP1->getNumOperands(); i != e; ++i) { + Constant *C = ConstantExpr::getICmp(ICmpInst::ICMP_EQ, + const_cast(CP1->getOperand(i)), + const_cast(CP2->getOperand(i))); + if (ConstantBool *CB = dyn_cast(C)) + return CB; + } + // Otherwise, could not decide from any element pairs. + return 0; + } } } - if (const ConstantExpr *CE1 = dyn_cast(V1)) { - if (isa(V2)) { - // There are many possible foldings we could do here. We should probably - // at least fold add of a pointer with an integer into the appropriate - // getelementptr. This will improve alias analysis a bit. - } else { - // Just implement a couple of simple identities. - switch (Opcode) { - case Instruction::Add: - if (V2->isNullValue()) return const_cast(V1); // X + 0 == X - break; - case Instruction::Sub: - if (V2->isNullValue()) return const_cast(V1); // X - 0 == X - break; - case Instruction::Mul: - if (V2->isNullValue()) return const_cast(V2); // X * 0 == 0 - if (const ConstantInt *CI = dyn_cast(V2)) - if (CI->getZExtValue() == 1) - return const_cast(V1); // X * 1 == X - break; - case Instruction::UDiv: - case Instruction::SDiv: - if (const ConstantInt *CI = dyn_cast(V2)) - if (CI->getZExtValue() == 1) - return const_cast(V1); // X / 1 == X - break; - case Instruction::URem: - case Instruction::SRem: - if (const ConstantInt *CI = dyn_cast(V2)) - if (CI->getZExtValue() == 1) - return Constant::getNullValue(CI->getType()); // X % 1 == 0 - break; - case Instruction::And: - if (cast(V2)->isAllOnesValue()) - return const_cast(V1); // X & -1 == X - if (V2->isNullValue()) return const_cast(V2); // X & 0 == 0 - if (CE1->isCast() && isa(CE1->getOperand(0))) { - GlobalValue *CPR = cast(CE1->getOperand(0)); + // Evaluate the relation between the two constants, per the predicate. + switch (evaluateICmpRelation(const_cast(C1), + const_cast(C2), + CmpInst::isSigned(predicate))) { + default: assert(0 && "Unknown relational!"); + case ICmpInst::BAD_ICMP_PREDICATE: + break; // Couldn't determine anything about these constants. + case ICmpInst::ICMP_EQ: // We know the constants are equal! + // If we know the constants are equal, we can decide the result of this + // computation precisely. + return ConstantBool::get(predicate == ICmpInst::ICMP_EQ || + predicate == ICmpInst::ICMP_ULE || + predicate == ICmpInst::ICMP_SLE || + predicate == ICmpInst::ICMP_UGE || + predicate == ICmpInst::ICMP_SGE); + case ICmpInst::ICMP_ULT: + // If we know that C1 < C2, we can decide the result of this computation + // precisely. + return ConstantBool::get(predicate == ICmpInst::ICMP_ULT || + predicate == ICmpInst::ICMP_NE || + predicate == ICmpInst::ICMP_ULE); + case ICmpInst::ICMP_SLT: + // If we know that C1 < C2, we can decide the result of this computation + // precisely. + return ConstantBool::get(predicate == ICmpInst::ICMP_SLT || + predicate == ICmpInst::ICMP_NE || + predicate == ICmpInst::ICMP_SLE); + case ICmpInst::ICMP_UGT: + // If we know that C1 > C2, we can decide the result of this computation + // precisely. + return ConstantBool::get(predicate == ICmpInst::ICMP_UGT || + predicate == ICmpInst::ICMP_NE || + predicate == ICmpInst::ICMP_UGE); + case ICmpInst::ICMP_SGT: + // If we know that C1 > C2, we can decide the result of this computation + // precisely. + return ConstantBool::get(predicate == ICmpInst::ICMP_SGT || + predicate == ICmpInst::ICMP_NE || + predicate == ICmpInst::ICMP_SGE); + case ICmpInst::ICMP_ULE: + // If we know that C1 <= C2, we can only partially decide this relation. + if (predicate == ICmpInst::ICMP_UGT) return ConstantBool::getFalse(); + if (predicate == ICmpInst::ICMP_ULT) return ConstantBool::getTrue(); + break; + case ICmpInst::ICMP_SLE: + // If we know that C1 <= C2, we can only partially decide this relation. + if (predicate == ICmpInst::ICMP_SGT) return ConstantBool::getFalse(); + if (predicate == ICmpInst::ICMP_SLT) return ConstantBool::getTrue(); + break; - // Functions are at least 4-byte aligned. If and'ing the address of a - // function with a constant < 4, fold it to zero. - if (const ConstantInt *CI = dyn_cast(V2)) - if (CI->getZExtValue() < 4 && isa(CPR)) - return Constant::getNullValue(CI->getType()); - } - break; - case Instruction::Or: - if (V2->isNullValue()) return const_cast(V1); // X | 0 == X - if (cast(V2)->isAllOnesValue()) - return const_cast(V2); // X | -1 == -1 - break; - case Instruction::Xor: - if (V2->isNullValue()) return const_cast(V1); // X ^ 0 == X - break; - } - } + case ICmpInst::ICMP_UGE: + // If we know that C1 >= C2, we can only partially decide this relation. + if (predicate == ICmpInst::ICMP_ULT) return ConstantBool::getFalse(); + if (predicate == ICmpInst::ICMP_UGT) return ConstantBool::getTrue(); + break; + case ICmpInst::ICMP_SGE: + // If we know that C1 >= C2, we can only partially decide this relation. + if (predicate == ICmpInst::ICMP_SLT) return ConstantBool::getFalse(); + if (predicate == ICmpInst::ICMP_SGT) return ConstantBool::getTrue(); + break; - } else if (isa(V2)) { - // If V2 is a constant expr and V1 isn't, flop them around and fold the - // other way if possible. - switch (Opcode) { - case Instruction::Add: - case Instruction::Mul: - case Instruction::And: - case Instruction::Or: - case Instruction::Xor: - case Instruction::SetEQ: - case Instruction::SetNE: - // No change of opcode required. - return ConstantFoldBinaryInstruction(Opcode, V2, V1); + case ICmpInst::ICMP_NE: + // If we know that C1 != C2, we can only partially decide this relation. + if (predicate == ICmpInst::ICMP_EQ) return ConstantBool::getFalse(); + if (predicate == ICmpInst::ICMP_NE) return ConstantBool::getTrue(); + break; + } - case Instruction::SetLT: - case Instruction::SetGT: - case Instruction::SetLE: - case Instruction::SetGE: - // Change the opcode as necessary to swap the operands. - Opcode = SetCondInst::getSwappedCondition((Instruction::BinaryOps)Opcode); - return ConstantFoldBinaryInstruction(Opcode, V2, V1); + if (!isa(C1) && isa(C2)) { + // If C2 is a constant expr and C1 isn't, flop them around and fold the + // other way if possible. + switch (predicate) { + case ICmpInst::ICMP_EQ: + case ICmpInst::ICMP_NE: + // No change of predicate required. + return ConstantFoldCompareInstruction(predicate, C2, C1); + + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + // Change the predicate as necessary to swap the operands. + predicate = ICmpInst::getSwappedPredicate((ICmpInst::Predicate)predicate); + return ConstantFoldCompareInstruction(predicate, C2, C1); - case Instruction::Shl: - case Instruction::LShr: - case Instruction::AShr: - case Instruction::Sub: - case Instruction::SDiv: - case Instruction::UDiv: - case Instruction::FDiv: - case Instruction::URem: - case Instruction::SRem: - case Instruction::FRem: - default: // These instructions cannot be flopped around. + default: // These predicates cannot be flopped around. break; } } return 0; } -Constant *llvm::ConstantFoldCompare( - unsigned opcode, Constant *C1, Constant *C2, unsigned short predicate) -{ - // Place holder for future folding of ICmp and FCmp instructions - return 0; -} - Constant *llvm::ConstantFoldGetElementPtr(const Constant *C, const std::vector &IdxList) { if (IdxList.size() == 0 || Index: llvm/lib/VMCore/ConstantFolding.h diff -u llvm/lib/VMCore/ConstantFolding.h:1.50 llvm/lib/VMCore/ConstantFolding.h:1.51 --- llvm/lib/VMCore/ConstantFolding.h:1.50 Sun Dec 3 23:19:34 2006 +++ llvm/lib/VMCore/ConstantFolding.h Sat Dec 23 00:05:41 2006 @@ -45,8 +45,8 @@ const Constant *Mask); Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1, const Constant *V2); - Constant *ConstantFoldCompare(unsigned opcode, Constant *C1, Constant *C2, - unsigned short predicate); + Constant *ConstantFoldCompareInstruction(unsigned short predicate, + Constant *C1, Constant *C2); Constant *ConstantFoldGetElementPtr(const Constant *C, const std::vector &IdxList); } // End llvm namespace Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.190 llvm/lib/VMCore/Constants.cpp:1.191 --- llvm/lib/VMCore/Constants.cpp:1.190 Mon Dec 18 19:28:19 2006 +++ llvm/lib/VMCore/Constants.cpp Sat Dec 23 00:05:41 2006 @@ -265,12 +265,6 @@ delete [] OperandList; } -static bool isSetCC(unsigned Opcode) { - return Opcode == Instruction::SetEQ || Opcode == Instruction::SetNE || - Opcode == Instruction::SetLT || Opcode == Instruction::SetGT || - Opcode == Instruction::SetLE || Opcode == Instruction::SetGE; -} - // We declare several classes private to this file, so use an anonymous // namespace namespace { @@ -290,8 +284,7 @@ Use Ops[2]; public: BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2) - : ConstantExpr(isSetCC(Opcode) ? Type::BoolTy : C1->getType(), - Opcode, Ops, 2) { + : ConstantExpr(C1->getType(), Opcode, Ops, 2) { Ops[0].init(C1, this); Ops[1].init(C2, this); } @@ -448,24 +441,6 @@ Constant *ConstantExpr::getXor(Constant *C1, Constant *C2) { return get(Instruction::Xor, C1, C2); } -Constant *ConstantExpr::getSetEQ(Constant *C1, Constant *C2) { - return get(Instruction::SetEQ, C1, C2); -} -Constant *ConstantExpr::getSetNE(Constant *C1, Constant *C2) { - return get(Instruction::SetNE, C1, C2); -} -Constant *ConstantExpr::getSetLT(Constant *C1, Constant *C2) { - return get(Instruction::SetLT, C1, C2); -} -Constant *ConstantExpr::getSetGT(Constant *C1, Constant *C2) { - return get(Instruction::SetGT, C1, C2); -} -Constant *ConstantExpr::getSetLE(Constant *C1, Constant *C2) { - return get(Instruction::SetLE, C1, C2); -} -Constant *ConstantExpr::getSetGE(Constant *C1, Constant *C2) { - return get(Instruction::SetGE, C1, C2); -} unsigned ConstantExpr::getPredicate() const { assert(getOpcode() == Instruction::FCmp || getOpcode() == Instruction::ICmp); return dynamic_cast(this)->predicate; @@ -582,6 +557,9 @@ std::vector ActualOps(Ops.begin()+1, Ops.end()); return ConstantExpr::getGetElementPtr(Ops[0], ActualOps); } + case Instruction::ICmp: + case Instruction::FCmp: + return ConstantExpr::getCompare(getPredicate(), Ops[0], Ops[1]); default: assert(getNumOperands() == 2 && "Must be binary operator?"); return ConstantExpr::get(getOpcode(), Ops[0], Ops[1]); @@ -1657,8 +1635,7 @@ assert(C1->getType() == C2->getType() && "Operand types in binary constant expression should match"); - if (ReqTy == C1->getType() || (Instruction::isComparison(Opcode) && - ReqTy == Type::BoolTy)) + if (ReqTy == C1->getType() || ReqTy == Type::BoolTy) if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2)) return FC; // Fold a few common cases... @@ -1667,11 +1644,23 @@ return ExprConstants->getOrCreate(ReqTy, Key); } -Constant *ConstantExpr::getCompareTy(unsigned Opcode, unsigned short predicate, +Constant *ConstantExpr::getCompareTy(unsigned short predicate, Constant *C1, Constant *C2) { - if (Opcode == Instruction::ICmp) - return getICmp(predicate, C1, C2); - return getFCmp(predicate, C1, C2); + switch (predicate) { + default: assert(0 && "Invalid CmpInst predicate"); + case FCmpInst::FCMP_FALSE: case FCmpInst::FCMP_OEQ: case FCmpInst::FCMP_OGT: + case FCmpInst::FCMP_OGE: case FCmpInst::FCMP_OLT: case FCmpInst::FCMP_OLE: + case FCmpInst::FCMP_ONE: case FCmpInst::FCMP_ORD: case FCmpInst::FCMP_UNO: + case FCmpInst::FCMP_UEQ: case FCmpInst::FCMP_UGT: case FCmpInst::FCMP_UGE: + case FCmpInst::FCMP_ULT: case FCmpInst::FCMP_ULE: case FCmpInst::FCMP_UNE: + case FCmpInst::FCMP_TRUE: + return getFCmp(predicate, C1, C2); + case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_UGE: case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_SGE: case ICmpInst::ICMP_SLT: + case ICmpInst::ICMP_SLE: + return getICmp(predicate, C1, C2); + } } Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) { @@ -1718,10 +1707,6 @@ assert((C1->getType()->isIntegral() || isa(C1->getType())) && "Tried to create a logical operation on a non-integral type!"); break; - case Instruction::SetLT: case Instruction::SetGT: case Instruction::SetLE: - case Instruction::SetGE: case Instruction::SetEQ: case Instruction::SetNE: - assert(C1->getType() == C2->getType() && "Op types should be identical!"); - break; case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: @@ -1737,10 +1722,10 @@ return getTy(C1->getType(), Opcode, C1, C2); } -Constant *ConstantExpr::getCompare(unsigned Opcode, unsigned short pred, +Constant *ConstantExpr::getCompare(unsigned short pred, Constant *C1, Constant *C2) { assert(C1->getType() == C2->getType() && "Op types should be identical!"); - return getCompareTy(Opcode, pred, C1, C2); + return getCompareTy(pred, C1, C2); } Constant *ConstantExpr::getSelectTy(const Type *ReqTy, Constant *C, @@ -1826,7 +1811,7 @@ assert(pred >= ICmpInst::FIRST_ICMP_PREDICATE && pred <= ICmpInst::LAST_ICMP_PREDICATE && "Invalid ICmp Predicate"); - if (Constant *FC = ConstantFoldCompare(Instruction::ICmp, LHS, RHS, pred)) + if (Constant *FC = ConstantFoldCompareInstruction(pred, LHS, RHS)) return FC; // Fold a few common cases... // Look up the constant in the table first to ensure uniqueness @@ -1843,7 +1828,7 @@ assert(LHS->getType() == RHS->getType()); assert(pred <= FCmpInst::LAST_FCMP_PREDICATE && "Invalid FCmp Predicate"); - if (Constant *FC = ConstantFoldCompare(Instruction::FCmp, LHS, RHS, pred)) + if (Constant *FC = ConstantFoldCompareInstruction(pred, LHS, RHS)) return FC; // Fold a few common cases... // Look up the constant in the table first to ensure uniqueness Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.60 llvm/lib/VMCore/Instruction.cpp:1.61 --- llvm/lib/VMCore/Instruction.cpp:1.60 Sun Dec 3 00:27:29 2006 +++ llvm/lib/VMCore/Instruction.cpp Sat Dec 23 00:05:41 2006 @@ -106,14 +106,6 @@ case Or : return "or"; case Xor: return "xor"; - // SetCC operators... - case SetLE: return "setle"; - case SetGE: return "setge"; - case SetLT: return "setlt"; - case SetGT: return "setgt"; - case SetEQ: return "seteq"; - case SetNE: return "setne"; - // Memory instructions... case Malloc: return "malloc"; case Free: return "free"; @@ -176,8 +168,35 @@ return LI->isVolatile() == cast(I)->isVolatile(); if (const StoreInst *SI = dyn_cast(this)) return SI->isVolatile() == cast(I)->isVolatile(); + if (const CmpInst *CI = dyn_cast(this)) + return CI->getPredicate() == cast(I)->getPredicate(); + if (const CallInst *CI = dyn_cast(this)) + return CI->isTailCall() == cast(I)->isTailCall(); + return true; +} + +// isSameOperationAs +bool Instruction::isSameOperationAs(Instruction *I) const { + if (getOpcode() != I->getOpcode() || getType() != I->getType() || + getNumOperands() != I->getNumOperands()) + return false; + + // We have two instructions of identical opcode and #operands. Check to see + // if all operands are the same type + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) + if (getOperand(i)->getType() != I->getOperand(i)->getType()) + return false; + + // Check special state that is a part of some instructions. + if (const LoadInst *LI = dyn_cast(this)) + return LI->isVolatile() == cast(I)->isVolatile(); + if (const StoreInst *SI = dyn_cast(this)) + return SI->isVolatile() == cast(I)->isVolatile(); + if (const CmpInst *CI = dyn_cast(this)) + return CI->getPredicate() == cast(I)->getPredicate(); if (const CallInst *CI = dyn_cast(this)) return CI->isTailCall() == cast(I)->isTailCall(); + return true; } @@ -213,31 +232,12 @@ case And: case Or: case Xor: - case SetEQ: - case SetNE: return true; default: return false; } } -/// isComparison - Return true if the instruction is a Set* instruction: -/// -bool Instruction::isComparison(unsigned op) { - switch (op) { - case SetEQ: - case SetNE: - case SetLT: - case SetGT: - case SetLE: - case SetGE: - return true; - } - return false; -} - - - /// isTrappingInstruction - Return true if the instruction may trap. /// bool Instruction::isTrapping(unsigned op) { Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.56 llvm/lib/VMCore/Instructions.cpp:1.57 --- llvm/lib/VMCore/Instructions.cpp:1.56 Mon Dec 18 02:52:59 2006 +++ llvm/lib/VMCore/Instructions.cpp Sat Dec 23 00:05:41 2006 @@ -1068,9 +1068,6 @@ cast(getType())->getElementType()->isIntegral())) && "Tried to create a logical operation on a non-integral type!"); break; - case SetLT: case SetGT: case SetLE: - case SetGE: case SetEQ: case SetNE: - assert(getType() == Type::BoolTy && "Setcc must return bool!"); default: break; } @@ -1082,15 +1079,7 @@ Instruction *InsertBefore) { assert(S1->getType() == S2->getType() && "Cannot create binary operator with two operands of differing type!"); - switch (Op) { - // Binary comparison operators... - case SetLT: case SetGT: case SetLE: - case SetGE: case SetEQ: case SetNE: - return new SetCondInst(Op, S1, S2, Name, InsertBefore); - - default: - return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertBefore); - } + return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertBefore); } BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2, @@ -1210,14 +1199,8 @@ // order dependent (SetLT f.e.) the opcode is changed. // bool BinaryOperator::swapOperands() { - if (isCommutative()) - ; // If the instruction is commutative, it is safe to swap the operands - else if (SetCondInst *SCI = dyn_cast(this)) - /// FIXME: SetCC instructions shouldn't all have different opcodes. - setOpcode(SCI->getSwappedCondition()); - else - return true; // Can't commute operands - + if (!isCommutative()) + return true; // Can't commute operands std::swap(Ops[0], Ops[1]); return false; } @@ -1926,58 +1909,6 @@ } //===----------------------------------------------------------------------===// -// SetCondInst Class -//===----------------------------------------------------------------------===// - -SetCondInst::SetCondInst(BinaryOps Opcode, Value *S1, Value *S2, - const std::string &Name, Instruction *InsertBefore) - : BinaryOperator(Opcode, S1, S2, Type::BoolTy, Name, InsertBefore) { - - // Make sure it's a valid type... getInverseCondition will assert out if not. - assert(getInverseCondition(Opcode)); -} - -SetCondInst::SetCondInst(BinaryOps Opcode, Value *S1, Value *S2, - const std::string &Name, BasicBlock *InsertAtEnd) - : BinaryOperator(Opcode, S1, S2, Type::BoolTy, Name, InsertAtEnd) { - - // Make sure it's a valid type... getInverseCondition will assert out if not. - assert(getInverseCondition(Opcode)); -} - -// getInverseCondition - Return the inverse of the current condition opcode. -// For example seteq -> setne, setgt -> setle, setlt -> setge, etc... -// -Instruction::BinaryOps SetCondInst::getInverseCondition(BinaryOps Opcode) { - switch (Opcode) { - default: - assert(0 && "Unknown setcc opcode!"); - case SetEQ: return SetNE; - case SetNE: return SetEQ; - case SetGT: return SetLE; - case SetLT: return SetGE; - case SetGE: return SetLT; - case SetLE: return SetGT; - } -} - -// getSwappedCondition - Return the condition opcode that would be the result -// of exchanging the two operands of the setcc instruction without changing -// the result produced. Thus, seteq->seteq, setle->setge, setlt->setgt, etc. -// -Instruction::BinaryOps SetCondInst::getSwappedCondition(BinaryOps Opcode) { - switch (Opcode) { - default: assert(0 && "Unknown setcc instruction!"); - case SetEQ: case SetNE: return Opcode; - case SetGT: return SetLT; - case SetLT: return SetGT; - case SetGE: return SetLE; - case SetLE: return SetGE; - } -} - - -//===----------------------------------------------------------------------===// // CmpInst Classes //===----------------------------------------------------------------------===// @@ -2111,7 +2042,7 @@ ICmpInst::Predicate ICmpInst::getSwappedPredicate(Predicate pred) { switch (pred) { - default: assert(! "Unknown setcc instruction!"); + default: assert(! "Unknown icmp predicate!"); case ICMP_EQ: case ICMP_NE: return pred; case ICMP_SGT: return ICMP_SLT; @@ -2125,6 +2056,30 @@ } } +ICmpInst::Predicate ICmpInst::getSignedPredicate(Predicate pred) { + switch (pred) { + default: assert(! "Unknown icmp predicate!"); + case ICMP_EQ: case ICMP_NE: + case ICMP_SGT: case ICMP_SLT: case ICMP_SGE: case ICMP_SLE: + return pred; + case ICMP_UGT: return ICMP_SGT; + case ICMP_ULT: return ICMP_SLT; + case ICMP_UGE: return ICMP_SGE; + case ICMP_ULE: return ICMP_SLE; + } +} + +bool ICmpInst::isSignedPredicate(Predicate pred) { + switch (pred) { + default: assert(! "Unknown icmp predicate!"); + case ICMP_SGT: case ICMP_SLT: case ICMP_SGE: case ICMP_SLE: + return true; + case ICMP_EQ: case ICMP_NE: case ICMP_UGT: case ICMP_ULT: + case ICMP_UGE: case ICMP_ULE: + return false; + } +} + FCmpInst::Predicate FCmpInst::getInversePredicate(Predicate pred) { switch (pred) { default: @@ -2150,7 +2105,7 @@ FCmpInst::Predicate FCmpInst::getSwappedPredicate(Predicate pred) { switch (pred) { - default: assert(!"Unknown setcc instruction!"); + default: assert(!"Unknown fcmp predicate!"); case FCMP_FALSE: case FCMP_TRUE: case FCMP_OEQ: case FCMP_ONE: case FCMP_UEQ: case FCMP_UNE: @@ -2167,6 +2122,40 @@ } } +bool CmpInst::isUnsigned(unsigned short predicate) { + switch (predicate) { + default: return false; + case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_ULE: case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_UGE: return true; + } +} + +bool CmpInst::isSigned(unsigned short predicate){ + switch (predicate) { + default: return false; + case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_SLE: case ICmpInst::ICMP_SGT: + case ICmpInst::ICMP_SGE: return true; + } +} + +bool CmpInst::isOrdered(unsigned short predicate) { + switch (predicate) { + default: return false; + case FCmpInst::FCMP_OEQ: case FCmpInst::FCMP_ONE: case FCmpInst::FCMP_OGT: + case FCmpInst::FCMP_OLT: case FCmpInst::FCMP_OGE: case FCmpInst::FCMP_OLE: + case FCmpInst::FCMP_ORD: return true; + } +} + +bool CmpInst::isUnordered(unsigned short predicate) { + switch (predicate) { + default: return false; + case FCmpInst::FCMP_UEQ: case FCmpInst::FCMP_UNE: case FCmpInst::FCMP_UGT: + case FCmpInst::FCMP_ULT: case FCmpInst::FCMP_UGE: case FCmpInst::FCMP_ULE: + case FCmpInst::FCMP_UNO: return true; + } +} + //===----------------------------------------------------------------------===// // SwitchInst Implementation //===----------------------------------------------------------------------===// Index: llvm/lib/VMCore/SymbolTable.cpp diff -u llvm/lib/VMCore/SymbolTable.cpp:1.63 llvm/lib/VMCore/SymbolTable.cpp:1.64 --- llvm/lib/VMCore/SymbolTable.cpp:1.63 Fri Nov 17 02:03:48 2006 +++ llvm/lib/VMCore/SymbolTable.cpp Sat Dec 23 00:05:41 2006 @@ -230,7 +230,7 @@ } -// insertEntry - Insert a value into the symbol table with the specified +// insertEntry - Insert a type into the symbol table with the specified // name... // void SymbolTable::insert(const std::string& Name, const Type* T) { Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.178 llvm/lib/VMCore/Verifier.cpp:1.179 --- llvm/lib/VMCore/Verifier.cpp:1.178 Wed Dec 20 15:20:13 2006 +++ llvm/lib/VMCore/Verifier.cpp Sat Dec 23 00:05:41 2006 @@ -719,10 +719,6 @@ Assert1(B.getType() == B.getOperand(0)->getType(), "Logical operators must have same type for operands and result!", &B); - } else if (isa(B)) { - // Check that setcc instructions return bool - Assert1(B.getType() == Type::BoolTy, - "setcc instructions must return boolean values!", &B); } else { // Arithmetic operators only work on integer or fp values Assert1(B.getType() == B.getOperand(0)->getType(), From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c Message-ID: <200612230607.kBN670O2022160@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-12-14-ordered_expr.c updated: 1.1 -> 1.2 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+1 -2) 2006-12-14-ordered_expr.c | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c diff -u llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c:1.1 llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c:1.2 --- llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c:1.1 Fri Dec 15 00:49:20 2006 +++ llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c Sat Dec 23 00:05:41 2006 @@ -1,5 +1,4 @@ -// RUN: %llvmgcc -O3 -S %s -o - | grep llvm.isunordered && -// RUN: %llvmgcc -O3 -S %s -o - | grep xor +// RUN: %llvmgcc -O3 -S %s -o - | grep 'fcmp ord float %X, %Y' int test2(float X, float Y) { return !__builtin_isunordered(X, Y); From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Message-ID: <200612230607.kBN670Iu022113@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/lib/compiler: StackerCompiler.cpp updated: 1.27 -> 1.28 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+25 -25) StackerCompiler.cpp | 50 +++++++++++++++++++++++++------------------------- 1 files changed, 25 insertions(+), 25 deletions(-) Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.27 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.28 --- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.27 Tue Dec 19 17:03:41 2006 +++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Sat Dec 23 00:05:41 2006 @@ -721,7 +721,7 @@ LoadInst* cond = cast( pop_integer(bb) ); // Compare the condition against 0 - SetCondInst* cond_inst = new SetCondInst( Instruction::SetNE, cond, + ICmpInst* cond_inst = new ICmpInst( ICmpInst::ICMP_NE, cond, ConstantInt::get( Type::LongTy, 0) ); bb->getInstList().push_back( cond_inst ); @@ -735,7 +735,7 @@ BasicBlock* false_bb = 0; if ( ifFalse ) false_bb = new BasicBlock((echo?"else":"")); - // Create a branch on the SetCond + // Create a branch on the ICmp BranchInst* br_inst = new BranchInst( true_bb, ( ifFalse ? false_bb : exit_bb ), cond_inst ); bb->getInstList().push_back( br_inst ); @@ -805,8 +805,8 @@ LoadInst* cond = cast( stack_top(test) ); // Compare the condition against 0 - SetCondInst* cond_inst = new SetCondInst( - Instruction::SetNE, cond, ConstantInt::get( Type::LongTy, 0)); + ICmpInst* cond_inst = new ICmpInst( + ICmpInst::ICMP_NE, cond, ConstantInt::get( Type::LongTy, 0)); test->getInstList().push_back( cond_inst ); // Add the branch instruction @@ -920,8 +920,8 @@ if (echo) bb->setName("LESS"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - SetCondInst* cond_inst = - new SetCondInst( Instruction::SetLT, op1, op2 ); + ICmpInst* cond_inst = + new ICmpInst( ICmpInst::ICMP_SLT, op1, op2 ); bb->getInstList().push_back( cond_inst ); push_value( bb, cond_inst ); break; @@ -931,8 +931,8 @@ if (echo) bb->setName("MORE"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - SetCondInst* cond_inst = - new SetCondInst( Instruction::SetGT, op1, op2 ); + ICmpInst* cond_inst = + new ICmpInst( ICmpInst::ICMP_SGT, op1, op2 ); bb->getInstList().push_back( cond_inst ); push_value( bb, cond_inst ); break; @@ -942,8 +942,8 @@ if (echo) bb->setName("LE"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - SetCondInst* cond_inst = - new SetCondInst( Instruction::SetLE, op1, op2 ); + ICmpInst* cond_inst = + new ICmpInst( ICmpInst::ICMP_SLE, op1, op2 ); bb->getInstList().push_back( cond_inst ); push_value( bb, cond_inst ); break; @@ -953,8 +953,8 @@ if (echo) bb->setName("GE"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - SetCondInst* cond_inst = - new SetCondInst( Instruction::SetGE, op1, op2 ); + ICmpInst* cond_inst = + new ICmpInst( ICmpInst::ICMP_SGE, op1, op2 ); bb->getInstList().push_back( cond_inst ); push_value( bb, cond_inst ); break; @@ -964,8 +964,8 @@ if (echo) bb->setName("NE"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - SetCondInst* cond_inst = - new SetCondInst( Instruction::SetNE, op1, op2 ); + ICmpInst* cond_inst = + new ICmpInst( ICmpInst::ICMP_NE, op1, op2 ); bb->getInstList().push_back( cond_inst ); push_value( bb, cond_inst ); break; @@ -975,8 +975,8 @@ if (echo) bb->setName("EQ"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - SetCondInst* cond_inst = - new SetCondInst( Instruction::SetEQ, op1, op2 ); + ICmpInst* cond_inst = + new ICmpInst( ICmpInst::ICMP_EQ, op1, op2 ); bb->getInstList().push_back( cond_inst ); push_value( bb, cond_inst ); break; @@ -1102,8 +1102,8 @@ LoadInst* op1 = cast(stack_top(bb)); // Determine if its negative - SetCondInst* cond_inst = - new SetCondInst( Instruction::SetLT, op1, Zero ); + ICmpInst* cond_inst = + new ICmpInst( ICmpInst::ICMP_SLT, op1, Zero ); bb->getInstList().push_back( cond_inst ); // Create a block for storing the result @@ -1112,7 +1112,7 @@ // Create a block for making it a positive value BasicBlock* pos_bb = new BasicBlock((echo?"neg":"")); - // Create the branch on the SetCond + // Create the branch on the ICmp BranchInst* br_inst = new BranchInst( pos_bb, exit_bb, cond_inst ); bb->getInstList().push_back( br_inst ); @@ -1143,11 +1143,11 @@ LoadInst* op2 = cast(pop_integer(bb)); // Compare them - SetCondInst* cond_inst = - new SetCondInst( Instruction::SetLT, op1, op2); + ICmpInst* cond_inst = + new ICmpInst( ICmpInst::ICMP_SLT, op1, op2); bb->getInstList().push_back( cond_inst ); - // Create a branch on the SetCond + // Create a branch on the ICmp BranchInst* br_inst = new BranchInst( op1_block, op2_block, cond_inst ); bb->getInstList().push_back( br_inst ); @@ -1175,8 +1175,8 @@ LoadInst* op2 = cast(pop_integer(bb)); // Compare them - SetCondInst* cond_inst = - new SetCondInst( Instruction::SetGT, op1, op2); + ICmpInst* cond_inst = + new ICmpInst( ICmpInst::ICMP_SGT, op1, op2); bb->getInstList().push_back( cond_inst ); // Create an exit block @@ -1192,7 +1192,7 @@ push_value(op2_block, op2); op2_block->getInstList().push_back( new BranchInst( exit_bb ) ); - // Create a banch on the SetCond + // Create a banch on the ICmp BranchInst* br_inst = new BranchInst( op1_block, op2_block, cond_inst ); bb->getInstList().push_back( br_inst ); From reid at x10sys.com Sat Dec 23 00:06:56 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:56 -0600 Subject: [llvm-commits] CVS: llvm/examples/Fibonacci/fibonacci.cpp Message-ID: <200612230606.kBN66ux8022018@zion.cs.uiuc.edu> Changes in directory llvm/examples/Fibonacci: fibonacci.cpp updated: 1.12 -> 1.13 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+1 -1) fibonacci.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/examples/Fibonacci/fibonacci.cpp diff -u llvm/examples/Fibonacci/fibonacci.cpp:1.12 llvm/examples/Fibonacci/fibonacci.cpp:1.13 --- llvm/examples/Fibonacci/fibonacci.cpp:1.12 Fri Oct 20 02:07:23 2006 +++ llvm/examples/Fibonacci/fibonacci.cpp Sat Dec 23 00:05:40 2006 @@ -58,7 +58,7 @@ BasicBlock* RecurseBB = new BasicBlock("recurse", FibF); // Create the "if (arg < 2) goto exitbb" - Value *CondInst = BinaryOperator::createSetLE(ArgX, Two, "cond", BB); + Value *CondInst = new ICmpInst(ICmpInst::ICMP_SLE, ArgX, Two, "cond", BB); new BranchInst(RetBB, RecurseBB, CondInst, BB); // Create: ret int 1 From reid at x10sys.com Sat Dec 23 00:06:59 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:59 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp Message-ID: <200612230606.kBN66xRp022085@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.25 -> 1.26 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+97 -40) CppWriter.cpp | 137 +++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 97 insertions(+), 40 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.25 llvm/tools/llvm2cpp/CppWriter.cpp:1.26 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.25 Mon Dec 18 01:58:01 2006 +++ llvm/tools/llvm2cpp/CppWriter.cpp Sat Dec 23 00:05:41 2006 @@ -783,31 +783,63 @@ } Out << "Constant* " << constName << " = ConstantExpr::"; switch (CE->getOpcode()) { - case Instruction::Add: Out << "getAdd"; break; - case Instruction::Sub: Out << "getSub"; break; - case Instruction::Mul: Out << "getMul"; break; - case Instruction::UDiv: Out << "getUDiv"; break; - case Instruction::SDiv: Out << "getSDiv"; break; - case Instruction::FDiv: Out << "getFDiv"; break; - case Instruction::URem: Out << "getURem"; break; - case Instruction::SRem: Out << "getSRem"; break; - case Instruction::FRem: Out << "getFRem"; break; - case Instruction::And: Out << "getAnd"; break; - case Instruction::Or: Out << "getOr"; break; - case Instruction::Xor: Out << "getXor"; break; - case Instruction::SetEQ: Out << "getSetEQ"; break; - case Instruction::SetNE: Out << "getSetNE"; break; - case Instruction::SetLE: Out << "getSetLE"; break; - case Instruction::SetGE: Out << "getSetGE"; break; - case Instruction::SetLT: Out << "getSetLT"; break; - case Instruction::SetGT: Out << "getSetGT"; break; - case Instruction::Shl: Out << "getShl"; break; - case Instruction::LShr: Out << "getLShr"; break; - case Instruction::AShr: Out << "getAShr"; break; - case Instruction::Select: Out << "getSelect"; break; - case Instruction::ExtractElement: Out << "getExtractElement"; break; - case Instruction::InsertElement: Out << "getInsertElement"; break; - case Instruction::ShuffleVector: Out << "getShuffleVector"; break; + case Instruction::Add: Out << "getAdd("; break; + case Instruction::Sub: Out << "getSub("; break; + case Instruction::Mul: Out << "getMul("; break; + case Instruction::UDiv: Out << "getUDiv("; break; + case Instruction::SDiv: Out << "getSDiv("; break; + case Instruction::FDiv: Out << "getFDiv("; break; + case Instruction::URem: Out << "getURem("; break; + case Instruction::SRem: Out << "getSRem("; break; + case Instruction::FRem: Out << "getFRem("; break; + case Instruction::And: Out << "getAnd("; break; + case Instruction::Or: Out << "getOr("; break; + case Instruction::Xor: Out << "getXor("; break; + case Instruction::ICmp: + Out << "getICmp(ICmpInst::ICMP_"; + switch (CE->getPredicate()) { + case ICmpInst::ICMP_EQ: Out << "EQ"; break; + case ICmpInst::ICMP_NE: Out << "NE"; break; + case ICmpInst::ICMP_SLT: Out << "SLT"; break; + case ICmpInst::ICMP_ULT: Out << "ULT"; break; + case ICmpInst::ICMP_SGT: Out << "SGT"; break; + case ICmpInst::ICMP_UGT: Out << "UGT"; break; + case ICmpInst::ICMP_SLE: Out << "SLE"; break; + case ICmpInst::ICMP_ULE: Out << "ULE"; break; + case ICmpInst::ICMP_SGE: Out << "SGE"; break; + case ICmpInst::ICMP_UGE: Out << "UGE"; break; + default: error("Invalid ICmp Predicate"); + } + break; + case Instruction::FCmp: + Out << "getFCmp(FCmpInst::FCMP_"; + switch (CE->getPredicate()) { + case FCmpInst::FCMP_FALSE: Out << "FALSE"; break; + case FCmpInst::FCMP_ORD: Out << "ORD"; break; + case FCmpInst::FCMP_UNO: Out << "UNO"; break; + case FCmpInst::FCMP_OEQ: Out << "OEQ"; break; + case FCmpInst::FCMP_UEQ: Out << "UEQ"; break; + case FCmpInst::FCMP_ONE: Out << "ONE"; break; + case FCmpInst::FCMP_UNE: Out << "UNE"; break; + case FCmpInst::FCMP_OLT: Out << "OLT"; break; + case FCmpInst::FCMP_ULT: Out << "ULT"; break; + case FCmpInst::FCMP_OGT: Out << "OGT"; break; + case FCmpInst::FCMP_UGT: Out << "UGT"; break; + case FCmpInst::FCMP_OLE: Out << "OLE"; break; + case FCmpInst::FCMP_ULE: Out << "ULE"; break; + case FCmpInst::FCMP_OGE: Out << "OGE"; break; + case FCmpInst::FCMP_UGE: Out << "UGE"; break; + case FCmpInst::FCMP_TRUE: Out << "TRUE"; break; + default: error("Invalid FCmp Predicate"); + } + break; + case Instruction::Shl: Out << "getShl("; break; + case Instruction::LShr: Out << "getLShr("; break; + case Instruction::AShr: Out << "getAShr("; break; + case Instruction::Select: Out << "getSelect("; break; + case Instruction::ExtractElement: Out << "getExtractElement("; break; + case Instruction::InsertElement: Out << "getInsertElement("; break; + case Instruction::ShuffleVector: Out << "getShuffleVector("; break; default: error("Invalid constant expression"); break; @@ -1075,21 +1107,46 @@ Out << "\", " << bbname << ");"; break; } - case Instruction::SetEQ: - case Instruction::SetNE: - case Instruction::SetLE: - case Instruction::SetGE: - case Instruction::SetLT: - case Instruction::SetGT: { - Out << "SetCondInst* " << iName << " = new SetCondInst("; - switch (I->getOpcode()) { - case Instruction::SetEQ: Out << "Instruction::SetEQ"; break; - case Instruction::SetNE: Out << "Instruction::SetNE"; break; - case Instruction::SetLE: Out << "Instruction::SetLE"; break; - case Instruction::SetGE: Out << "Instruction::SetGE"; break; - case Instruction::SetLT: Out << "Instruction::SetLT"; break; - case Instruction::SetGT: Out << "Instruction::SetGT"; break; - default: Out << "Instruction::BadOpCode"; break; + case Instruction::FCmp: { + Out << "FCmpInst* " << iName << " = new FCmpInst("; + switch (cast(I)->getPredicate()) { + case FCmpInst::FCMP_FALSE: Out << "FCmpInst::FCMP_FALSE"; break; + case FCmpInst::FCMP_OEQ : Out << "FCmpInst::FCMP_OEQ"; break; + case FCmpInst::FCMP_OGT : Out << "FCmpInst::FCMP_OGT"; break; + case FCmpInst::FCMP_OGE : Out << "FCmpInst::FCMP_OGE"; break; + case FCmpInst::FCMP_OLT : Out << "FCmpInst::FCMP_OLT"; break; + case FCmpInst::FCMP_OLE : Out << "FCmpInst::FCMP_OLE"; break; + case FCmpInst::FCMP_ONE : Out << "FCmpInst::FCMP_ONE"; break; + case FCmpInst::FCMP_ORD : Out << "FCmpInst::FCMP_ORD"; break; + case FCmpInst::FCMP_UNO : Out << "FCmpInst::FCMP_UNO"; break; + case FCmpInst::FCMP_UEQ : Out << "FCmpInst::FCMP_UEQ"; break; + case FCmpInst::FCMP_UGT : Out << "FCmpInst::FCMP_UGT"; break; + case FCmpInst::FCMP_UGE : Out << "FCmpInst::FCMP_UGE"; break; + case FCmpInst::FCMP_ULT : Out << "FCmpInst::FCMP_ULT"; break; + case FCmpInst::FCMP_ULE : Out << "FCmpInst::FCMP_ULE"; break; + case FCmpInst::FCMP_UNE : Out << "FCmpInst::FCMP_UNE"; break; + case FCmpInst::FCMP_TRUE : Out << "FCmpInst::FCMP_TRUE"; break; + default: Out << "FCmpInst::BAD_ICMP_PREDICATE"; break; + } + Out << ", " << opNames[0] << ", " << opNames[1] << ", \""; + printEscapedString(I->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::ICmp: { + Out << "ICmpInst* " << iName << " = new ICmpInst("; + switch (cast(I)->getPredicate()) { + case ICmpInst::ICMP_EQ: Out << "ICmpInst::ICMP_EQ"; break; + case ICmpInst::ICMP_NE: Out << "ICmpInst::ICMP_NE"; break; + case ICmpInst::ICMP_ULE: Out << "ICmpInst::ICMP_ULE"; break; + case ICmpInst::ICMP_SLE: Out << "ICmpInst::ICMP_SLE"; break; + case ICmpInst::ICMP_UGE: Out << "ICmpInst::ICMP_UGE"; break; + case ICmpInst::ICMP_SGE: Out << "ICmpInst::ICMP_SGE"; break; + case ICmpInst::ICMP_ULT: Out << "ICmpInst::ICMP_ULT"; break; + case ICmpInst::ICMP_SLT: Out << "ICmpInst::ICMP_SLT"; break; + case ICmpInst::ICMP_UGT: Out << "ICmpInst::ICMP_UGT"; break; + case ICmpInst::ICMP_SGT: Out << "ICmpInst::ICMP_SGT"; break; + default: Out << "ICmpInst::BAD_ICMP_PREDICATE"; break; } Out << ", " << opNames[0] << ", " << opNames[1] << ", \""; printEscapedString(I->getName()); From reid at x10sys.com Sat Dec 23 00:06:58 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:58 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ConstantRange.h InstVisitor.h PatternMatch.h Message-ID: <200612230606.kBN66wdv022027@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: ConstantRange.h updated: 1.12 -> 1.13 InstVisitor.h updated: 1.44 -> 1.45 PatternMatch.h updated: 1.14 -> 1.15 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+57 -16) ConstantRange.h | 26 ++++++++++++++++++-------- InstVisitor.h | 1 - PatternMatch.h | 46 +++++++++++++++++++++++++++++++++++++++------- 3 files changed, 57 insertions(+), 16 deletions(-) Index: llvm/include/llvm/Support/ConstantRange.h diff -u llvm/include/llvm/Support/ConstantRange.h:1.12 llvm/include/llvm/Support/ConstantRange.h:1.13 --- llvm/include/llvm/Support/ConstantRange.h:1.12 Sat Dec 16 23:15:12 2006 +++ llvm/include/llvm/Support/ConstantRange.h Sat Dec 23 00:05:40 2006 @@ -12,13 +12,19 @@ // constant, which MAY wrap around the end of the numeric range. To do this, it // keeps track of a [lower, upper) bound, which specifies an interval just like // STL iterators. When used with boolean values, the following are important -// ranges (other integral ranges use min/max values for special range values): +// ranges: : // // [F, F) = {} = Empty set // [T, F) = {T} // [F, T) = {F} // [T, T) = {F, T} = Full set // +// The other integral ranges use min/max values for special range values. For +// example, for 8-bit types, it uses: +// [0, 0) = {} = Empty set +// [255, 255) = {0..255} = Full Set +// +// Note that ConstantRange always keeps unsigned values. //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_CONSTANT_RANGE_H @@ -51,9 +57,11 @@ /// ConstantRange(Constant *Lower, Constant *Upper); - /// Initialize a set of values that all satisfy the condition with C. - /// - ConstantRange(unsigned SetCCOpcode, ConstantIntegral *C); + /// Initialize a set of values that all satisfy the predicate with C. The + /// predicate should be either an ICmpInst::Predicate or FCmpInst::Predicate + /// value. + /// @brief Get a range for a relation with a constant integral. + ConstantRange(unsigned short predicate, ConstantIntegral *C); /// getLower - Return the lower value for this range... /// @@ -79,11 +87,13 @@ /// isWrappedSet - Return true if this set wraps around the top of the range, /// for example: [100, 8) /// - bool isWrappedSet() const; + bool isWrappedSet(bool isSigned) const; /// contains - Return true if the specified value is in the set. + /// The isSigned parameter indicates whether the comparisons should be + /// performed as if the values are signed or not. /// - bool contains(ConstantInt *Val) const; + bool contains(ConstantInt *Val, bool isSigned) const; /// getSingleElement - If this set contains a single element, return it, /// otherwise return null. @@ -117,7 +127,7 @@ /// one of the sets but not the other. For example: [100, 8) intersect [3, /// 120) yields [3, 120) /// - ConstantRange intersectWith(const ConstantRange &CR) const; + ConstantRange intersectWith(const ConstantRange &CR, bool isSigned) const; /// union - Return the range that results from the union of this range with /// another range. The resultant range is guaranteed to include the elements @@ -125,7 +135,7 @@ /// [3, 15), which includes 9, 10, and 11, which were not included in either /// set before. /// - ConstantRange unionWith(const ConstantRange &CR) const; + ConstantRange unionWith(const ConstantRange &CR, bool isSigned) const; /// zeroExtend - Return a new range in the specified integer type, which must /// be strictly larger than the current type. The returned range will Index: llvm/include/llvm/Support/InstVisitor.h diff -u llvm/include/llvm/Support/InstVisitor.h:1.44 llvm/include/llvm/Support/InstVisitor.h:1.45 --- llvm/include/llvm/Support/InstVisitor.h:1.44 Wed Nov 29 15:37:00 2006 +++ llvm/include/llvm/Support/InstVisitor.h Sat Dec 23 00:05:40 2006 @@ -167,7 +167,6 @@ RetTy visitInvokeInst(InvokeInst &I) { DELEGATE(TerminatorInst);} RetTy visitUnwindInst(UnwindInst &I) { DELEGATE(TerminatorInst);} RetTy visitUnreachableInst(UnreachableInst &I) { DELEGATE(TerminatorInst);} - RetTy visitSetCondInst(SetCondInst &I) { DELEGATE(BinaryOperator);} RetTy visitICmpInst(ICmpInst &I) { DELEGATE(CmpInst);} RetTy visitFCmpInst(FCmpInst &I) { DELEGATE(CmpInst);} RetTy visitMallocInst(MallocInst &I) { DELEGATE(AllocationInst);} Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.14 llvm/include/llvm/Support/PatternMatch.h:1.15 --- llvm/include/llvm/Support/PatternMatch.h:1.14 Sun Nov 26 19:05:09 2006 +++ llvm/include/llvm/Support/PatternMatch.h Sat Dec 23 00:05:40 2006 @@ -248,13 +248,6 @@ }; template -inline BinaryOpClass_match -m_SetCond(Instruction::BinaryOps &Op, const LHS &L, const RHS &R) { - return BinaryOpClass_match(Op, L, R); -} - -template inline BinaryOpClass_match m_Shift(Instruction::OtherOps &Op, const LHS &L, const RHS &R) { return BinaryOpClass_match +struct CmpClass_match { + PredicateTy &Predicate; + LHS_t L; + RHS_t R; + + CmpClass_match(PredicateTy &Pred, const LHS_t &LHS, + const RHS_t &RHS) + : Predicate(Pred), L(LHS), R(RHS) {} + + template + bool match(OpTy *V) { + if (Class *I = dyn_cast(V)) + if (L.match(I->getOperand(0)) && R.match(I->getOperand(1))) { + Predicate = I->getPredicate(); + return true; + } + return false; + } +}; + +template +inline CmpClass_match +m_ICmp(ICmpInst::Predicate &Pred, const LHS &L, const RHS &R) { + return CmpClass_match(Pred, L, R); +} + +template +inline CmpClass_match +m_FCmp(FCmpInst::Predicate &Pred, const LHS &L, const RHS &R) { + return CmpClass_match(Pred, L, R); +} + +//===----------------------------------------------------------------------===// // Matchers for unary operators // From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ConstantRange.cpp LoopInfo.cpp ScalarEvolution.cpp ValueNumbering.cpp Message-ID: <200612230607.kBN670Kb022177@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.94 -> 1.95 ConstantRange.cpp updated: 1.22 -> 1.23 LoopInfo.cpp updated: 1.81 -> 1.82 ScalarEvolution.cpp updated: 1.76 -> 1.77 ValueNumbering.cpp updated: 1.23 -> 1.24 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+221 -202) BasicAliasAnalysis.cpp | 3 ConstantRange.cpp | 199 +++++++++++++++++++++++++------------------------ LoopInfo.cpp | 18 ++-- ScalarEvolution.cpp | 198 +++++++++++++++++++++++++----------------------- ValueNumbering.cpp | 5 + 5 files changed, 221 insertions(+), 202 deletions(-) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.94 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.95 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.94 Tue Dec 12 17:36:14 2006 +++ llvm/lib/Analysis/BasicAliasAnalysis.cpp Sat Dec 23 00:05:40 2006 @@ -590,7 +590,8 @@ // Make sure they are comparable (ie, not constant expressions), and // make sure the GEP with the smaller leading constant is GEP1. if (G1OC) { - Constant *Compare = ConstantExpr::getSetGT(G1OC, G2OC); + Constant *Compare = ConstantExpr::getICmp(ICmpInst::ICMP_SGT, + G1OC, G2OC); if (ConstantBool *CV = dyn_cast(Compare)) { if (CV->getValue()) // If they are comparable and G2 > G1 std::swap(GEP1Ops, GEP2Ops); // Make GEP1 < GEP2 Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.22 llvm/lib/Analysis/ConstantRange.cpp:1.23 --- llvm/lib/Analysis/ConstantRange.cpp:1.22 Tue Dec 12 17:36:14 2006 +++ llvm/lib/Analysis/ConstantRange.cpp Sat Dec 23 00:05:40 2006 @@ -24,56 +24,43 @@ #include "llvm/Support/ConstantRange.h" #include "llvm/Constants.h" #include "llvm/Instruction.h" +#include "llvm/Instructions.h" #include "llvm/Type.h" #include "llvm/Support/Streams.h" #include using namespace llvm; -static ConstantIntegral *getMaxValue(const Type *Ty) { - switch (Ty->getTypeID()) { - case Type::BoolTyID: return ConstantBool::getTrue(); - case Type::SByteTyID: - case Type::ShortTyID: - case Type::IntTyID: - case Type::LongTyID: { - // Calculate 011111111111111... - unsigned TypeBits = Ty->getPrimitiveSize()*8; - int64_t Val = INT64_MAX; // All ones - Val >>= 64-TypeBits; // Shift out unwanted 1 bits... - return ConstantInt::get(Ty, Val); - } - - case Type::UByteTyID: - case Type::UShortTyID: - case Type::UIntTyID: - case Type::ULongTyID: return ConstantInt::getAllOnesValue(Ty); - - default: return 0; +static ConstantIntegral *getMaxValue(const Type *Ty, bool isSigned = false) { + if (Ty == Type::BoolTy) + return ConstantBool::getTrue(); + if (Ty->isInteger()) { + if (isSigned) { + // Calculate 011111111111111... + unsigned TypeBits = Ty->getPrimitiveSize()*8; + int64_t Val = INT64_MAX; // All ones + Val >>= 64-TypeBits; // Shift out unwanted 1 bits... + return ConstantInt::get(Ty, Val); + } + return ConstantInt::getAllOnesValue(Ty); } + return 0; } // Static constructor to create the minimum constant for an integral type... -static ConstantIntegral *getMinValue(const Type *Ty) { - switch (Ty->getTypeID()) { - case Type::BoolTyID: return ConstantBool::getFalse(); - case Type::SByteTyID: - case Type::ShortTyID: - case Type::IntTyID: - case Type::LongTyID: { - // Calculate 1111111111000000000000 - unsigned TypeBits = Ty->getPrimitiveSize()*8; - int64_t Val = -1; // All ones - Val <<= TypeBits-1; // Shift over to the right spot - return ConstantInt::get(Ty, Val); - } - - case Type::UByteTyID: - case Type::UShortTyID: - case Type::UIntTyID: - case Type::ULongTyID: return ConstantInt::get(Ty, 0); - - default: return 0; +static ConstantIntegral *getMinValue(const Type *Ty, bool isSigned = false) { + if (Ty == Type::BoolTy) + return ConstantBool::getFalse(); + if (Ty->isInteger()) { + if (isSigned) { + // Calculate 1111111111000000000000 + unsigned TypeBits = Ty->getPrimitiveSize()*8; + int64_t Val = -1; // All ones + Val <<= TypeBits-1; // Shift over to the right spot + return ConstantInt::get(Ty, Val); + } + return ConstantInt::get(Ty, 0); } + return 0; } static ConstantIntegral *Next(ConstantIntegral *CI) { if (ConstantBool *CB = dyn_cast(CI)) @@ -84,25 +71,30 @@ return cast(Result); } -static bool LT(ConstantIntegral *A, ConstantIntegral *B) { - Constant *C = ConstantExpr::getSetLT(A, B); +static bool LT(ConstantIntegral *A, ConstantIntegral *B, bool isSigned) { + Constant *C = ConstantExpr::getICmp( + (isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT), A, B); assert(isa(C) && "Constant folding of integrals not impl??"); return cast(C)->getValue(); } -static bool LTE(ConstantIntegral *A, ConstantIntegral *B) { - Constant *C = ConstantExpr::getSetLE(A, B); +static bool LTE(ConstantIntegral *A, ConstantIntegral *B, bool isSigned) { + Constant *C = ConstantExpr::getICmp( + (isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE), A, B); assert(isa(C) && "Constant folding of integrals not impl??"); return cast(C)->getValue(); } -static bool GT(ConstantIntegral *A, ConstantIntegral *B) { return LT(B, A); } +static bool GT(ConstantIntegral *A, ConstantIntegral *B, bool isSigned) { + return LT(B, A, isSigned); } -static ConstantIntegral *Min(ConstantIntegral *A, ConstantIntegral *B) { - return LT(A, B) ? A : B; -} -static ConstantIntegral *Max(ConstantIntegral *A, ConstantIntegral *B) { - return GT(A, B) ? A : B; +static ConstantIntegral *Min(ConstantIntegral *A, ConstantIntegral *B, + bool isSigned) { + return LT(A, B, isSigned) ? A : B; +} +static ConstantIntegral *Max(ConstantIntegral *A, ConstantIntegral *B, + bool isSigned) { + return GT(A, B, isSigned) ? A : B; } /// Initialize a full (the default) or empty set for the specified type. @@ -118,47 +110,62 @@ /// Initialize a range to hold the single specified value. /// -ConstantRange::ConstantRange(Constant *V) - : Lower(cast(V)), Upper(Next(cast(V))) { -} +ConstantRange::ConstantRange(Constant *V) + : Lower(cast(V)), Upper(Next(cast(V))) { } /// Initialize a range of values explicitly... this will assert out if /// Lower==Upper and Lower != Min or Max for its type (or if the two constants /// have different types) /// -ConstantRange::ConstantRange(Constant *L, Constant *U) +ConstantRange::ConstantRange(Constant *L, Constant *U) : Lower(cast(L)), Upper(cast(U)) { assert(Lower->getType() == Upper->getType() && "Incompatible types for ConstantRange!"); // Make sure that if L & U are equal that they are either Min or Max... assert((L != U || (L == getMaxValue(L->getType()) || - L == getMinValue(L->getType()))) && - "Lower == Upper, but they aren't min or max for type!"); + L == getMinValue(L->getType()))) + && "Lower == Upper, but they aren't min or max for type!"); } /// Initialize a set of values that all satisfy the condition with C. /// -ConstantRange::ConstantRange(unsigned SetCCOpcode, ConstantIntegral *C) { - switch (SetCCOpcode) { - default: assert(0 && "Invalid SetCC opcode to ConstantRange ctor!"); - case Instruction::SetEQ: Lower = C; Upper = Next(C); return; - case Instruction::SetNE: Upper = C; Lower = Next(C); return; - case Instruction::SetLT: +ConstantRange::ConstantRange(unsigned short ICmpOpcode, ConstantIntegral *C) { + switch (ICmpOpcode) { + default: assert(0 && "Invalid ICmp opcode to ConstantRange ctor!"); + case ICmpInst::ICMP_EQ: Lower = C; Upper = Next(C); return; + case ICmpInst::ICMP_NE: Upper = C; Lower = Next(C); return; + case ICmpInst::ICMP_ULT: Lower = getMinValue(C->getType()); Upper = C; return; - case Instruction::SetGT: + case ICmpInst::ICMP_SLT: + Lower = getMinValue(C->getType(), true); + Upper = C; + return; + case ICmpInst::ICMP_UGT: + Lower = Next(C); + Upper = getMinValue(C->getType()); // Min = Next(Max) + return; + case ICmpInst::ICMP_SGT: Lower = Next(C); - Upper = getMinValue(C->getType()); // Min = Next(Max) + Upper = getMinValue(C->getType(), true); // Min = Next(Max) return; - case Instruction::SetLE: + case ICmpInst::ICMP_ULE: Lower = getMinValue(C->getType()); Upper = Next(C); return; - case Instruction::SetGE: + case ICmpInst::ICMP_SLE: + Lower = getMinValue(C->getType(), true); + Upper = Next(C); + return; + case ICmpInst::ICMP_UGE: + Lower = C; + Upper = getMinValue(C->getType()); // Min = Next(Max) + return; + case ICmpInst::ICMP_SGE: Lower = C; - Upper = getMinValue(C->getType()); // Min = Next(Max) + Upper = getMinValue(C->getType(), true); // Min = Next(Max) return; } } @@ -182,11 +189,10 @@ /// isWrappedSet - Return true if this set wraps around the top of the range, /// for example: [100, 8) /// -bool ConstantRange::isWrappedSet() const { - return GT(Lower, Upper); +bool ConstantRange::isWrappedSet(bool isSigned) const { + return GT(Lower, Upper, isSigned); } - /// getSingleElement - If this set contains a single element, return it, /// otherwise return null. ConstantIntegral *ConstantRange::getSingleElement() const { @@ -212,19 +218,17 @@ /// contains - Return true if the specified value is in the set. /// -bool ConstantRange::contains(ConstantInt *Val) const { +bool ConstantRange::contains(ConstantInt *Val, bool isSigned) const { if (Lower == Upper) { if (isFullSet()) return true; return false; } - if (!isWrappedSet()) - return LTE(Lower, Val) && LT(Val, Upper); - return LTE(Lower, Val) || LT(Val, Upper); + if (!isWrappedSet(isSigned)) + return LTE(Lower, Val, isSigned) && LT(Val, Upper, isSigned); + return LTE(Lower, Val, isSigned) || LT(Val, Upper, isSigned); } - - /// subtract - Subtract the specified constant from the endpoints of this /// constant range. ConstantRange ConstantRange::subtract(ConstantInt *CI) const { @@ -241,15 +245,16 @@ // it is known that LHS is wrapped and RHS isn't. // static ConstantRange intersect1Wrapped(const ConstantRange &LHS, - const ConstantRange &RHS) { - assert(LHS.isWrappedSet() && !RHS.isWrappedSet()); + const ConstantRange &RHS, + bool isSigned) { + assert(LHS.isWrappedSet(isSigned) && !RHS.isWrappedSet(isSigned)); // Check to see if we overlap on the Left side of RHS... // - if (LT(RHS.getLower(), LHS.getUpper())) { + if (LT(RHS.getLower(), LHS.getUpper(), isSigned)) { // We do overlap on the left side of RHS, see if we overlap on the right of // RHS... - if (GT(RHS.getUpper(), LHS.getLower())) { + if (GT(RHS.getUpper(), LHS.getLower(), isSigned)) { // Ok, the result overlaps on both the left and right sides. See if the // resultant interval will be smaller if we wrap or not... // @@ -262,11 +267,10 @@ // No overlap on the right, just on the left. return ConstantRange(RHS.getLower(), LHS.getUpper()); } - } else { // We don't overlap on the left side of RHS, see if we overlap on the right // of RHS... - if (GT(RHS.getUpper(), LHS.getLower())) { + if (GT(RHS.getUpper(), LHS.getLower(), isSigned)) { // Simple overlap... return ConstantRange(LHS.getLower(), RHS.getUpper()); } else { @@ -279,30 +283,31 @@ /// intersect - Return the range that results from the intersection of this /// range with another range. /// -ConstantRange ConstantRange::intersectWith(const ConstantRange &CR) const { +ConstantRange ConstantRange::intersectWith(const ConstantRange &CR, + bool isSigned) const { assert(getType() == CR.getType() && "ConstantRange types don't agree!"); // Handle common special cases if (isEmptySet() || CR.isFullSet()) return *this; if (isFullSet() || CR.isEmptySet()) return CR; - if (!isWrappedSet()) { - if (!CR.isWrappedSet()) { - ConstantIntegral *L = Max(Lower, CR.Lower); - ConstantIntegral *U = Min(Upper, CR.Upper); + if (!isWrappedSet(isSigned)) { + if (!CR.isWrappedSet(isSigned)) { + ConstantIntegral *L = Max(Lower, CR.Lower, isSigned); + ConstantIntegral *U = Min(Upper, CR.Upper, isSigned); - if (LT(L, U)) // If range isn't empty... + if (LT(L, U, isSigned)) // If range isn't empty... return ConstantRange(L, U); else return ConstantRange(getType(), false); // Otherwise, return empty set } else - return intersect1Wrapped(CR, *this); + return intersect1Wrapped(CR, *this, isSigned); } else { // We know "this" is wrapped... - if (!CR.isWrappedSet()) - return intersect1Wrapped(*this, CR); + if (!CR.isWrappedSet(isSigned)) + return intersect1Wrapped(*this, CR, isSigned); else { // Both ranges are wrapped... - ConstantIntegral *L = Max(Lower, CR.Lower); - ConstantIntegral *U = Min(Upper, CR.Upper); + ConstantIntegral *L = Max(Lower, CR.Lower, isSigned); + ConstantIntegral *U = Min(Upper, CR.Upper, isSigned); return ConstantRange(L, U); } } @@ -315,7 +320,8 @@ /// 15), which includes 9, 10, and 11, which were not included in either set /// before. /// -ConstantRange ConstantRange::unionWith(const ConstantRange &CR) const { +ConstantRange ConstantRange::unionWith(const ConstantRange &CR, + bool isSigned) const { assert(getType() == CR.getType() && "ConstantRange types don't agree!"); assert(0 && "Range union not implemented yet!"); @@ -325,7 +331,7 @@ /// zeroExtend - Return a new range in the specified integer type, which must /// be strictly larger than the current type. The returned range will -/// correspond to the possible range of values if the source range had been +/// correspond to the possible range of values as if the source range had been /// zero extended. ConstantRange ConstantRange::zeroExtend(const Type *Ty) const { assert(getLower()->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() && @@ -346,7 +352,7 @@ /// truncate - Return a new range in the specified integer type, which must be /// strictly smaller than the current type. The returned range will -/// correspond to the possible range of values if the source range had been +/// correspond to the possible range of values as if the source range had been /// truncated to the specified type. ConstantRange ConstantRange::truncate(const Type *Ty) const { assert(getLower()->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() && @@ -360,7 +366,6 @@ ConstantExpr::getTrunc(getUpper(), Ty)); } - /// print - Print out the bounds to a stream... /// void ConstantRange::print(std::ostream &OS) const { Index: llvm/lib/Analysis/LoopInfo.cpp diff -u llvm/lib/Analysis/LoopInfo.cpp:1.81 llvm/lib/Analysis/LoopInfo.cpp:1.82 --- llvm/lib/Analysis/LoopInfo.cpp:1.81 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Analysis/LoopInfo.cpp Sat Dec 23 00:05:40 2006 @@ -536,7 +536,7 @@ /// returns null. /// Value *Loop::getTripCount() const { - // Canonical loops will end with a 'setne I, V', where I is the incremented + // Canonical loops will end with a 'cmp ne I, V', where I is the incremented // canonical induction variable and V is the trip count of the loop. Instruction *Inc = getCanonicalInductionVariableIncrement(); if (Inc == 0) return 0; @@ -546,15 +546,17 @@ IV->getIncomingBlock(contains(IV->getIncomingBlock(1))); if (BranchInst *BI = dyn_cast(BackedgeBlock->getTerminator())) - if (BI->isConditional()) - if (SetCondInst *SCI = dyn_cast(BI->getCondition())) - if (SCI->getOperand(0) == Inc) + if (BI->isConditional()) { + if (ICmpInst *ICI = dyn_cast(BI->getCondition())) { + if (ICI->getOperand(0) == Inc) if (BI->getSuccessor(0) == getHeader()) { - if (SCI->getOpcode() == Instruction::SetNE) - return SCI->getOperand(1); - } else if (SCI->getOpcode() == Instruction::SetEQ) { - return SCI->getOperand(1); + if (ICI->getPredicate() == ICmpInst::ICMP_NE) + return ICI->getOperand(1); + } else if (ICI->getPredicate() == ICmpInst::ICMP_EQ) { + return ICI->getOperand(1); } + } + } return 0; } Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.76 llvm/lib/Analysis/ScalarEvolution.cpp:1.77 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.76 Thu Dec 21 12:59:16 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Sat Dec 23 00:05:40 2006 @@ -177,8 +177,7 @@ // are signless. There won't be a need to bitcast then. if (V->getType()->isSigned()) { const Type *NewTy = V->getType()->getUnsignedVersion(); - V = cast( - ConstantExpr::getBitCast(V, NewTy)); + V = cast(ConstantExpr::getBitCast(V, NewTy)); } SCEVConstant *&R = (*SCEVConstants)[V]; @@ -461,15 +460,8 @@ C = Constant::getNullValue(Ty); else if (Ty->isFloatingPoint()) C = ConstantFP::get(Ty, Val); - /// FIXME:Signless. when integer types are signless, just change this to: - /// else - /// C = ConstantInt::get(Ty, Val); - else if (Ty->isSigned()) + else C = ConstantInt::get(Ty, Val); - else { - C = ConstantInt::get(Ty->getSignedVersion(), Val); - C = ConstantExpr::getBitCast(C, Ty); - } return SCEVUnknown::get(C); } @@ -514,8 +506,7 @@ for (; NumSteps; --NumSteps) Result *= Val-(NumSteps-1); Constant *Res = ConstantInt::get(Type::ULongTy, Result); - return SCEVUnknown::get( - ConstantExpr::getTruncOrBitCast(Res, V->getType())); + return SCEVUnknown::get(ConstantExpr::getTruncOrBitCast(Res, V->getType())); } const Type *Ty = V->getType(); @@ -1162,7 +1153,7 @@ SCEVHandle ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS, const Loop *L, - unsigned SetCCOpcode); + ICmpInst::Predicate p); /// ComputeIterationCountExhaustively - If the trip is known to execute a /// constant number of times (the condition evolves only from constants), @@ -1521,17 +1512,21 @@ BranchInst *ExitBr = dyn_cast(ExitingBlock->getTerminator()); if (ExitBr == 0) return UnknownValue; assert(ExitBr->isConditional() && "If unconditional, it can't be in loop!"); - SetCondInst *ExitCond = dyn_cast(ExitBr->getCondition()); - if (ExitCond == 0) // Not a setcc + ICmpInst *ExitCond = dyn_cast(ExitBr->getCondition()); + + // If its not an integer comparison then compute it the hard way. + // Note that ICmpInst deals with pointer comparisons too so we must check + // the type of the operand. + if (ExitCond == 0 || !ExitCond->getOperand(0)->getType()->isIntegral()) return ComputeIterationCountExhaustively(L, ExitBr->getCondition(), ExitBr->getSuccessor(0) == ExitBlock); - // If the condition was exit on true, convert the condition to exit on false. - Instruction::BinaryOps Cond; + // If the condition was exit on true, convert the condition to exit on false + ICmpInst::Predicate Cond; if (ExitBr->getSuccessor(1) == ExitBlock) - Cond = ExitCond->getOpcode(); + Cond = ExitCond->getPredicate(); else - Cond = ExitCond->getInverseCondition(); + Cond = ExitCond->getInversePredicate(); // Handle common loops like: for (X = "string"; *X; ++X) if (LoadInst *LI = dyn_cast(ExitCond->getOperand(0))) @@ -1550,12 +1545,12 @@ Tmp = getSCEVAtScope(RHS, L); if (!isa(Tmp)) RHS = Tmp; - // At this point, we would like to compute how many iterations of the loop the - // predicate will return true for these inputs. + // At this point, we would like to compute how many iterations of the + // loop the predicate will return true for these inputs. if (isa(LHS) && !isa(RHS)) { // If there is a constant, force it into the RHS. std::swap(LHS, RHS); - Cond = SetCondInst::getSwappedCondition(Cond); + Cond = ICmpInst::getSwappedPredicate(Cond); } // FIXME: think about handling pointer comparisons! i.e.: @@ -1590,53 +1585,48 @@ CompRange = ConstantRange(NewL, NewU); } - SCEVHandle Ret = AddRec->getNumIterationsInRange(CompRange); + SCEVHandle Ret = AddRec->getNumIterationsInRange(CompRange, + ICmpInst::isSignedPredicate(Cond)); if (!isa(Ret)) return Ret; } } switch (Cond) { - case Instruction::SetNE: // while (X != Y) + case ICmpInst::ICMP_NE: { // while (X != Y) // Convert to: while (X-Y != 0) - if (LHS->getType()->isInteger()) { - SCEVHandle TC = HowFarToZero(SCEV::getMinusSCEV(LHS, RHS), L); - if (!isa(TC)) return TC; - } + SCEVHandle TC = HowFarToZero(SCEV::getMinusSCEV(LHS, RHS), L); + if (!isa(TC)) return TC; break; - case Instruction::SetEQ: + } + case ICmpInst::ICMP_EQ: { // Convert to: while (X-Y == 0) // while (X == Y) - if (LHS->getType()->isInteger()) { - SCEVHandle TC = HowFarToNonZero(SCEV::getMinusSCEV(LHS, RHS), L); - if (!isa(TC)) return TC; - } + SCEVHandle TC = HowFarToNonZero(SCEV::getMinusSCEV(LHS, RHS), L); + if (!isa(TC)) return TC; break; - case Instruction::SetLT: - if (LHS->getType()->isInteger() && - ExitCond->getOperand(0)->getType()->isSigned()) { - SCEVHandle TC = HowManyLessThans(LHS, RHS, L); - if (!isa(TC)) return TC; - } + } + case ICmpInst::ICMP_SLT: { + SCEVHandle TC = HowManyLessThans(LHS, RHS, L); + if (!isa(TC)) return TC; break; - case Instruction::SetGT: - if (LHS->getType()->isInteger() && - ExitCond->getOperand(0)->getType()->isSigned()) { - SCEVHandle TC = HowManyLessThans(RHS, LHS, L); - if (!isa(TC)) return TC; - } + } + case ICmpInst::ICMP_SGT: { + SCEVHandle TC = HowManyLessThans(RHS, LHS, L); + if (!isa(TC)) return TC; break; + } default: #if 0 cerr << "ComputeIterationCount "; if (ExitCond->getOperand(0)->getType()->isUnsigned()) cerr << "[unsigned] "; cerr << *LHS << " " - << Instruction::getOpcodeName(Cond) << " " << *RHS << "\n"; + << Instruction::getOpcodeName(Instruction::ICmp) + << " " << *RHS << "\n"; #endif break; } - return ComputeIterationCountExhaustively(L, ExitCond, - ExitBr->getSuccessor(0) == ExitBlock); + ExitBr->getSuccessor(0) == ExitBlock); } static ConstantInt * @@ -1686,7 +1676,8 @@ /// 'setcc load X, cst', try to se if we can compute the trip count. SCEVHandle ScalarEvolutionsImpl:: ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS, - const Loop *L, unsigned SetCCOpcode) { + const Loop *L, + ICmpInst::Predicate predicate) { if (LI->isVolatile()) return UnknownValue; // Check to see if the loaded pointer is a getelementptr of a global. @@ -1742,7 +1733,7 @@ if (Result == 0) break; // Cannot compute! // Evaluate the condition for this iteration. - Result = ConstantExpr::get(SetCCOpcode, Result, RHS); + Result = ConstantExpr::getICmp(predicate, Result, RHS); if (!isa(Result)) break; // Couldn't decide for sure if (cast(Result)->getValue() == false) { #if 0 @@ -1761,7 +1752,7 @@ /// CanConstantFold - Return true if we can constant fold an instruction of the /// specified type, assuming that all operands were constants. static bool CanConstantFold(const Instruction *I) { - if (isa(I) || isa(I) || + if (isa(I) || isa(I) || isa(I) || isa(I) || isa(I) || isa(I)) return true; @@ -1790,11 +1781,18 @@ return ConstantFoldCall(cast(GV), Operands); } return 0; - case Instruction::GetElementPtr: + case Instruction::GetElementPtr: { Constant *Base = Operands[0]; Operands.erase(Operands.begin()); return ConstantExpr::getGetElementPtr(Base, Operands); } + case Instruction::ICmp: + return ConstantExpr::getICmp( + cast(I)->getPredicate(), Operands[0], Operands[1]); + case Instruction::FCmp: + return ConstantExpr::getFCmp( + cast(I)->getPredicate(), Operands[0], Operands[1]); + } return 0; } @@ -2226,8 +2224,8 @@ // Pick the smallest positive root value. assert(R1->getType()->isUnsigned()&&"Didn't canonicalize to unsigned?"); if (ConstantBool *CB = - dyn_cast(ConstantExpr::getSetLT(R1->getValue(), - R2->getValue()))) { + dyn_cast(ConstantExpr::getICmp(ICmpInst::ICMP_ULT, + R1->getValue(), R2->getValue()))) { if (CB->getValue() == false) std::swap(R1, R2); // R1 is the minimum root now. @@ -2257,7 +2255,8 @@ // already. If so, the backedge will execute zero times. if (SCEVConstant *C = dyn_cast(V)) { Constant *Zero = Constant::getNullValue(C->getValue()->getType()); - Constant *NonZero = ConstantExpr::getSetNE(C->getValue(), Zero); + Constant *NonZero = + ConstantExpr::getICmp(ICmpInst::ICMP_NE, C->getValue(), Zero); if (NonZero == ConstantBool::getTrue()) return getSCEV(Zero); return UnknownValue; // Otherwise it will loop infinitely. @@ -2318,40 +2317,46 @@ // Now that we found a conditional branch that dominates the loop, check to // see if it is the comparison we are looking for. - SetCondInst *SCI =dyn_cast(LoopEntryPredicate->getCondition()); - if (!SCI) return UnknownValue; - Value *PreCondLHS = SCI->getOperand(0); - Value *PreCondRHS = SCI->getOperand(1); - Instruction::BinaryOps Cond; - if (LoopEntryPredicate->getSuccessor(0) == PreheaderDest) - Cond = SCI->getOpcode(); - else - Cond = SCI->getInverseCondition(); + if (ICmpInst *ICI = dyn_cast(LoopEntryPredicate->getCondition())){ + Value *PreCondLHS = ICI->getOperand(0); + Value *PreCondRHS = ICI->getOperand(1); + ICmpInst::Predicate Cond; + if (LoopEntryPredicate->getSuccessor(0) == PreheaderDest) + Cond = ICI->getPredicate(); + else + Cond = ICI->getInversePredicate(); - switch (Cond) { - case Instruction::SetGT: - std::swap(PreCondLHS, PreCondRHS); - Cond = Instruction::SetLT; - // Fall Through. - case Instruction::SetLT: - if (PreCondLHS->getType()->isInteger() && - PreCondLHS->getType()->isSigned()) { - if (RHS != getSCEV(PreCondRHS)) - return UnknownValue; // Not a comparison against 'm'. - - if (SCEV::getMinusSCEV(AddRec->getOperand(0), One) - != getSCEV(PreCondLHS)) - return UnknownValue; // Not a comparison against 'n-1'. + switch (Cond) { + case ICmpInst::ICMP_UGT: + std::swap(PreCondLHS, PreCondRHS); + Cond = ICmpInst::ICMP_ULT; break; - } else { - return UnknownValue; + case ICmpInst::ICMP_SGT: + std::swap(PreCondLHS, PreCondRHS); + Cond = ICmpInst::ICMP_SLT; + break; + default: break; } - default: break; - } - //cerr << "Computed Loop Trip Count as: " - // << *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n"; - return SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)); + if (Cond == ICmpInst::ICMP_SLT) { + if (PreCondLHS->getType()->isInteger()) { + if (RHS != getSCEV(PreCondRHS)) + return UnknownValue; // Not a comparison against 'm'. + + if (SCEV::getMinusSCEV(AddRec->getOperand(0), One) + != getSCEV(PreCondLHS)) + return UnknownValue; // Not a comparison against 'n-1'. + } + else return UnknownValue; + } else if (Cond == ICmpInst::ICMP_ULT) + return UnknownValue; + + // cerr << "Computed Loop Trip Count as: " + // << // *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n"; + return SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)); + } + else + return UnknownValue; } return UnknownValue; @@ -2362,7 +2367,8 @@ /// this is that it returns the first iteration number where the value is not in /// the condition, thus computing the exit count. If the iteration count can't /// be computed, an instance of SCEVCouldNotCompute is returned. -SCEVHandle SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range) const { +SCEVHandle SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range, + bool isSigned) const { if (Range.isFullSet()) // Infinite loop. return new SCEVCouldNotCompute(); @@ -2374,7 +2380,7 @@ SCEVHandle Shifted = SCEVAddRecExpr::get(Operands, getLoop()); if (SCEVAddRecExpr *ShiftedAddRec = dyn_cast(Shifted)) return ShiftedAddRec->getNumIterationsInRange( - Range.subtract(SC->getValue())); + Range.subtract(SC->getValue()),isSigned); // This is strange and shouldn't happen. return new SCEVCouldNotCompute(); } @@ -2392,7 +2398,7 @@ // First check to see if the range contains zero. If not, the first // iteration exits. ConstantInt *Zero = ConstantInt::get(getType(), 0); - if (!Range.contains(Zero)) return SCEVConstant::get(Zero); + if (!Range.contains(Zero, isSigned)) return SCEVConstant::get(Zero); if (isAffine()) { // If this is an affine expression then we have this situation: @@ -2418,12 +2424,12 @@ // range, then we computed our trip count, otherwise wrap around or other // things must have happened. ConstantInt *Val = EvaluateConstantChrecAtConstant(this, ExitValue); - if (Range.contains(Val)) + if (Range.contains(Val, isSigned)) return new SCEVCouldNotCompute(); // Something strange happened // Ensure that the previous value is in the range. This is a sanity check. assert(Range.contains(EvaluateConstantChrecAtConstant(this, - ConstantExpr::getSub(ExitValue, One))) && + ConstantExpr::getSub(ExitValue, One)), isSigned) && "Linear scev computation is off in a bad way!"); return SCEVConstant::get(cast(ExitValue)); } else if (isQuadratic()) { @@ -2444,8 +2450,8 @@ // Pick the smallest positive root value. assert(R1->getType()->isUnsigned() && "Didn't canonicalize to unsigned?"); if (ConstantBool *CB = - dyn_cast(ConstantExpr::getSetLT(R1->getValue(), - R2->getValue()))) { + dyn_cast(ConstantExpr::getICmp(ICmpInst::ICMP_ULT, + R1->getValue(), R2->getValue()))) { if (CB->getValue() == false) std::swap(R1, R2); // R1 is the minimum root now. @@ -2454,14 +2460,14 @@ // for "X*X < 5", for example, we should not return a root of 2. ConstantInt *R1Val = EvaluateConstantChrecAtConstant(this, R1->getValue()); - if (Range.contains(R1Val)) { + if (Range.contains(R1Val, isSigned)) { // The next iteration must be out of the range... Constant *NextVal = ConstantExpr::getAdd(R1->getValue(), ConstantInt::get(R1->getType(), 1)); R1Val = EvaluateConstantChrecAtConstant(this, NextVal); - if (!Range.contains(R1Val)) + if (!Range.contains(R1Val, isSigned)) return SCEVUnknown::get(NextVal); return new SCEVCouldNotCompute(); // Something strange happened } @@ -2472,7 +2478,7 @@ ConstantExpr::getSub(R1->getValue(), ConstantInt::get(R1->getType(), 1)); R1Val = EvaluateConstantChrecAtConstant(this, NextVal); - if (Range.contains(R1Val)) + if (Range.contains(R1Val, isSigned)) return R1; return new SCEVCouldNotCompute(); // Something strange happened } @@ -2494,7 +2500,7 @@ return new SCEVCouldNotCompute(); // Check to see if we found the value! - if (!Range.contains(cast(Val)->getValue())) + if (!Range.contains(cast(Val)->getValue(), isSigned)) return SCEVConstant::get(TestVal); // Increment to test the next index. Index: llvm/lib/Analysis/ValueNumbering.cpp diff -u llvm/lib/Analysis/ValueNumbering.cpp:1.23 llvm/lib/Analysis/ValueNumbering.cpp:1.24 --- llvm/lib/Analysis/ValueNumbering.cpp:1.23 Sun Nov 26 19:05:09 2006 +++ llvm/lib/Analysis/ValueNumbering.cpp Sat Dec 23 00:05:40 2006 @@ -161,6 +161,11 @@ I1.getParent()->getParent() != I2->getParent()->getParent()) return false; + // If they are CmpInst instructions, check their predicates + if (CmpInst *CI1 = dyn_cast(&const_cast(I1))) + if (CI1->getPredicate() != cast(I2)->getPredicate()) + return false; + // They are identical if both operands are the same! if (I1.getOperand(0) == I2->getOperand(0) && I1.getOperand(1) == I2->getOperand(1)) From reid at x10sys.com Sat Dec 23 00:06:59 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp IndVarSimplify.cpp InstructionCombining.cpp LICM.cpp LoopStrengthReduce.cpp LoopUnswitch.cpp LowerPacked.cpp PredicateSimplifier.cpp Reassociate.cpp SCCP.cpp ScalarReplAggregates.cpp Message-ID: <200612230606.kBN66xHK022111@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp updated: 1.41 -> 1.42 IndVarSimplify.cpp updated: 1.98 -> 1.99 InstructionCombining.cpp updated: 1.572 -> 1.573 LICM.cpp updated: 1.83 -> 1.84 LoopStrengthReduce.cpp updated: 1.101 -> 1.102 LoopUnswitch.cpp updated: 1.52 -> 1.53 LowerPacked.cpp updated: 1.13 -> 1.14 PredicateSimplifier.cpp updated: 1.39 -> 1.40 Reassociate.cpp updated: 1.69 -> 1.70 SCCP.cpp updated: 1.143 -> 1.144 ScalarReplAggregates.cpp updated: 1.60 -> 1.61 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+1679 -919) CorrelatedExprs.cpp | 376 +++++++--- IndVarSimplify.cpp | 10 InstructionCombining.cpp | 1698 ++++++++++++++++++++++++++++------------------- LICM.cpp | 2 LoopStrengthReduce.cpp | 17 LoopUnswitch.cpp | 7 LowerPacked.cpp | 43 + PredicateSimplifier.cpp | 344 ++++++--- Reassociate.cpp | 9 SCCP.cpp | 88 ++ ScalarReplAggregates.cpp | 4 11 files changed, 1679 insertions(+), 919 deletions(-) Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.41 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.42 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.41 Tue Dec 19 15:40:18 2006 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Sat Dec 23 00:05:41 2006 @@ -45,36 +45,36 @@ #include using namespace llvm; -STATISTIC(NumSetCCRemoved, "Number of setcc instruction eliminated"); +STATISTIC(NumCmpRemoved, "Number of cmp instruction eliminated"); STATISTIC(NumOperandsCann, "Number of operands canonicalized"); STATISTIC(BranchRevectors, "Number of branches revectored"); namespace { class ValueInfo; class Relation { - Value *Val; // Relation to what value? - Instruction::BinaryOps Rel; // SetCC relation, or Add if no information + Value *Val; // Relation to what value? + unsigned Rel; // SetCC or ICmp relation, or Add if no information public: Relation(Value *V) : Val(V), Rel(Instruction::Add) {} bool operator<(const Relation &R) const { return Val < R.Val; } Value *getValue() const { return Val; } - Instruction::BinaryOps getRelation() const { return Rel; } + unsigned getRelation() const { return Rel; } // contradicts - Return true if the relationship specified by the operand // contradicts already known information. // - bool contradicts(Instruction::BinaryOps Rel, const ValueInfo &VI) const; + bool contradicts(unsigned Rel, const ValueInfo &VI) const; // incorporate - Incorporate information in the argument into this relation // entry. This assumes that the information doesn't contradict itself. If // any new information is gained, true is returned, otherwise false is // returned to indicate that nothing was updated. // - bool incorporate(Instruction::BinaryOps Rel, ValueInfo &VI); + bool incorporate(unsigned Rel, ValueInfo &VI); // KnownResult - Whether or not this condition determines the result of a - // setcc in the program. False & True are intentionally 0 & 1 so we can - // convert to bool by casting after checking for unknown. + // setcc or icmp in the program. False & True are intentionally 0 & 1 + // so we can convert to bool by casting after checking for unknown. // enum KnownResult { KnownFalse = 0, KnownTrue = 1, Unknown = 2 }; @@ -82,7 +82,7 @@ // the specified relationship is true or false, return that. If we cannot // determine the result required, return Unknown. // - KnownResult getImpliedResult(Instruction::BinaryOps Rel) const; + KnownResult getImpliedResult(unsigned Rel) const; // print - Output this relation to the specified stream void print(std::ostream &OS) const; @@ -269,19 +269,16 @@ void PropagateBranchInfo(BranchInst *BI); void PropagateSwitchInfo(SwitchInst *SI); void PropagateEquality(Value *Op0, Value *Op1, RegionInfo &RI); - void PropagateRelation(Instruction::BinaryOps Opcode, Value *Op0, + void PropagateRelation(unsigned Opcode, Value *Op0, Value *Op1, RegionInfo &RI); void UpdateUsersOfValue(Value *V, RegionInfo &RI); void IncorporateInstruction(Instruction *Inst, RegionInfo &RI); void ComputeReplacements(RegionInfo &RI); - - // getSetCCResult - Given a setcc instruction, determine if the result is + // getCmpResult - Given a icmp instruction, determine if the result is // determined by facts we already know about the region under analysis. - // Return KnownTrue, KnownFalse, or Unknown based on what we can determine. - // - Relation::KnownResult getSetCCResult(SetCondInst *SC, const RegionInfo &RI); - + // Return KnownTrue, KnownFalse, or UnKnown based on what we can determine. + Relation::KnownResult getCmpResult(CmpInst *ICI, const RegionInfo &RI); bool SimplifyBasicBlock(BasicBlock &BB, const RegionInfo &RI); bool SimplifyInstruction(Instruction *Inst, const RegionInfo &RI); @@ -448,12 +445,12 @@ return false; // We can only forward the branch over the block if the block ends with a - // setcc we can determine the outcome for. + // cmp we can determine the outcome for. // // FIXME: we can make this more generic. Code below already handles more // generic case. - SetCondInst *SCI = dyn_cast(BI->getCondition()); - if (SCI == 0) return false; + if (!isa(BI->getCondition())) + return false; // Make a new RegionInfo structure so that we can simulate the effect of the // PHI nodes in the block we are skipping over... @@ -472,10 +469,10 @@ int OpNum = PN->getBasicBlockIndex(BB); assert(OpNum != -1 && "PHI doesn't have incoming edge for predecessor!?"); PropagateEquality(PN, PN->getIncomingValue(OpNum), NewRI); - } else if (SetCondInst *SCI = dyn_cast(I)) { - Relation::KnownResult Res = getSetCCResult(SCI, NewRI); + } else if (CmpInst *CI = dyn_cast(I)) { + Relation::KnownResult Res = getCmpResult(CI, NewRI); if (Res == Relation::Unknown) return false; - PropagateEquality(SCI, ConstantBool::get(Res), NewRI); + PropagateEquality(CI, ConstantBool::get(Res), NewRI); } else { assert(isa(*I) && "Unexpected instruction type!"); } @@ -827,7 +824,8 @@ Relation &KnownRelation = VI.getRelation(Op1); // If we already know they're equal, don't reprocess... - if (KnownRelation.getRelation() == Instruction::SetEQ) + if (KnownRelation.getRelation() == FCmpInst::FCMP_OEQ || + KnownRelation.getRelation() == ICmpInst::ICMP_EQ) return; // If this is boolean, check to see if one of the operands is a constant. If @@ -863,32 +861,55 @@ PropagateEquality(BinaryOperator::getNotArgument(BOp), ConstantBool::get(!CB->getValue()), RI); - // If we know the value of a SetCC instruction, propagate the information + // If we know the value of a FCmp instruction, propagate the information // about the relation into this region as well. // - if (SetCondInst *SCI = dyn_cast(Inst)) { + if (FCmpInst *FCI = dyn_cast(Inst)) { if (CB->getValue()) { // If we know the condition is true... // Propagate info about the LHS to the RHS & RHS to LHS - PropagateRelation(SCI->getOpcode(), SCI->getOperand(0), - SCI->getOperand(1), RI); - PropagateRelation(SCI->getSwappedCondition(), - SCI->getOperand(1), SCI->getOperand(0), RI); + PropagateRelation(FCI->getPredicate(), FCI->getOperand(0), + FCI->getOperand(1), RI); + PropagateRelation(FCI->getSwappedPredicate(), + FCI->getOperand(1), FCI->getOperand(0), RI); } else { // If we know the condition is false... // We know the opposite of the condition is true... - Instruction::BinaryOps C = SCI->getInverseCondition(); + FCmpInst::Predicate C = FCI->getInversePredicate(); - PropagateRelation(C, SCI->getOperand(0), SCI->getOperand(1), RI); - PropagateRelation(SetCondInst::getSwappedCondition(C), - SCI->getOperand(1), SCI->getOperand(0), RI); + PropagateRelation(C, FCI->getOperand(0), FCI->getOperand(1), RI); + PropagateRelation(FCmpInst::getSwappedPredicate(C), + FCI->getOperand(1), FCI->getOperand(0), RI); + } + } + + // If we know the value of a ICmp instruction, propagate the information + // about the relation into this region as well. + // + if (ICmpInst *ICI = dyn_cast(Inst)) { + if (CB->getValue()) { // If we know the condition is true... + // Propagate info about the LHS to the RHS & RHS to LHS + PropagateRelation(ICI->getPredicate(), ICI->getOperand(0), + ICI->getOperand(1), RI); + PropagateRelation(ICI->getSwappedPredicate(), ICI->getOperand(1), + ICI->getOperand(1), RI); + + } else { // If we know the condition is false ... + // We know the opposite of the condition is true... + ICmpInst::Predicate C = ICI->getInversePredicate(); + + PropagateRelation(C, ICI->getOperand(0), ICI->getOperand(1), RI); + PropagateRelation(ICmpInst::getSwappedPredicate(C), + ICI->getOperand(1), ICI->getOperand(0), RI); } } } } // Propagate information about Op0 to Op1 & visa versa - PropagateRelation(Instruction::SetEQ, Op0, Op1, RI); - PropagateRelation(Instruction::SetEQ, Op1, Op0, RI); + PropagateRelation(ICmpInst::ICMP_EQ, Op0, Op1, RI); + PropagateRelation(ICmpInst::ICMP_EQ, Op1, Op0, RI); + PropagateRelation(FCmpInst::FCMP_OEQ, Op0, Op1, RI); + PropagateRelation(FCmpInst::FCMP_OEQ, Op1, Op0, RI); } @@ -896,7 +917,7 @@ // blocks in the specified region. Propagate the information about Op0 and // anything derived from it into this region. // -void CEE::PropagateRelation(Instruction::BinaryOps Opcode, Value *Op0, +void CEE::PropagateRelation(unsigned Opcode, Value *Op0, Value *Op1, RegionInfo &RI) { assert(Op0->getType() == Op1->getType() && "Equal types expected!"); @@ -921,7 +942,10 @@ if (Op1R.contradicts(Opcode, VI)) { Op1R.contradicts(Opcode, VI); cerr << "Contradiction found for opcode: " - << Instruction::getOpcodeName(Opcode) << "\n"; + << ((isa(Op0)||isa(Op1)) ? + Instruction::getOpcodeName(Instruction::ICmp) : + Instruction::getOpcodeName(Opcode)) + << "\n"; Op1R.print(*cerr.stream()); return; } @@ -964,11 +988,11 @@ // value produced by this instruction // void CEE::IncorporateInstruction(Instruction *Inst, RegionInfo &RI) { - if (SetCondInst *SCI = dyn_cast(Inst)) { + if (CmpInst *CI = dyn_cast(Inst)) { // See if we can figure out a result for this instruction... - Relation::KnownResult Result = getSetCCResult(SCI, RI); + Relation::KnownResult Result = getCmpResult(CI, RI); if (Result != Relation::Unknown) { - PropagateEquality(SCI, ConstantBool::get(Result != 0), RI); + PropagateEquality(CI, ConstantBool::get(Result != 0), RI); } } } @@ -1002,7 +1026,14 @@ // Loop over the relationships known about Op0. const std::vector &Relationships = VI.getRelationships(); for (unsigned i = 0, e = Relationships.size(); i != e; ++i) - if (Relationships[i].getRelation() == Instruction::SetEQ) { + if (Relationships[i].getRelation() == FCmpInst::FCMP_OEQ) { + unsigned R = getRank(Relationships[i].getValue()); + if (R < MinRank) { + MinRank = R; + Replacement = Relationships[i].getValue(); + } + } + else if (Relationships[i].getRelation() == ICmpInst::ICMP_EQ) { unsigned R = getRank(Relationships[i].getValue()); if (R < MinRank) { MinRank = R; @@ -1028,16 +1059,17 @@ // Convert instruction arguments to canonical forms... Changed |= SimplifyInstruction(Inst, RI); - if (SetCondInst *SCI = dyn_cast(Inst)) { + if (CmpInst *CI = dyn_cast(Inst)) { // Try to simplify a setcc instruction based on inherited information - Relation::KnownResult Result = getSetCCResult(SCI, RI); + Relation::KnownResult Result = getCmpResult(CI, RI); if (Result != Relation::Unknown) { - DOUT << "Replacing setcc with " << Result << " constant: " << *SCI; + DEBUG(cerr << "Replacing icmp with " << Result + << " constant: " << *CI); - SCI->replaceAllUsesWith(ConstantBool::get((bool)Result)); + CI->replaceAllUsesWith(ConstantBool::get((bool)Result)); // The instruction is now dead, remove it from the program. - SCI->getParent()->getInstList().erase(SCI); - ++NumSetCCRemoved; + CI->getParent()->getInstList().erase(CI); + ++NumCmpRemoved; Changed = true; } } @@ -1069,33 +1101,35 @@ return Changed; } - -// getSetCCResult - Try to simplify a setcc instruction based on information -// inherited from a dominating setcc instruction. V is one of the operands to -// the setcc instruction, and VI is the set of information known about it. We +// getCmpResult - Try to simplify a cmp instruction based on information +// inherited from a dominating icmp instruction. V is one of the operands to +// the icmp instruction, and VI is the set of information known about it. We // take two cases into consideration here. If the comparison is against a // constant value, we can use the constant range to see if the comparison is // possible to succeed. If it is not a comparison against a constant, we check // to see if there is a known relationship between the two values. If so, we // may be able to eliminate the check. // -Relation::KnownResult CEE::getSetCCResult(SetCondInst *SCI, - const RegionInfo &RI) { - Value *Op0 = SCI->getOperand(0), *Op1 = SCI->getOperand(1); - Instruction::BinaryOps Opcode = SCI->getOpcode(); +Relation::KnownResult CEE::getCmpResult(CmpInst *CI, + const RegionInfo &RI) { + Value *Op0 = CI->getOperand(0), *Op1 = CI->getOperand(1); + unsigned short predicate = CI->getPredicate(); if (isa(Op0)) { if (isa(Op1)) { - if (Constant *Result = ConstantFoldInstruction(SCI)) { - // Wow, this is easy, directly eliminate the SetCondInst. - DOUT << "Replacing setcc with constant fold: " << *SCI; + if (Constant *Result = ConstantFoldInstruction(CI)) { + // Wow, this is easy, directly eliminate the ICmpInst. + DEBUG(cerr << "Replacing cmp with constant fold: " << *CI); return cast(Result)->getValue() ? Relation::KnownTrue : Relation::KnownFalse; } } else { // We want to swap this instruction so that operand #0 is the constant. std::swap(Op0, Op1); - Opcode = SCI->getSwappedCondition(); + if (isa(CI)) + predicate = cast(CI)->getSwappedPredicate(); + else + predicate = cast(CI)->getSwappedPredicate(); } } @@ -1107,12 +1141,13 @@ // At this point, we know that if we have a constant argument that it is in // Op1. Check to see if we know anything about comparing value with a - // constant, and if we can use this info to fold the setcc. + // constant, and if we can use this info to fold the icmp. // if (ConstantIntegral *C = dyn_cast(Op1)) { // Check to see if we already know the result of this comparison... - ConstantRange R = ConstantRange(Opcode, C); - ConstantRange Int = R.intersectWith(Op0VI->getBounds()); + ConstantRange R = ConstantRange(predicate, C); + ConstantRange Int = R.intersectWith(Op0VI->getBounds(), + ICmpInst::isSignedPredicate(ICmpInst::Predicate(predicate))); // If the intersection of the two ranges is empty, then the condition // could never be true! @@ -1134,7 +1169,7 @@ // // Do we have value information about Op0 and a relation to Op1? if (const Relation *Op2R = Op0VI->requestRelation(Op1)) - Result = Op2R->getImpliedResult(Opcode); + Result = Op2R->getImpliedResult(predicate); } } return Result; @@ -1147,7 +1182,7 @@ // contradicts - Return true if the relationship specified by the operand // contradicts already known information. // -bool Relation::contradicts(Instruction::BinaryOps Op, +bool Relation::contradicts(unsigned Op, const ValueInfo &VI) const { assert (Op != Instruction::Add && "Invalid relation argument!"); @@ -1155,24 +1190,48 @@ // does not contradict properties known about the bounds of the constant. // if (ConstantIntegral *C = dyn_cast(Val)) - if (ConstantRange(Op, C).intersectWith(VI.getBounds()).isEmptySet()) - return true; + if (Op >= ICmpInst::FIRST_ICMP_PREDICATE && + Op <= ICmpInst::LAST_ICMP_PREDICATE) + if (ConstantRange(Op, C).intersectWith(VI.getBounds(), + ICmpInst::isSignedPredicate(ICmpInst::Predicate(Op))).isEmptySet()) + return true; switch (Rel) { default: assert(0 && "Unknown Relationship code!"); case Instruction::Add: return false; // Nothing known, nothing contradicts - case Instruction::SetEQ: - return Op == Instruction::SetLT || Op == Instruction::SetGT || - Op == Instruction::SetNE; - case Instruction::SetNE: return Op == Instruction::SetEQ; - case Instruction::SetLE: return Op == Instruction::SetGT; - case Instruction::SetGE: return Op == Instruction::SetLT; - case Instruction::SetLT: - return Op == Instruction::SetEQ || Op == Instruction::SetGT || - Op == Instruction::SetGE; - case Instruction::SetGT: - return Op == Instruction::SetEQ || Op == Instruction::SetLT || - Op == Instruction::SetLE; + case ICmpInst::ICMP_EQ: + return Op == ICmpInst::ICMP_ULT || Op == ICmpInst::ICMP_SLT || + Op == ICmpInst::ICMP_UGT || Op == ICmpInst::ICMP_SGT || + Op == ICmpInst::ICMP_NE; + case ICmpInst::ICMP_NE: return Op == ICmpInst::ICMP_EQ; + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: return Op == ICmpInst::ICMP_UGT || + Op == ICmpInst::ICMP_SGT; + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: return Op == ICmpInst::ICMP_ULT || + Op == ICmpInst::ICMP_SLT; + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + return Op == ICmpInst::ICMP_EQ || Op == ICmpInst::ICMP_UGT || + Op == ICmpInst::ICMP_SGT || Op == ICmpInst::ICMP_UGE || + Op == ICmpInst::ICMP_SGE; + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + return Op == ICmpInst::ICMP_EQ || Op == ICmpInst::ICMP_ULT || + Op == ICmpInst::ICMP_SLT || Op == ICmpInst::ICMP_ULE || + Op == ICmpInst::ICMP_SLE; + case FCmpInst::FCMP_OEQ: + return Op == FCmpInst::FCMP_OLT || Op == FCmpInst::FCMP_OGT || + Op == FCmpInst::FCMP_ONE; + case FCmpInst::FCMP_ONE: return Op == FCmpInst::FCMP_OEQ; + case FCmpInst::FCMP_OLE: return Op == FCmpInst::FCMP_OGT; + case FCmpInst::FCMP_OGE: return Op == FCmpInst::FCMP_OLT; + case FCmpInst::FCMP_OLT: + return Op == FCmpInst::FCMP_OEQ || Op == FCmpInst::FCMP_OGT || + Op == FCmpInst::FCMP_OGE; + case FCmpInst::FCMP_OGT: + return Op == FCmpInst::FCMP_OEQ || Op == FCmpInst::FCMP_OLT || + Op == FCmpInst::FCMP_OLE; } } @@ -1181,7 +1240,7 @@ // new information is gained, true is returned, otherwise false is returned to // indicate that nothing was updated. // -bool Relation::incorporate(Instruction::BinaryOps Op, ValueInfo &VI) { +bool Relation::incorporate(unsigned Op, ValueInfo &VI) { assert(!contradicts(Op, VI) && "Cannot incorporate contradictory information!"); @@ -1189,30 +1248,64 @@ // range that is possible for the value to have... // if (ConstantIntegral *C = dyn_cast(Val)) - VI.getBounds() = ConstantRange(Op, C).intersectWith(VI.getBounds()); + if (Op >= ICmpInst::FIRST_ICMP_PREDICATE && + Op <= ICmpInst::LAST_ICMP_PREDICATE) + VI.getBounds() = ConstantRange(Op, C).intersectWith(VI.getBounds(), + ICmpInst::isSignedPredicate(ICmpInst::Predicate(Op))); switch (Rel) { default: assert(0 && "Unknown prior value!"); case Instruction::Add: Rel = Op; return true; - case Instruction::SetEQ: return false; // Nothing is more precise - case Instruction::SetNE: return false; // Nothing is more precise - case Instruction::SetLT: return false; // Nothing is more precise - case Instruction::SetGT: return false; // Nothing is more precise - case Instruction::SetLE: - if (Op == Instruction::SetEQ || Op == Instruction::SetLT) { + case ICmpInst::ICMP_EQ: + case ICmpInst::ICMP_NE: + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: return false; // Nothing is more precise + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: + if (Op == ICmpInst::ICMP_EQ || Op == ICmpInst::ICMP_ULT || + Op == ICmpInst::ICMP_SLT) { Rel = Op; return true; - } else if (Op == Instruction::SetNE) { - Rel = Instruction::SetLT; + } else if (Op == ICmpInst::ICMP_NE) { + Rel = Rel == ICmpInst::ICMP_ULE ? ICmpInst::ICMP_ULT : + ICmpInst::ICMP_SLT; return true; } return false; - case Instruction::SetGE: return Op == Instruction::SetLT; - if (Op == Instruction::SetEQ || Op == Instruction::SetGT) { + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + if (Op == ICmpInst::ICMP_EQ || ICmpInst::ICMP_UGT || + Op == ICmpInst::ICMP_SGT) { Rel = Op; return true; - } else if (Op == Instruction::SetNE) { - Rel = Instruction::SetGT; + } else if (Op == ICmpInst::ICMP_NE) { + Rel = Rel == ICmpInst::ICMP_UGE ? ICmpInst::ICMP_UGT : + ICmpInst::ICMP_SGT; + return true; + } + return false; + case FCmpInst::FCMP_OEQ: return false; // Nothing is more precise + case FCmpInst::FCMP_ONE: return false; // Nothing is more precise + case FCmpInst::FCMP_OLT: return false; // Nothing is more precise + case FCmpInst::FCMP_OGT: return false; // Nothing is more precise + case FCmpInst::FCMP_OLE: + if (Op == FCmpInst::FCMP_OEQ || Op == FCmpInst::FCMP_OLT) { + Rel = Op; + return true; + } else if (Op == FCmpInst::FCMP_ONE) { + Rel = FCmpInst::FCMP_OLT; + return true; + } + return false; + case FCmpInst::FCMP_OGE: + return Op == FCmpInst::FCMP_OLT; + if (Op == FCmpInst::FCMP_OEQ || Op == FCmpInst::FCMP_OGT) { + Rel = Op; + return true; + } else if (Op == FCmpInst::FCMP_ONE) { + Rel = FCmpInst::FCMP_OGT; return true; } return false; @@ -1224,28 +1317,67 @@ // determine the result required, return Unknown. // Relation::KnownResult -Relation::getImpliedResult(Instruction::BinaryOps Op) const { +Relation::getImpliedResult(unsigned Op) const { if (Rel == Op) return KnownTrue; - if (Rel == SetCondInst::getInverseCondition(Op)) return KnownFalse; + if (Op >= ICmpInst::FIRST_ICMP_PREDICATE && + Op <= ICmpInst::LAST_ICMP_PREDICATE) { + if (Rel == unsigned(ICmpInst::getInversePredicate(ICmpInst::Predicate(Op)))) + return KnownFalse; + } else if (Op <= FCmpInst::LAST_FCMP_PREDICATE) { + if (Rel == unsigned(FCmpInst::getInversePredicate(FCmpInst::Predicate(Op)))) + return KnownFalse; + } switch (Rel) { default: assert(0 && "Unknown prior value!"); - case Instruction::SetEQ: - if (Op == Instruction::SetLE || Op == Instruction::SetGE) return KnownTrue; - if (Op == Instruction::SetLT || Op == Instruction::SetGT) return KnownFalse; + case ICmpInst::ICMP_EQ: + if (Op == ICmpInst::ICMP_ULE || Op == ICmpInst::ICMP_SLE || + Op == ICmpInst::ICMP_UGE || Op == ICmpInst::ICMP_SGE) return KnownTrue; + if (Op == ICmpInst::ICMP_ULT || Op == ICmpInst::ICMP_SLT || + Op == ICmpInst::ICMP_UGT || Op == ICmpInst::ICMP_SGT) return KnownFalse; + break; + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + if (Op == ICmpInst::ICMP_ULE || Op == ICmpInst::ICMP_SLE || + Op == ICmpInst::ICMP_NE) return KnownTrue; + if (Op == ICmpInst::ICMP_EQ) return KnownFalse; + break; + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + if (Op == ICmpInst::ICMP_UGE || Op == ICmpInst::ICMP_SGE || + Op == ICmpInst::ICMP_NE) return KnownTrue; + if (Op == ICmpInst::ICMP_EQ) return KnownFalse; + break; + case FCmpInst::FCMP_OEQ: + if (Op == FCmpInst::FCMP_OLE || Op == FCmpInst::FCMP_OGE) return KnownTrue; + if (Op == FCmpInst::FCMP_OLT || Op == FCmpInst::FCMP_OGT) return KnownFalse; break; - case Instruction::SetLT: - if (Op == Instruction::SetNE || Op == Instruction::SetLE) return KnownTrue; - if (Op == Instruction::SetEQ) return KnownFalse; + case FCmpInst::FCMP_OLT: + if (Op == FCmpInst::FCMP_ONE || Op == FCmpInst::FCMP_OLE) return KnownTrue; + if (Op == FCmpInst::FCMP_OEQ) return KnownFalse; break; - case Instruction::SetGT: - if (Op == Instruction::SetNE || Op == Instruction::SetGE) return KnownTrue; - if (Op == Instruction::SetEQ) return KnownFalse; + case FCmpInst::FCMP_OGT: + if (Op == FCmpInst::FCMP_ONE || Op == FCmpInst::FCMP_OGE) return KnownTrue; + if (Op == FCmpInst::FCMP_OEQ) return KnownFalse; break; - case Instruction::SetNE: - case Instruction::SetLE: - case Instruction::SetGE: - case Instruction::Add: + case ICmpInst::ICMP_NE: + case ICmpInst::ICMP_SLE: + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + case FCmpInst::FCMP_ONE: + case FCmpInst::FCMP_OLE: + case FCmpInst::FCMP_OGE: + case FCmpInst::FCMP_FALSE: + case FCmpInst::FCMP_ORD: + case FCmpInst::FCMP_UNO: + case FCmpInst::FCMP_UEQ: + case FCmpInst::FCMP_UGT: + case FCmpInst::FCMP_UGE: + case FCmpInst::FCMP_ULT: + case FCmpInst::FCMP_ULE: + case FCmpInst::FCMP_UNE: + case FCmpInst::FCMP_TRUE: break; } return Unknown; @@ -1298,12 +1430,30 @@ OS << " is "; switch (Rel) { default: OS << "*UNKNOWN*"; break; - case Instruction::SetEQ: OS << "== "; break; - case Instruction::SetNE: OS << "!= "; break; - case Instruction::SetLT: OS << "< "; break; - case Instruction::SetGT: OS << "> "; break; - case Instruction::SetLE: OS << "<= "; break; - case Instruction::SetGE: OS << ">= "; break; + case ICmpInst::ICMP_EQ: + case FCmpInst::FCMP_ORD: + case FCmpInst::FCMP_UEQ: + case FCmpInst::FCMP_OEQ: OS << "== "; break; + case ICmpInst::ICMP_NE: + case FCmpInst::FCMP_UNO: + case FCmpInst::FCMP_UNE: + case FCmpInst::FCMP_ONE: OS << "!= "; break; + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + case FCmpInst::FCMP_ULT: + case FCmpInst::FCMP_OLT: OS << "< "; break; + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + case FCmpInst::FCMP_UGT: + case FCmpInst::FCMP_OGT: OS << "> "; break; + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: + case FCmpInst::FCMP_ULE: + case FCmpInst::FCMP_OLE: OS << "<= "; break; + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + case FCmpInst::FCMP_UGE: + case FCmpInst::FCMP_OGE: OS << ">= "; break; } WriteAsOperand(OS, Val); Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.98 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.99 --- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.98 Tue Dec 19 15:40:18 2006 +++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Sat Dec 23 00:05:41 2006 @@ -271,14 +271,14 @@ Value *ExitCnt = RW.expandCodeFor(TripCount, Preheader->getTerminator(), IndVar->getType()); - // Insert a new setne or seteq instruction before the branch. - Instruction::BinaryOps Opcode; + // Insert a new icmp_ne or icmp_eq instruction before the branch. + ICmpInst::Predicate Opcode; if (L->contains(BI->getSuccessor(0))) - Opcode = Instruction::SetNE; + Opcode = ICmpInst::ICMP_NE; else - Opcode = Instruction::SetEQ; + Opcode = ICmpInst::ICMP_EQ; - Value *Cond = new SetCondInst(Opcode, IndVar, ExitCnt, "exitcond", BI); + Value *Cond = new ICmpInst(Opcode, IndVar, ExitCnt, "exitcond", BI); BI->setCondition(Cond); ++NumLFTR; Changed = true; Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.572 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.573 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.572 Tue Dec 19 15:40:18 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Dec 23 00:05:41 2006 @@ -24,8 +24,8 @@ // 1. If a binary operator has a constant operand, it is moved to the RHS // 2. Bitwise operators with constant operands are always grouped so that // shifts are performed first, then or's, then and's, then xor's. -// 3. SetCC instructions are converted from <,>,<=,>= to ==,!= if possible -// 4. All SetCC instructions on boolean values are replaced with logical ops +// 3. Compare instructions are converted from <,>,<=,>= to ==,!= if possible +// 4. All cmp instructions on boolean values are replaced with logical ops // 5. add X, X is represented as (X*2) => (X << 1) // 6. Multiplies with a power-of-two constant argument are transformed into // shifts. @@ -143,11 +143,12 @@ Instruction *visitAnd(BinaryOperator &I); Instruction *visitOr (BinaryOperator &I); Instruction *visitXor(BinaryOperator &I); - Instruction *visitSetCondInst(SetCondInst &I); - Instruction *visitSetCondInstWithCastAndCast(SetCondInst &SCI); + Instruction *visitFCmpInst(FCmpInst &I); + Instruction *visitICmpInst(ICmpInst &I); + Instruction *visitICmpInstWithCastAndCast(ICmpInst &ICI); - Instruction *FoldGEPSetCC(User *GEPLHS, Value *RHS, - Instruction::BinaryOps Cond, Instruction &I); + Instruction *FoldGEPICmp(User *GEPLHS, Value *RHS, + ICmpInst::Predicate Cond, Instruction &I); Instruction *visitShiftInst(ShiftInst &I); Instruction *FoldShiftByConstant(Value *Op0, ConstantInt *Op1, ShiftInst &I); @@ -274,10 +275,14 @@ Value *V, const Type *DestTy, Instruction *InsertBefore); - // SimplifyCommutative - This performs a few simplifications for commutative - // operators. + /// SimplifyCommutative - This performs a few simplifications for + /// commutative operators. bool SimplifyCommutative(BinaryOperator &I); + /// SimplifyCompare - This reorders the operands of a CmpInst to get them in + /// most-complex to least-complex order. + bool SimplifyCompare(CmpInst &I); + bool SimplifyDemandedBits(Value *V, uint64_t Mask, uint64_t &KnownZero, uint64_t &KnownOne, unsigned Depth = 0); @@ -303,7 +308,7 @@ Value *FoldLogicalPlusAnd(Value *LHS, Value *RHS, ConstantIntegral *Mask, bool isSub, Instruction &I); Instruction *InsertRangeTest(Value *V, Constant *Lo, Constant *Hi, - bool Inside, Instruction &IB); + bool isSigned, bool Inside, Instruction &IB); Instruction *PromoteCastOfAllocation(CastInst &CI, AllocationInst &AI); Instruction *MatchBSwap(BinaryOperator &I); @@ -381,7 +386,8 @@ /// ValueRequiresCast - Return true if the cast from "V to Ty" actually results /// in any code being generated. It does not require codegen if V is simple /// enough or if the cast can be folded into other casts. -static bool ValueRequiresCast(const Value *V, const Type *Ty, TargetData *TD) { +static bool ValueRequiresCast(Instruction::CastOps opcode, const Value *V, + const Type *Ty, TargetData *TD) { if (V->getType() == Ty || isa(V)) return false; // If this is a noop cast, it isn't real codegen. @@ -390,8 +396,7 @@ // If this is another cast that can be eliminated, it isn't codegen either. if (const CastInst *CI = dyn_cast(V)) - if (isEliminableCastPair(CI, CastInst::getCastOpcode( - V, V->getType()->isSigned(), Ty, Ty->isSigned()), Ty, TD)) + if (isEliminableCastPair(CI, opcode, Ty, TD)) return false; return true; } @@ -456,6 +461,17 @@ return Changed; } +/// SimplifyCompare - For a CmpInst this function just orders the operands +/// so that theyare listed from right (least complex) to left (most complex). +/// This puts constants before unary operators before binary operators. +bool InstCombiner::SimplifyCompare(CmpInst &I) { + if (getComplexity(I.getOperand(0)) >= getComplexity(I.getOperand(1))) + return false; + I.swapOperands(); + // Compare instructions are not associative so there's nothing else we can do. + return true; +} + // dyn_castNegVal - Given a 'sub' instruction, return the RHS of the instruction // if the LHS is a constant zero (which is the 'negate' form). // @@ -1451,13 +1467,24 @@ return MadeChange ? I : 0; } -// isTrueWhenEqual - Return true if the specified setcondinst instruction is -// true when both operands are equal... -// -static bool isTrueWhenEqual(Instruction &I) { - return I.getOpcode() == Instruction::SetEQ || - I.getOpcode() == Instruction::SetGE || - I.getOpcode() == Instruction::SetLE; +/// @returns true if the specified compare instruction is +/// true when both operands are equal... +/// @brief Determine if the ICmpInst returns true if both operands are equal +static bool isTrueWhenEqual(ICmpInst &ICI) { + ICmpInst::Predicate pred = ICI.getPredicate(); + return pred == ICmpInst::ICMP_EQ || pred == ICmpInst::ICMP_UGE || + pred == ICmpInst::ICMP_SGE || pred == ICmpInst::ICMP_ULE || + pred == ICmpInst::ICMP_SLE; +} + +/// @returns true if the specified compare instruction is +/// true when both operands are equal... +/// @brief Determine if the FCmpInst returns true if both operands are equal +static bool isTrueWhenEqual(FCmpInst &FCI) { + FCmpInst::Predicate pred = FCI.getPredicate(); + return pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ || + pred == FCmpInst::FCMP_OGE || pred == FCmpInst::FCMP_UGE || + pred == FCmpInst::FCMP_OLE || pred == FCmpInst::FCMP_ULE; } /// AssociativeOpt - Perform an optimization on an associative operator. This @@ -1593,6 +1620,9 @@ Instruction *New; if (BinaryOperator *BO = dyn_cast(&I)) New = BinaryOperator::create(BO->getOpcode(), Op0, Op1,SO->getName()+".op"); + else if (CmpInst *CI = dyn_cast(&I)) + New = CmpInst::create(CI->getOpcode(), CI->getPredicate(), Op0, Op1, + SO->getName()+".cmp"); else if (ShiftInst *SI = dyn_cast(&I)) New = new ShiftInst(SI->getOpcode(), Op0, Op1, SO->getName()+".sh"); else { @@ -1671,13 +1701,21 @@ for (unsigned i = 0; i != NumPHIValues; ++i) { Value *InV; if (Constant *InC = dyn_cast(PN->getIncomingValue(i))) { - InV = ConstantExpr::get(I.getOpcode(), InC, C); + if (CmpInst *CI = dyn_cast(&I)) + InV = ConstantExpr::getCompare(CI->getPredicate(), InC, C); + else + InV = ConstantExpr::get(I.getOpcode(), InC, C); } else { assert(PN->getIncomingBlock(i) == NonConstBB); if (BinaryOperator *BO = dyn_cast(&I)) InV = BinaryOperator::create(BO->getOpcode(), PN->getIncomingValue(i), C, "phitmp", NonConstBB->getTerminator()); + else if (CmpInst *CI = dyn_cast(&I)) + InV = CmpInst::create(CI->getOpcode(), + CI->getPredicate(), + PN->getIncomingValue(i), C, "phitmp", + NonConstBB->getTerminator()); else if (ShiftInst *SI = dyn_cast(&I)) InV = new ShiftInst(SI->getOpcode(), PN->getIncomingValue(i), C, "phitmp", @@ -2077,25 +2115,27 @@ return 0; } -/// isSignBitCheck - Given an exploded setcc instruction, return true if it is +/// isSignBitCheck - Given an exploded icmp instruction, return true if it /// really just returns true if the most significant (sign) bit is set. -static bool isSignBitCheck(unsigned Opcode, Value *LHS, ConstantInt *RHS) { - if (RHS->getType()->isSigned()) { - // True if source is LHS < 0 or LHS <= -1 - return Opcode == Instruction::SetLT && RHS->isNullValue() || - Opcode == Instruction::SetLE && RHS->isAllOnesValue(); - } else { - ConstantInt *RHSC = cast(RHS); - // True if source is LHS > 127 or LHS >= 128, where the constants depend on - // the size of the integer type. - if (Opcode == Instruction::SetGE) - return RHSC->getZExtValue() == - 1ULL << (RHS->getType()->getPrimitiveSizeInBits()-1); - if (Opcode == Instruction::SetGT) - return RHSC->getZExtValue() == +static bool isSignBitCheck(ICmpInst::Predicate pred, ConstantInt *RHS) { + switch (pred) { + case ICmpInst::ICMP_SLT: + // True if LHS s< RHS and RHS == 0 + return RHS->isNullValue(); + case ICmpInst::ICMP_SLE: + // True if LHS s<= RHS and RHS == -1 + return RHS->isAllOnesValue(); + case ICmpInst::ICMP_UGE: + // True if LHS u>= RHS and RHS == high-bit-mask (2^7, 2^15, 2^31, etc) + return RHS->getZExtValue() == (1ULL << + (RHS->getType()->getPrimitiveSizeInBits()-1)); + case ICmpInst::ICMP_UGT: + // True if LHS u> RHS and RHS == high-bit-mask - 1 + return RHS->getZExtValue() == (1ULL << (RHS->getType()->getPrimitiveSizeInBits()-1))-1; + default: + return false; } - return false; } Instruction *InstCombiner::visitMul(BinaryOperator &I) { @@ -2179,14 +2219,14 @@ if (CI->getOperand(0)->getType() == Type::BoolTy) BoolCast = CI; if (BoolCast) { - if (SetCondInst *SCI = dyn_cast(BoolCast->getOperand(0))) { + if (ICmpInst *SCI = dyn_cast(BoolCast->getOperand(0))) { Value *SCIOp0 = SCI->getOperand(0), *SCIOp1 = SCI->getOperand(1); const Type *SCOpTy = SCIOp0->getType(); - // If the setcc is true iff the sign bit of X is set, then convert this + // If the icmp is true iff the sign bit of X is set, then convert this // multiply into a shift/and combination. if (isa(SCIOp1) && - isSignBitCheck(SCI->getOpcode(), SCIOp0, cast(SCIOp1))) { + isSignBitCheck(SCI->getPredicate(), cast(SCIOp1))) { // Shift the X value right to turn it into "all signbits". Constant *Amt = ConstantInt::get(Type::UByteTy, SCOpTy->getPrimitiveSizeInBits()-1); @@ -2613,27 +2653,27 @@ } // isMaxValueMinusOne - return true if this is Max-1 -static bool isMaxValueMinusOne(const ConstantInt *C) { - if (C->getType()->isUnsigned()) - return C->getZExtValue() == C->getType()->getIntegralTypeMask()-1; - - // Calculate 0111111111..11111 - unsigned TypeBits = C->getType()->getPrimitiveSizeInBits(); - int64_t Val = INT64_MAX; // All ones - Val >>= 64-TypeBits; // Shift out unwanted 1 bits... - return C->getSExtValue() == Val-1; +static bool isMaxValueMinusOne(const ConstantInt *C, bool isSigned) { + if (isSigned) { + // Calculate 0111111111..11111 + unsigned TypeBits = C->getType()->getPrimitiveSizeInBits(); + int64_t Val = INT64_MAX; // All ones + Val >>= 64-TypeBits; // Shift out unwanted 1 bits... + return C->getSExtValue() == Val-1; + } + return C->getZExtValue() == C->getType()->getIntegralTypeMask()-1; } // isMinValuePlusOne - return true if this is Min+1 -static bool isMinValuePlusOne(const ConstantInt *C) { - if (C->getType()->isUnsigned()) - return C->getZExtValue() == 1; - - // Calculate 1111111111000000000000 - unsigned TypeBits = C->getType()->getPrimitiveSizeInBits(); - int64_t Val = -1; // All ones - Val <<= TypeBits-1; // Shift over to the right spot - return C->getSExtValue() == Val+1; +static bool isMinValuePlusOne(const ConstantInt *C, bool isSigned) { + if (isSigned) { + // Calculate 1111111111000000000000 + unsigned TypeBits = C->getType()->getPrimitiveSizeInBits(); + int64_t Val = -1; // All ones + Val <<= TypeBits-1; // Shift over to the right spot + return C->getSExtValue() == Val+1; + } + return C->getZExtValue() == 1; // unsigned } // isOneBitSet - Return true if there is exactly one bit set in the specified @@ -2669,71 +2709,116 @@ return U && V && (U & V) == 0; } - -/// getSetCondCode - Encode a setcc opcode into a three bit mask. These bits +/// getICmpCode - Encode a icmp predicate into a three bit mask. These bits /// are carefully arranged to allow folding of expressions such as: /// /// (A < B) | (A > B) --> (A != B) /// -/// Bit value '4' represents that the comparison is true if A > B, bit value '2' -/// represents that the comparison is true if A == B, and bit value '1' is true -/// if A < B. +/// Note that this is only valid if the first and second predicates have the +/// same sign. Is illegal to do: (A u< B) | (A s> B) +/// +/// Three bits are used to represent the condition, as follows: +/// 0 A > B +/// 1 A == B +/// 2 A < B /// -static unsigned getSetCondCode(const SetCondInst *SCI) { - switch (SCI->getOpcode()) { +/// <=> Value Definition +/// 000 0 Always false +/// 001 1 A > B +/// 010 2 A == B +/// 011 3 A >= B +/// 100 4 A < B +/// 101 5 A != B +/// 110 6 A <= B +/// 111 7 Always true +/// +static unsigned getICmpCode(const ICmpInst *ICI) { + switch (ICI->getPredicate()) { // False -> 0 - case Instruction::SetGT: return 1; - case Instruction::SetEQ: return 2; - case Instruction::SetGE: return 3; - case Instruction::SetLT: return 4; - case Instruction::SetNE: return 5; - case Instruction::SetLE: return 6; + case ICmpInst::ICMP_UGT: return 1; // 001 + case ICmpInst::ICMP_SGT: return 1; // 001 + case ICmpInst::ICMP_EQ: return 2; // 010 + case ICmpInst::ICMP_UGE: return 3; // 011 + case ICmpInst::ICMP_SGE: return 3; // 011 + case ICmpInst::ICMP_ULT: return 4; // 100 + case ICmpInst::ICMP_SLT: return 4; // 100 + case ICmpInst::ICMP_NE: return 5; // 101 + case ICmpInst::ICMP_ULE: return 6; // 110 + case ICmpInst::ICMP_SLE: return 6; // 110 // True -> 7 default: - assert(0 && "Invalid SetCC opcode!"); + assert(0 && "Invalid ICmp predicate!"); return 0; } } -/// getSetCCValue - This is the complement of getSetCondCode, which turns an -/// opcode and two operands into either a constant true or false, or a brand new -/// SetCC instruction. -static Value *getSetCCValue(unsigned Opcode, Value *LHS, Value *RHS) { - switch (Opcode) { - case 0: return ConstantBool::getFalse(); - case 1: return new SetCondInst(Instruction::SetGT, LHS, RHS); - case 2: return new SetCondInst(Instruction::SetEQ, LHS, RHS); - case 3: return new SetCondInst(Instruction::SetGE, LHS, RHS); - case 4: return new SetCondInst(Instruction::SetLT, LHS, RHS); - case 5: return new SetCondInst(Instruction::SetNE, LHS, RHS); - case 6: return new SetCondInst(Instruction::SetLE, LHS, RHS); - case 7: return ConstantBool::getTrue(); - default: assert(0 && "Illegal SetCCCode!"); return 0; +/// getICmpValue - This is the complement of getICmpCode, which turns an +/// opcode and two operands into either a constant true or false, or a brand +/// new /// ICmp instruction. The sign is passed in to determine which kind +/// of predicate to use in new icmp instructions. +static Value *getICmpValue(bool sign, unsigned code, Value *LHS, Value *RHS) { + switch (code) { + default: assert(0 && "Illegal ICmp code!"); + case 0: return ConstantBool::getFalse(); + case 1: + if (sign) + return new ICmpInst(ICmpInst::ICMP_SGT, LHS, RHS); + else + return new ICmpInst(ICmpInst::ICMP_UGT, LHS, RHS); + case 2: return new ICmpInst(ICmpInst::ICMP_EQ, LHS, RHS); + case 3: + if (sign) + return new ICmpInst(ICmpInst::ICMP_SGE, LHS, RHS); + else + return new ICmpInst(ICmpInst::ICMP_UGE, LHS, RHS); + case 4: + if (sign) + return new ICmpInst(ICmpInst::ICMP_SLT, LHS, RHS); + else + return new ICmpInst(ICmpInst::ICMP_ULT, LHS, RHS); + case 5: return new ICmpInst(ICmpInst::ICMP_NE, LHS, RHS); + case 6: + if (sign) + return new ICmpInst(ICmpInst::ICMP_SLE, LHS, RHS); + else + return new ICmpInst(ICmpInst::ICMP_ULE, LHS, RHS); + case 7: return ConstantBool::getTrue(); } } -// FoldSetCCLogical - Implements (setcc1 A, B) & (setcc2 A, B) --> (setcc3 A, B) -namespace { -struct FoldSetCCLogical { +static bool PredicatesFoldable(ICmpInst::Predicate p1, ICmpInst::Predicate p2) { + return (ICmpInst::isSignedPredicate(p1) == ICmpInst::isSignedPredicate(p2)) || + (ICmpInst::isSignedPredicate(p1) && + (p2 == ICmpInst::ICMP_EQ || p2 == ICmpInst::ICMP_NE)) || + (ICmpInst::isSignedPredicate(p2) && + (p1 == ICmpInst::ICMP_EQ || p1 == ICmpInst::ICMP_NE)); +} + +namespace { +// FoldICmpLogical - Implements (icmp1 A, B) & (icmp2 A, B) --> (icmp3 A, B) +struct FoldICmpLogical { InstCombiner &IC; Value *LHS, *RHS; - FoldSetCCLogical(InstCombiner &ic, SetCondInst *SCI) - : IC(ic), LHS(SCI->getOperand(0)), RHS(SCI->getOperand(1)) {} + ICmpInst::Predicate pred; + FoldICmpLogical(InstCombiner &ic, ICmpInst *ICI) + : IC(ic), LHS(ICI->getOperand(0)), RHS(ICI->getOperand(1)), + pred(ICI->getPredicate()) {} bool shouldApply(Value *V) const { - if (SetCondInst *SCI = dyn_cast(V)) - return (SCI->getOperand(0) == LHS && SCI->getOperand(1) == RHS || - SCI->getOperand(0) == RHS && SCI->getOperand(1) == LHS); + if (ICmpInst *ICI = dyn_cast(V)) + if (PredicatesFoldable(pred, ICI->getPredicate())) + return (ICI->getOperand(0) == LHS && ICI->getOperand(1) == RHS || + ICI->getOperand(0) == RHS && ICI->getOperand(1) == LHS); return false; } - Instruction *apply(BinaryOperator &Log) const { - SetCondInst *SCI = cast(Log.getOperand(0)); - if (SCI->getOperand(0) != LHS) { - assert(SCI->getOperand(1) == LHS); - SCI->swapOperands(); // Swap the LHS and RHS of the SetCC + Instruction *apply(Instruction &Log) const { + ICmpInst *ICI = cast(Log.getOperand(0)); + if (ICI->getOperand(0) != LHS) { + assert(ICI->getOperand(1) == LHS); + ICI->swapOperands(); // Swap the LHS and RHS of the ICmp } - unsigned LHSCode = getSetCondCode(SCI); - unsigned RHSCode = getSetCondCode(cast(Log.getOperand(1))); + unsigned LHSCode = getICmpCode(ICI); + unsigned RHSCode = getICmpCode(cast(Log.getOperand(1))); unsigned Code; switch (Log.getOpcode()) { case Instruction::And: Code = LHSCode & RHSCode; break; @@ -2742,7 +2827,7 @@ default: assert(0 && "Illegal logical opcode!"); return 0; } - Value *RV = getSetCCValue(Code, LHS, RHS); + Value *RV = getICmpValue(ICmpInst::isSignedPredicate(pred), Code, LHS, RHS); if (Instruction *I = dyn_cast(RV)) return I; // Otherwise, it's a constant boolean value... @@ -2882,48 +2967,52 @@ /// InsertRangeTest - Emit a computation of: (V >= Lo && V < Hi) if Inside is /// true, otherwise (V < Lo || V >= Hi). In pratice, we emit the more efficient -/// (V-Lo) (ConstantExpr::getSetLE(Lo, Hi))->getValue() && + bool isSigned, bool Inside, + Instruction &IB) { + assert(cast(ConstantExpr::getICmp((isSigned ? + ICmpInst::ICMP_SLE:ICmpInst::ICMP_ULE), Lo, Hi))->getValue() && "Lo is not <= Hi in range emission code!"); + if (Inside) { if (Lo == Hi) // Trivially false. - return new SetCondInst(Instruction::SetNE, V, V); - if (cast(Lo)->isMinValue(Lo->getType()->isSigned())) - return new SetCondInst(Instruction::SetLT, V, Hi); + return new ICmpInst(ICmpInst::ICMP_NE, V, V); + + // V >= Min && V < Hi --> V < Hi + if (cast(Lo)->isMinValue(isSigned)) { + ICmpInst::Predicate pred = (isSigned ? + ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT); + return new ICmpInst(pred, V, Hi); + } - Constant *AddCST = ConstantExpr::getNeg(Lo); - Instruction *Add = BinaryOperator::createAdd(V, AddCST,V->getName()+".off"); + // Emit V-Lo getName()+".off"); InsertNewInstBefore(Add, IB); - // Convert to unsigned for the comparison. - const Type *UnsType = Add->getType()->getUnsignedVersion(); - Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, UnsType, IB); - AddCST = ConstantExpr::getAdd(AddCST, Hi); - AddCST = ConstantExpr::getBitCast(AddCST, UnsType); - return new SetCondInst(Instruction::SetLT, OffsetVal, AddCST); + Constant *UpperBound = ConstantExpr::getAdd(NegLo, Hi); + return new ICmpInst(ICmpInst::ICMP_ULT, Add, UpperBound); } if (Lo == Hi) // Trivially true. - return new SetCondInst(Instruction::SetEQ, V, V); + return new ICmpInst(ICmpInst::ICMP_EQ, V, V); + // V < Min || V >= Hi ->'V > Hi-1' Hi = SubOne(cast(Hi)); + if (cast(Lo)->isMinValue(isSigned)) { + ICmpInst::Predicate pred = (isSigned ? + ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT); + return new ICmpInst(pred, V, Hi); + } - // V < 0 || V >= Hi ->'V > Hi-1' - if (cast(Lo)->isMinValue(Lo->getType()->isSigned())) - return new SetCondInst(Instruction::SetGT, V, Hi); - - // Emit X-Lo > Hi-Lo-1 - Constant *AddCST = ConstantExpr::getNeg(Lo); - Instruction *Add = BinaryOperator::createAdd(V, AddCST, V->getName()+".off"); + // Emit V-Lo > Hi-1-Lo + Constant *NegLo = ConstantExpr::getNeg(Lo); + Instruction *Add = BinaryOperator::createAdd(V, NegLo, V->getName()+".off"); InsertNewInstBefore(Add, IB); - // Convert to unsigned for the comparison. - const Type *UnsType = Add->getType()->getUnsignedVersion(); - Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, UnsType, IB); - AddCST = ConstantExpr::getAdd(AddCST, Hi); - AddCST = ConstantExpr::getBitCast(AddCST, UnsType); - return new SetCondInst(Instruction::SetGT, OffsetVal, AddCST); + Constant *LowerBound = ConstantExpr::getAdd(NegLo, Hi); + return new ICmpInst(ICmpInst::ICMP_UGT, Add, LowerBound); } // isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s with @@ -3163,62 +3252,72 @@ } } - - if (SetCondInst *RHS = dyn_cast(Op1)) { - // (setcc1 A, B) & (setcc2 A, B) --> (setcc3 A, B) - if (Instruction *R = AssociativeOpt(I, FoldSetCCLogical(*this, RHS))) + if (ICmpInst *RHS = dyn_cast(Op1)) { + // (icmp1 A, B) & (icmp2 A, B) --> (icmp3 A, B) + if (Instruction *R = AssociativeOpt(I, FoldICmpLogical(*this, RHS))) return R; Value *LHSVal, *RHSVal; ConstantInt *LHSCst, *RHSCst; - Instruction::BinaryOps LHSCC, RHSCC; - if (match(Op0, m_SetCond(LHSCC, m_Value(LHSVal), m_ConstantInt(LHSCst)))) - if (match(RHS, m_SetCond(RHSCC, m_Value(RHSVal), m_ConstantInt(RHSCst)))) - if (LHSVal == RHSVal && // Found (X setcc C1) & (X setcc C2) - // Set[GL]E X, CST is folded to Set[GL]T elsewhere. - LHSCC != Instruction::SetGE && LHSCC != Instruction::SetLE && - RHSCC != Instruction::SetGE && RHSCC != Instruction::SetLE) { + ICmpInst::Predicate LHSCC, RHSCC; + if (match(Op0, m_ICmp(LHSCC, m_Value(LHSVal), m_ConstantInt(LHSCst)))) + if (match(RHS, m_ICmp(RHSCC, m_Value(RHSVal), m_ConstantInt(RHSCst)))) + if (LHSVal == RHSVal && // Found (X icmp C1) & (X icmp C2) + // ICMP_[GL]E X, CST is folded to ICMP_[GL]T elsewhere. + LHSCC != ICmpInst::ICMP_UGE && LHSCC != ICmpInst::ICMP_ULE && + RHSCC != ICmpInst::ICMP_UGE && RHSCC != ICmpInst::ICMP_ULE && + LHSCC != ICmpInst::ICMP_SGE && LHSCC != ICmpInst::ICMP_SLE && + RHSCC != ICmpInst::ICMP_SGE && RHSCC != ICmpInst::ICMP_SLE) { // Ensure that the larger constant is on the RHS. - Constant *Cmp = ConstantExpr::getSetGT(LHSCst, RHSCst); - SetCondInst *LHS = cast(Op0); + ICmpInst::Predicate GT = ICmpInst::isSignedPredicate(LHSCC) ? + ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; + Constant *Cmp = ConstantExpr::getICmp(GT, LHSCst, RHSCst); + ICmpInst *LHS = cast(Op0); if (cast(Cmp)->getValue()) { std::swap(LHS, RHS); std::swap(LHSCst, RHSCst); std::swap(LHSCC, RHSCC); } - // At this point, we know we have have two setcc instructions + // At this point, we know we have have two icmp instructions // comparing a value against two constants and and'ing the result // together. Because of the above check, we know that we only have - // SetEQ, SetNE, SetLT, and SetGT here. We also know (from the - // FoldSetCCLogical check above), that the two constants are not - // equal. + // icmp eq, icmp ne, icmp [su]lt, and icmp [SU]gt here. We also know + // (from the FoldICmpLogical check above), that the two constants + // are not equal and that the larger constant is on the RHS assert(LHSCst != RHSCst && "Compares not folded above?"); switch (LHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetEQ: + case ICmpInst::ICMP_EQ: switch (RHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetEQ: // (X == 13 & X == 15) -> false - case Instruction::SetGT: // (X == 13 & X > 15) -> false + case ICmpInst::ICMP_EQ: // (X == 13 & X == 15) -> false + case ICmpInst::ICMP_UGT: // (X == 13 & X > 15) -> false + case ICmpInst::ICMP_SGT: // (X == 13 & X > 15) -> false return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - case Instruction::SetNE: // (X == 13 & X != 15) -> X == 13 - case Instruction::SetLT: // (X == 13 & X < 15) -> X == 13 + case ICmpInst::ICMP_NE: // (X == 13 & X != 15) -> X == 13 + case ICmpInst::ICMP_ULT: // (X == 13 & X < 15) -> X == 13 + case ICmpInst::ICMP_SLT: // (X == 13 & X < 15) -> X == 13 return ReplaceInstUsesWith(I, LHS); } - case Instruction::SetNE: + case ICmpInst::ICMP_NE: switch (RHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetLT: - if (LHSCst == SubOne(RHSCst)) // (X != 13 & X < 14) -> X < 13 - return new SetCondInst(Instruction::SetLT, LHSVal, LHSCst); - break; // (X != 13 & X < 15) -> no change - case Instruction::SetEQ: // (X != 13 & X == 15) -> X == 15 - case Instruction::SetGT: // (X != 13 & X > 15) -> X > 15 + case ICmpInst::ICMP_ULT: + if (LHSCst == SubOne(RHSCst)) // (X != 13 & X u< 14) -> X < 13 + return new ICmpInst(ICmpInst::ICMP_ULT, LHSVal, LHSCst); + break; // (X != 13 & X u< 15) -> no change + case ICmpInst::ICMP_SLT: + if (LHSCst == SubOne(RHSCst)) // (X != 13 & X s< 14) -> X < 13 + return new ICmpInst(ICmpInst::ICMP_SLT, LHSVal, LHSCst); + break; // (X != 13 & X s< 15) -> no change + case ICmpInst::ICMP_EQ: // (X != 13 & X == 15) -> X == 15 + case ICmpInst::ICMP_UGT: // (X != 13 & X u> 15) -> X u> 15 + case ICmpInst::ICMP_SGT: // (X != 13 & X s> 15) -> X s> 15 return ReplaceInstUsesWith(I, RHS); - case Instruction::SetNE: - if (LHSCst == SubOne(RHSCst)) {// (X != 13 & X != 14) -> X-13 >u 1 + case ICmpInst::ICMP_NE: + if (LHSCst == SubOne(RHSCst)){// (X != 13 & X != 14) -> X-13 >u 1 Constant *AddCST = ConstantExpr::getNeg(LHSCst); Instruction *Add = BinaryOperator::createAdd(LHSVal, AddCST, LHSVal->getName()+".off"); @@ -3228,35 +3327,81 @@ UnsType, I); AddCST = ConstantExpr::getSub(RHSCst, LHSCst); AddCST = ConstantExpr::getBitCast(AddCST, UnsType); - return new SetCondInst(Instruction::SetGT, OffsetVal, AddCST); + return new ICmpInst(ICmpInst::ICMP_UGT, OffsetVal, AddCST); } break; // (X != 13 & X != 15) -> no change } break; - case Instruction::SetLT: + case ICmpInst::ICMP_ULT: + switch (RHSCC) { + default: assert(0 && "Unknown integer condition code!"); + case ICmpInst::ICMP_EQ: // (X u< 13 & X == 15) -> false + case ICmpInst::ICMP_UGT: // (X u< 13 & X u> 15) -> false + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); + case ICmpInst::ICMP_SGT: // (X u< 13 & X s> 15) -> no change + break; + case ICmpInst::ICMP_NE: // (X u< 13 & X != 15) -> X u< 13 + case ICmpInst::ICMP_ULT: // (X u< 13 & X u< 15) -> X u< 13 + return ReplaceInstUsesWith(I, LHS); + case ICmpInst::ICMP_SLT: // (X u< 13 & X s< 15) -> no change + break; + } + break; + case ICmpInst::ICMP_SLT: switch (RHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetEQ: // (X < 13 & X == 15) -> false - case Instruction::SetGT: // (X < 13 & X > 15) -> false + case ICmpInst::ICMP_EQ: // (X s< 13 & X == 15) -> false + case ICmpInst::ICMP_SGT: // (X s< 13 & X s> 15) -> false return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - case Instruction::SetNE: // (X < 13 & X != 15) -> X < 13 - case Instruction::SetLT: // (X < 13 & X < 15) -> X < 13 + case ICmpInst::ICMP_UGT: // (X s< 13 & X u> 15) -> no change + break; + case ICmpInst::ICMP_NE: // (X s< 13 & X != 15) -> X < 13 + case ICmpInst::ICMP_SLT: // (X s< 13 & X s< 15) -> X < 13 return ReplaceInstUsesWith(I, LHS); + case ICmpInst::ICMP_ULT: // (X s< 13 & X u< 15) -> no change + break; } - case Instruction::SetGT: + break; + case ICmpInst::ICMP_UGT: switch (RHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetEQ: // (X > 13 & X == 15) -> X > 13 + case ICmpInst::ICMP_EQ: // (X u> 13 & X == 15) -> X > 13 return ReplaceInstUsesWith(I, LHS); - case Instruction::SetGT: // (X > 13 & X > 15) -> X > 15 + case ICmpInst::ICMP_UGT: // (X u> 13 & X u> 15) -> X u> 15 return ReplaceInstUsesWith(I, RHS); - case Instruction::SetNE: - if (RHSCst == AddOne(LHSCst)) // (X > 13 & X != 14) -> X > 14 - return new SetCondInst(Instruction::SetGT, LHSVal, RHSCst); - break; // (X > 13 & X != 15) -> no change - case Instruction::SetLT: // (X > 13 & X < 15) -> (X-14) 13 & X s> 15) -> no change + break; + case ICmpInst::ICMP_NE: + if (RHSCst == AddOne(LHSCst)) // (X u> 13 & X != 14) -> X u> 14 + return new ICmpInst(LHSCC, LHSVal, RHSCst); + break; // (X u> 13 & X != 15) -> no change + case ICmpInst::ICMP_ULT: // (X u> 13 & X u< 15) ->(X-14) 13 & X s< 15) -> no change + break; } + break; + case ICmpInst::ICMP_SGT: + switch (RHSCC) { + default: assert(0 && "Unknown integer condition code!"); + case ICmpInst::ICMP_EQ: // (X s> 13 & X == 15) -> X s> 13 + return ReplaceInstUsesWith(I, LHS); + case ICmpInst::ICMP_SGT: // (X s> 13 & X s> 15) -> X s> 15 + return ReplaceInstUsesWith(I, RHS); + case ICmpInst::ICMP_UGT: // (X s> 13 & X u> 15) -> no change + break; + case ICmpInst::ICMP_NE: + if (RHSCst == AddOne(LHSCst)) // (X s> 13 & X != 14) -> X s> 14 + return new ICmpInst(LHSCC, LHSVal, RHSCst); + break; // (X s> 13 & X != 15) -> no change + case ICmpInst::ICMP_SLT: // (X s> 13 & X s< 15) ->(X-14) s< 1 + return InsertRangeTest(LHSVal, AddOne(LHSCst), RHSCst, true, + true, I); + case ICmpInst::ICMP_ULT: // (X s> 13 & X u< 15) -> no change + break; + } + break; } } } @@ -3268,8 +3413,10 @@ const Type *SrcTy = Op0C->getOperand(0)->getType(); if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && // Only do this if the casts both really cause code to be generated. - ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && - ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { + ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0), + I.getType(), TD) && + ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0), + I.getType(), TD)) { Instruction *NewOp = BinaryOperator::createAnd(Op0C->getOperand(0), Op1C->getOperand(0), I.getName()); @@ -3570,97 +3717,142 @@ } } - // (setcc1 A, B) | (setcc2 A, B) --> (setcc3 A, B) - if (SetCondInst *RHS = dyn_cast(I.getOperand(1))) { - if (Instruction *R = AssociativeOpt(I, FoldSetCCLogical(*this, RHS))) + // (icmp1 A, B) | (icmp2 A, B) --> (icmp3 A, B) + if (ICmpInst *RHS = dyn_cast(I.getOperand(1))) { + if (Instruction *R = AssociativeOpt(I, FoldICmpLogical(*this, RHS))) return R; Value *LHSVal, *RHSVal; ConstantInt *LHSCst, *RHSCst; - Instruction::BinaryOps LHSCC, RHSCC; - if (match(Op0, m_SetCond(LHSCC, m_Value(LHSVal), m_ConstantInt(LHSCst)))) - if (match(RHS, m_SetCond(RHSCC, m_Value(RHSVal), m_ConstantInt(RHSCst)))) - if (LHSVal == RHSVal && // Found (X setcc C1) | (X setcc C2) - // Set[GL]E X, CST is folded to Set[GL]T elsewhere. - LHSCC != Instruction::SetGE && LHSCC != Instruction::SetLE && - RHSCC != Instruction::SetGE && RHSCC != Instruction::SetLE) { + ICmpInst::Predicate LHSCC, RHSCC; + if (match(Op0, m_ICmp(LHSCC, m_Value(LHSVal), m_ConstantInt(LHSCst)))) + if (match(RHS, m_ICmp(RHSCC, m_Value(RHSVal), m_ConstantInt(RHSCst)))) + if (LHSVal == RHSVal && // Found (X icmp C1) | (X icmp C2) + // icmp [us][gl]e x, cst is folded to icmp [us][gl]t elsewhere. + LHSCC != ICmpInst::ICMP_UGE && LHSCC != ICmpInst::ICMP_ULE && + RHSCC != ICmpInst::ICMP_UGE && RHSCC != ICmpInst::ICMP_ULE && + LHSCC != ICmpInst::ICMP_SGE && LHSCC != ICmpInst::ICMP_SLE && + RHSCC != ICmpInst::ICMP_SGE && RHSCC != ICmpInst::ICMP_SLE) { // Ensure that the larger constant is on the RHS. - Constant *Cmp = ConstantExpr::getSetGT(LHSCst, RHSCst); - SetCondInst *LHS = cast(Op0); + ICmpInst::Predicate GT = ICmpInst::isSignedPredicate(LHSCC) ? + ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; + Constant *Cmp = ConstantExpr::getICmp(GT, LHSCst, RHSCst); + ICmpInst *LHS = cast(Op0); if (cast(Cmp)->getValue()) { std::swap(LHS, RHS); std::swap(LHSCst, RHSCst); std::swap(LHSCC, RHSCC); } - // At this point, we know we have have two setcc instructions + // At this point, we know we have have two icmp instructions // comparing a value against two constants and or'ing the result // together. Because of the above check, we know that we only have - // SetEQ, SetNE, SetLT, and SetGT here. We also know (from the - // FoldSetCCLogical check above), that the two constants are not + // ICMP_EQ, ICMP_NE, ICMP_LT, and ICMP_GT here. We also know (from the + // FoldICmpLogical check above), that the two constants are not // equal. assert(LHSCst != RHSCst && "Compares not folded above?"); switch (LHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetEQ: + case ICmpInst::ICMP_EQ: switch (RHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetEQ: + case ICmpInst::ICMP_EQ: if (LHSCst == SubOne(RHSCst)) {// (X == 13 | X == 14) -> X-13 getName()+".off"); InsertNewInstBefore(Add, I); - const Type *UnsType = Add->getType()->getUnsignedVersion(); - Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, - UnsType, I); AddCST = ConstantExpr::getSub(AddOne(RHSCst), LHSCst); - AddCST = ConstantExpr::getBitCast(AddCST, UnsType); - return new SetCondInst(Instruction::SetLT, OffsetVal, AddCST); + return new ICmpInst(ICmpInst::ICMP_ULT, Add, AddCST); } - break; // (X == 13 | X == 15) -> no change - - case Instruction::SetGT: // (X == 13 | X > 14) -> no change + break; // (X == 13 | X == 15) -> no change + case ICmpInst::ICMP_UGT: // (X == 13 | X u> 14) -> no change + case ICmpInst::ICMP_SGT: // (X == 13 | X s> 14) -> no change break; - case Instruction::SetNE: // (X == 13 | X != 15) -> X != 15 - case Instruction::SetLT: // (X == 13 | X < 15) -> X < 15 + case ICmpInst::ICMP_NE: // (X == 13 | X != 15) -> X != 15 + case ICmpInst::ICMP_ULT: // (X == 13 | X u< 15) -> X u< 15 + case ICmpInst::ICMP_SLT: // (X == 13 | X s< 15) -> X s< 15 return ReplaceInstUsesWith(I, RHS); } break; - case Instruction::SetNE: + case ICmpInst::ICMP_NE: switch (RHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetEQ: // (X != 13 | X == 15) -> X != 13 - case Instruction::SetGT: // (X != 13 | X > 15) -> X != 13 + case ICmpInst::ICMP_EQ: // (X != 13 | X == 15) -> X != 13 + case ICmpInst::ICMP_UGT: // (X != 13 | X u> 15) -> X != 13 + case ICmpInst::ICMP_SGT: // (X != 13 | X s> 15) -> X != 13 return ReplaceInstUsesWith(I, LHS); - case Instruction::SetNE: // (X != 13 | X != 15) -> true - case Instruction::SetLT: // (X != 13 | X < 15) -> true + case ICmpInst::ICMP_NE: // (X != 13 | X != 15) -> true + case ICmpInst::ICMP_ULT: // (X != 13 | X u< 15) -> true + case ICmpInst::ICMP_SLT: // (X != 13 | X s< 15) -> true return ReplaceInstUsesWith(I, ConstantBool::getTrue()); } break; - case Instruction::SetLT: + case ICmpInst::ICMP_ULT: switch (RHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetEQ: // (X < 13 | X == 14) -> no change + case ICmpInst::ICMP_EQ: // (X u< 13 | X == 14) -> no change + break; + case ICmpInst::ICMP_UGT: // (X u< 13 | X u> 15) ->(X-13) u> 2 + return InsertRangeTest(LHSVal, LHSCst, AddOne(RHSCst), false, + false, I); + case ICmpInst::ICMP_SGT: // (X u< 13 | X s> 15) -> no change break; - case Instruction::SetGT: // (X < 13 | X > 15) -> (X-13) > 2 - return InsertRangeTest(LHSVal, LHSCst, AddOne(RHSCst), false, I); - case Instruction::SetNE: // (X < 13 | X != 15) -> X != 15 - case Instruction::SetLT: // (X < 13 | X < 15) -> X < 15 + case ICmpInst::ICMP_NE: // (X u< 13 | X != 15) -> X != 15 + case ICmpInst::ICMP_ULT: // (X u< 13 | X u< 15) -> X u< 15 return ReplaceInstUsesWith(I, RHS); + case ICmpInst::ICMP_SLT: // (X u< 13 | X s< 15) -> no change + break; } break; - case Instruction::SetGT: + case ICmpInst::ICMP_SLT: switch (RHSCC) { default: assert(0 && "Unknown integer condition code!"); - case Instruction::SetEQ: // (X > 13 | X == 15) -> X > 13 - case Instruction::SetGT: // (X > 13 | X > 15) -> X > 13 + case ICmpInst::ICMP_EQ: // (X s< 13 | X == 14) -> no change + break; + case ICmpInst::ICMP_SGT: // (X s< 13 | X s> 15) ->(X-13) s> 2 + return InsertRangeTest(LHSVal, LHSCst, AddOne(RHSCst), true, + false, I); + case ICmpInst::ICMP_UGT: // (X s< 13 | X u> 15) -> no change + break; + case ICmpInst::ICMP_NE: // (X s< 13 | X != 15) -> X != 15 + case ICmpInst::ICMP_SLT: // (X s< 13 | X s< 15) -> X s< 15 + return ReplaceInstUsesWith(I, RHS); + case ICmpInst::ICMP_ULT: // (X s< 13 | X u< 15) -> no change + break; + } + break; + case ICmpInst::ICMP_UGT: + switch (RHSCC) { + default: assert(0 && "Unknown integer condition code!"); + case ICmpInst::ICMP_EQ: // (X u> 13 | X == 15) -> X u> 13 + case ICmpInst::ICMP_UGT: // (X u> 13 | X u> 15) -> X u> 13 + return ReplaceInstUsesWith(I, LHS); + case ICmpInst::ICMP_SGT: // (X u> 13 | X s> 15) -> no change + break; + case ICmpInst::ICMP_NE: // (X u> 13 | X != 15) -> true + case ICmpInst::ICMP_ULT: // (X u> 13 | X u< 15) -> true + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + case ICmpInst::ICMP_SLT: // (X u> 13 | X s< 15) -> no change + break; + } + break; + case ICmpInst::ICMP_SGT: + switch (RHSCC) { + default: assert(0 && "Unknown integer condition code!"); + case ICmpInst::ICMP_EQ: // (X s> 13 | X == 15) -> X > 13 + case ICmpInst::ICMP_SGT: // (X s> 13 | X s> 15) -> X > 13 return ReplaceInstUsesWith(I, LHS); - case Instruction::SetNE: // (X > 13 | X != 15) -> true - case Instruction::SetLT: // (X > 13 | X < 15) -> true + case ICmpInst::ICMP_UGT: // (X s> 13 | X u> 15) -> no change + break; + case ICmpInst::ICMP_NE: // (X s> 13 | X != 15) -> true + case ICmpInst::ICMP_SLT: // (X s> 13 | X s< 15) -> true return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + case ICmpInst::ICMP_ULT: // (X s> 13 | X u< 15) -> no change + break; } + break; } } } @@ -3672,8 +3864,10 @@ const Type *SrcTy = Op0C->getOperand(0)->getType(); if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && // Only do this if the casts both really cause code to be generated. - ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && - ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { + ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0), + I.getType(), TD) && + ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0), + I.getType(), TD)) { Instruction *NewOp = BinaryOperator::createOr(Op0C->getOperand(0), Op1C->getOperand(0), I.getName()); @@ -3719,13 +3913,13 @@ return &I; if (ConstantIntegral *RHS = dyn_cast(Op1)) { - if (BinaryOperator *Op0I = dyn_cast(Op0)) { - // xor (setcc A, B), true = not (setcc A, B) = setncc A, B - if (SetCondInst *SCI = dyn_cast(Op0I)) - if (RHS == ConstantBool::getTrue() && SCI->hasOneUse()) - return new SetCondInst(SCI->getInverseCondition(), - SCI->getOperand(0), SCI->getOperand(1)); + // xor (icmp A, B), true = not (icmp A, B) = !icmp A, B + if (ICmpInst *ICI = dyn_cast(Op0)) + if (RHS == ConstantBool::getTrue() && ICI->hasOneUse()) + return new ICmpInst(ICI->getInversePredicate(), + ICI->getOperand(0), ICI->getOperand(1)); + if (BinaryOperator *Op0I = dyn_cast(Op0)) { // ~(c-X) == X-c-1 == X+(-c-1) if (Op0I->getOpcode() == Instruction::Sub && RHS->isAllOnesValue()) if (Constant *Op0I0C = dyn_cast(Op0I->getOperand(0))) { @@ -3842,9 +4036,9 @@ } } - // (setcc1 A, B) ^ (setcc2 A, B) --> (setcc3 A, B) - if (SetCondInst *RHS = dyn_cast(I.getOperand(1))) - if (Instruction *R = AssociativeOpt(I, FoldSetCCLogical(*this, RHS))) + // (icmp1 A, B) ^ (icmp2 A, B) --> (icmp3 A, B) + if (ICmpInst *RHS = dyn_cast(I.getOperand(1))) + if (Instruction *R = AssociativeOpt(I, FoldICmpLogical(*this, RHS))) return R; // fold (xor (cast A), (cast B)) -> (cast (xor A, B)) @@ -3854,8 +4048,10 @@ const Type *SrcTy = Op0C->getOperand(0)->getType(); if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && // Only do this if the casts both really cause code to be generated. - ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && - ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { + ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0), + I.getType(), TD) && + ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0), + I.getType(), TD)) { Instruction *NewOp = BinaryOperator::createXor(Op0C->getOperand(0), Op1C->getOperand(0), I.getName()); @@ -3909,9 +4105,8 @@ static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) { TargetData &TD = IC.getTargetData(); gep_type_iterator GTI = gep_type_begin(GEP); - const Type *UIntPtrTy = TD.getIntPtrType(); - const Type *SIntPtrTy = UIntPtrTy->getSignedVersion(); - Value *Result = Constant::getNullValue(SIntPtrTy); + const Type *IntPtrTy = TD.getIntPtrType(); + Value *Result = Constant::getNullValue(IntPtrTy); // Build a mask for high order bits. uint64_t PtrSizeMask = ~0ULL >> (64-TD.getPointerSize()*8); @@ -3919,10 +4114,10 @@ for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, ++GTI) { Value *Op = GEP->getOperand(i); uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & PtrSizeMask; - Constant *Scale = ConstantInt::get(SIntPtrTy, Size); + Constant *Scale = ConstantInt::get(IntPtrTy, Size); if (Constant *OpC = dyn_cast(Op)) { if (!OpC->isNullValue()) { - OpC = ConstantExpr::getIntegerCast(OpC, SIntPtrTy, true /*SExt*/); + OpC = ConstantExpr::getIntegerCast(OpC, IntPtrTy, true /*SExt*/); Scale = ConstantExpr::getMul(OpC, Scale); if (Constant *RC = dyn_cast(Result)) Result = ConstantExpr::getAdd(RC, Scale); @@ -3935,7 +4130,7 @@ } } else { // Convert to correct type. - Op = IC.InsertNewInstBefore(CastInst::createSExtOrBitCast(Op, SIntPtrTy, + Op = IC.InsertNewInstBefore(CastInst::createSExtOrBitCast(Op, IntPtrTy, Op->getName()+".c"), I); if (Size != 1) // We'll let instcombine(mul) convert this to a shl if possible. @@ -3950,11 +4145,11 @@ return Result; } -/// FoldGEPSetCC - Fold comparisons between a GEP instruction and something +/// FoldGEPICmp - Fold comparisons between a GEP instruction and something /// else. At this point we know that the GEP is on the LHS of the comparison. -Instruction *InstCombiner::FoldGEPSetCC(User *GEPLHS, Value *RHS, - Instruction::BinaryOps Cond, - Instruction &I) { +Instruction *InstCombiner::FoldGEPICmp(User *GEPLHS, Value *RHS, + ICmpInst::Predicate Cond, + Instruction &I) { assert(dyn_castGetElementPtr(GEPLHS) && "LHS is not a getelementptr!"); if (CastInst *CI = dyn_cast(RHS)) @@ -3964,9 +4159,9 @@ Value *PtrBase = GEPLHS->getOperand(0); if (PtrBase == RHS) { // As an optimization, we don't actually have to compute the actual value of - // OFFSET if this is a seteq or setne comparison, just return whether each - // index is zero or not. - if (Cond == Instruction::SetEQ || Cond == Instruction::SetNE) { + // OFFSET if this is a icmp_eq or icmp_ne comparison, just return whether + // each index is zero or not. + if (Cond == ICmpInst::ICMP_EQ || Cond == ICmpInst::ICMP_NE) { Instruction *InVal = 0; gep_type_iterator GTI = gep_type_begin(GEPLHS); for (unsigned i = 1, e = GEPLHS->getNumOperands(); i != e; ++i, ++GTI) { @@ -3980,19 +4175,19 @@ EmitIt = false; // This is indexing into a zero sized array? } else if (isa(C)) return ReplaceInstUsesWith(I, // No comparison is needed here. - ConstantBool::get(Cond == Instruction::SetNE)); + ConstantBool::get(Cond == ICmpInst::ICMP_NE)); } if (EmitIt) { Instruction *Comp = - new SetCondInst(Cond, GEPLHS->getOperand(i), + new ICmpInst(Cond, GEPLHS->getOperand(i), Constant::getNullValue(GEPLHS->getOperand(i)->getType())); if (InVal == 0) InVal = Comp; else { InVal = InsertNewInstBefore(InVal, I); InsertNewInstBefore(Comp, I); - if (Cond == Instruction::SetNE) // True if any are unequal + if (Cond == ICmpInst::ICMP_NE) // True if any are unequal InVal = BinaryOperator::createOr(InVal, Comp); else // True if all are equal InVal = BinaryOperator::createAnd(InVal, Comp); @@ -4003,17 +4198,17 @@ if (InVal) return InVal; else - ReplaceInstUsesWith(I, // No comparison is needed here, all indexes = 0 - ConstantBool::get(Cond == Instruction::SetEQ)); + // No comparison is needed here, all indexes = 0 + ReplaceInstUsesWith(I, ConstantBool::get(Cond == ICmpInst::ICMP_EQ)); } - // Only lower this if the setcc is the only user of the GEP or if we expect + // Only lower this if the icmp is the only user of the GEP or if we expect // the result to fold to a constant! if (isa(GEPLHS) || GEPLHS->hasOneUse()) { // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0). Value *Offset = EmitGEPOffset(GEPLHS, I, *this); - return new SetCondInst(Cond, Offset, - Constant::getNullValue(Offset->getType())); + return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Offset, + Constant::getNullValue(Offset->getType())); } } else if (User *GEPRHS = dyn_castGetElementPtr(RHS)) { // If the base pointers are different, but the indices are the same, just @@ -4031,8 +4226,8 @@ // If all indices are the same, just compare the base pointers. if (IndicesTheSame) - return new SetCondInst(Cond, GEPLHS->getOperand(0), - GEPRHS->getOperand(0)); + return new ICmpInst(ICmpInst::getSignedPredicate(Cond), + GEPLHS->getOperand(0), GEPRHS->getOperand(0)); // Otherwise, the base pointers are different and the indices are // different, bail out. @@ -4048,8 +4243,8 @@ break; } if (AllZeros) - return FoldGEPSetCC(GEPRHS, GEPLHS->getOperand(0), - SetCondInst::getSwappedCondition(Cond), I); + return FoldGEPICmp(GEPRHS, GEPLHS->getOperand(0), + ICmpInst::getSwappedPredicate(Cond), I); // If the other GEP has all zero indices, recurse. AllZeros = true; @@ -4060,7 +4255,7 @@ break; } if (AllZeros) - return FoldGEPSetCC(GEPLHS, GEPRHS->getOperand(0), Cond, I); + return FoldGEPICmp(GEPLHS, GEPRHS->getOperand(0), Cond, I); if (GEPLHS->getNumOperands() == GEPRHS->getNumOperands()) { // If the GEPs only differ by one index, compare it. @@ -4081,49 +4276,103 @@ if (NumDifferences == 0) // SAME GEP? return ReplaceInstUsesWith(I, // No comparison is needed here. - ConstantBool::get(Cond == Instruction::SetEQ)); + ConstantBool::get(Cond == ICmpInst::ICMP_EQ)); else if (NumDifferences == 1) { Value *LHSV = GEPLHS->getOperand(DiffOperand); Value *RHSV = GEPRHS->getOperand(DiffOperand); - - // Convert the operands to signed values to make sure to perform a - // signed comparison. - const Type *NewTy = LHSV->getType()->getSignedVersion(); - if (LHSV->getType() != NewTy) - LHSV = InsertCastBefore(Instruction::BitCast, LHSV, NewTy, I); - if (RHSV->getType() != NewTy) - RHSV = InsertCastBefore(Instruction::BitCast, RHSV, NewTy, I); - return new SetCondInst(Cond, LHSV, RHSV); + if (LHSV->getType() != RHSV->getType()) + // Doesn't matter which one we bitconvert here. + LHSV = InsertCastBefore(Instruction::BitCast, LHSV, RHSV->getType(), + I); + // Make sure we do a signed comparison here. + return new ICmpInst(ICmpInst::getSignedPredicate(Cond), LHSV, RHSV); } } - // Only lower this if the setcc is the only user of the GEP or if we expect + // Only lower this if the icmp is the only user of the GEP or if we expect // the result to fold to a constant! if ((isa(GEPLHS) || GEPLHS->hasOneUse()) && (isa(GEPRHS) || GEPRHS->hasOneUse())) { // ((gep Ptr, OFFSET1) cmp (gep Ptr, OFFSET2) ---> (OFFSET1 cmp OFFSET2) Value *L = EmitGEPOffset(GEPLHS, I, *this); Value *R = EmitGEPOffset(GEPRHS, I, *this); - return new SetCondInst(Cond, L, R); + return new ICmpInst(ICmpInst::getSignedPredicate(Cond), L, R); } } return 0; } +Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { + bool Changed = SimplifyCompare(I); + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); -Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { - bool Changed = SimplifyCommutative(I); + // fcmp pred X, X + if (Op0 == Op1) + return ReplaceInstUsesWith(I, ConstantBool::get(isTrueWhenEqual(I))); + + if (isa(Op1)) // fcmp pred X, undef -> undef + return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy)); + + // Handle fcmp with constant RHS + if (Constant *RHSC = dyn_cast(Op1)) { + if (Instruction *LHSI = dyn_cast(Op0)) + switch (LHSI->getOpcode()) { + case Instruction::PHI: + if (Instruction *NV = FoldOpIntoPhi(I)) + return NV; + break; + case Instruction::Select: + // If either operand of the select is a constant, we can fold the + // comparison into the select arms, which will cause one to be + // constant folded and the select turned into a bitwise or. + Value *Op1 = 0, *Op2 = 0; + if (LHSI->hasOneUse()) { + if (Constant *C = dyn_cast(LHSI->getOperand(1))) { + // Fold the known value into the constant operand. + Op1 = ConstantExpr::getCompare(I.getPredicate(), C, RHSC); + // Insert a new FCmp of the other select operand. + Op2 = InsertNewInstBefore(new FCmpInst(I.getPredicate(), + LHSI->getOperand(2), RHSC, + I.getName()), I); + } else if (Constant *C = dyn_cast(LHSI->getOperand(2))) { + // Fold the known value into the constant operand. + Op2 = ConstantExpr::getCompare(I.getPredicate(), C, RHSC); + // Insert a new FCmp of the other select operand. + Op1 = InsertNewInstBefore(new FCmpInst(I.getPredicate(), + LHSI->getOperand(1), RHSC, + I.getName()), I); + } + } + + if (Op1) + return new SelectInst(LHSI->getOperand(0), Op1, Op2); + break; + } + } + + return Changed ? &I : 0; +} + +Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { + bool Changed = SimplifyCompare(I); Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); const Type *Ty = Op0->getType(); - // setcc X, X + // icmp X, X if (Op0 == Op1) return ReplaceInstUsesWith(I, ConstantBool::get(isTrueWhenEqual(I))); - if (isa(Op1)) // X setcc undef -> undef + if (isa(Op1)) // X icmp undef -> undef return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy)); - // setcc , - Global/Stack value + // icmp of GlobalValues can never equal each other as long as they aren't + // external weak linkage type. + if (GlobalValue *GV0 = dyn_cast(Op0)) + if (GlobalValue *GV1 = dyn_cast(Op1)) + if (!GV0->hasExternalWeakLinkage() || !GV1->hasExternalWeakLinkage()) + return ReplaceInstUsesWith(I, ConstantBool::get(!isTrueWhenEqual(I))); + + // icmp , - Global/Stack value // addresses never equal each other! We already know that Op0 != Op1. if ((isa(Op0) || isa(Op0) || isa(Op0)) && @@ -4131,30 +4380,34 @@ isa(Op1))) return ReplaceInstUsesWith(I, ConstantBool::get(!isTrueWhenEqual(I))); - // setcc's with boolean values can always be turned into bitwise operations + // icmp's with boolean values can always be turned into bitwise operations if (Ty == Type::BoolTy) { - switch (I.getOpcode()) { - default: assert(0 && "Invalid setcc instruction!"); - case Instruction::SetEQ: { // seteq bool %A, %B -> ~(A^B) + switch (I.getPredicate()) { + default: assert(0 && "Invalid icmp instruction!"); + case ICmpInst::ICMP_EQ: { // icmp eq bool %A, %B -> ~(A^B) Instruction *Xor = BinaryOperator::createXor(Op0, Op1, I.getName()+"tmp"); InsertNewInstBefore(Xor, I); return BinaryOperator::createNot(Xor); } - case Instruction::SetNE: + case ICmpInst::ICMP_NE: // icmp eq bool %A, %B -> A^B return BinaryOperator::createXor(Op0, Op1); - case Instruction::SetGT: - std::swap(Op0, Op1); // Change setgt -> setlt + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + std::swap(Op0, Op1); // Change icmp gt -> icmp lt // FALL THROUGH - case Instruction::SetLT: { // setlt bool A, B -> ~X & Y + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: { // icmp lt bool A, B -> ~X & Y Instruction *Not = BinaryOperator::createNot(Op0, I.getName()+"tmp"); InsertNewInstBefore(Not, I); return BinaryOperator::createAnd(Not, Op1); } - case Instruction::SetGE: - std::swap(Op0, Op1); // Change setge -> setle + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + std::swap(Op0, Op1); // Change icmp ge -> icmp le // FALL THROUGH - case Instruction::SetLE: { // setle bool %A, %B -> ~A | B + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: { // icmp le bool %A, %B -> ~A | B Instruction *Not = BinaryOperator::createNot(Op0, I.getName()+"tmp"); InsertNewInstBefore(Not, I); return BinaryOperator::createOr(Not, Op1); @@ -4165,50 +4418,93 @@ // See if we are doing a comparison between a constant and an instruction that // can be folded into the comparison. if (ConstantInt *CI = dyn_cast(Op1)) { - // Check to see if we are comparing against the minimum or maximum value... - if (CI->isMinValue(CI->getType()->isSigned())) { - if (I.getOpcode() == Instruction::SetLT) // A < MIN -> FALSE + switch (I.getPredicate()) { + default: break; + case ICmpInst::ICMP_ULT: // A FALSE + if (CI->isMinValue(false)) return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - if (I.getOpcode() == Instruction::SetGE) // A >= MIN -> TRUE - return ReplaceInstUsesWith(I, ConstantBool::getTrue()); - if (I.getOpcode() == Instruction::SetLE) // A <= MIN -> A == MIN - return BinaryOperator::createSetEQ(Op0, Op1); - if (I.getOpcode() == Instruction::SetGT) // A > MIN -> A != MIN - return BinaryOperator::createSetNE(Op0, Op1); + if (CI->isMaxValue(false)) // A A != MAX + return new ICmpInst(ICmpInst::ICMP_NE, Op0,Op1); + if (isMinValuePlusOne(CI,false)) // A A == MIN + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, SubOne(CI)); + break; - } else if (CI->isMaxValue(CI->getType()->isSigned())) { - if (I.getOpcode() == Instruction::SetGT) // A > MAX -> FALSE + case ICmpInst::ICMP_SLT: + if (CI->isMinValue(true)) // A FALSE return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - if (I.getOpcode() == Instruction::SetLE) // A <= MAX -> TRUE + if (CI->isMaxValue(true)) // A A != MAX + return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1); + if (isMinValuePlusOne(CI,true)) // A A == MIN + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, SubOne(CI)); + break; + + case ICmpInst::ICMP_UGT: + if (CI->isMaxValue(false)) // A >u MAX -> FALSE + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); + if (CI->isMinValue(false)) // A >u MIN -> A != MIN + return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1); + if (isMaxValueMinusOne(CI, false)) // A >u MAX-1 -> A == MAX + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, AddOne(CI)); + break; + + case ICmpInst::ICMP_SGT: + if (CI->isMaxValue(true)) // A >s MAX -> FALSE + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); + if (CI->isMinValue(true)) // A >s MIN -> A != MIN + return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1); + if (isMaxValueMinusOne(CI, true)) // A >s MAX-1 -> A == MAX + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, AddOne(CI)); + break; + + case ICmpInst::ICMP_ULE: + if (CI->isMaxValue(false)) // A <=u MAX -> TRUE return ReplaceInstUsesWith(I, ConstantBool::getTrue()); - if (I.getOpcode() == Instruction::SetGE) // A >= MAX -> A == MAX - return BinaryOperator::createSetEQ(Op0, Op1); - if (I.getOpcode() == Instruction::SetLT) // A < MAX -> A != MAX - return BinaryOperator::createSetNE(Op0, Op1); - - // Comparing against a value really close to min or max? - } else if (isMinValuePlusOne(CI)) { - if (I.getOpcode() == Instruction::SetLT) // A < MIN+1 -> A == MIN - return BinaryOperator::createSetEQ(Op0, SubOne(CI)); - if (I.getOpcode() == Instruction::SetGE) // A >= MIN-1 -> A != MIN - return BinaryOperator::createSetNE(Op0, SubOne(CI)); - - } else if (isMaxValueMinusOne(CI)) { - if (I.getOpcode() == Instruction::SetGT) // A > MAX-1 -> A == MAX - return BinaryOperator::createSetEQ(Op0, AddOne(CI)); - if (I.getOpcode() == Instruction::SetLE) // A <= MAX-1 -> A != MAX - return BinaryOperator::createSetNE(Op0, AddOne(CI)); + if (CI->isMinValue(false)) // A <=u MIN -> A == MIN + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1); + if (isMaxValueMinusOne(CI,false)) // A <=u MAX-1 -> A != MAX + return new ICmpInst(ICmpInst::ICMP_NE, Op0, AddOne(CI)); + break; + + case ICmpInst::ICMP_SLE: + if (CI->isMaxValue(true)) // A <=s MAX -> TRUE + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (CI->isMinValue(true)) // A <=s MIN -> A == MIN + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1); + if (isMaxValueMinusOne(CI,true)) // A <=s MAX-1 -> A != MAX + return new ICmpInst(ICmpInst::ICMP_NE, Op0, AddOne(CI)); + break; + + case ICmpInst::ICMP_UGE: + if (CI->isMinValue(false)) // A >=u MIN -> TRUE + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (CI->isMaxValue(false)) // A >=u MAX -> A == MAX + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1); + if (isMinValuePlusOne(CI,false)) // A >=u MIN-1 -> A != MIN + return new ICmpInst(ICmpInst::ICMP_NE, Op0, SubOne(CI)); + break; + + case ICmpInst::ICMP_SGE: + if (CI->isMinValue(true)) // A >=s MIN -> TRUE + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (CI->isMaxValue(true)) // A >=s MAX -> A == MAX + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1); + if (isMinValuePlusOne(CI,true)) // A >=s MIN-1 -> A != MIN + return new ICmpInst(ICmpInst::ICMP_NE, Op0, SubOne(CI)); + break; } - // If we still have a setle or setge instruction, turn it into the - // appropriate setlt or setgt instruction. Since the border cases have + // If we still have a icmp le or icmp ge instruction, turn it into the + // appropriate icmp lt or icmp gt instruction. Since the border cases have // already been handled above, this requires little checking. // - if (I.getOpcode() == Instruction::SetLE) - return BinaryOperator::createSetLT(Op0, AddOne(CI)); - if (I.getOpcode() == Instruction::SetGE) - return BinaryOperator::createSetGT(Op0, SubOne(CI)); - + if (I.getPredicate() == ICmpInst::ICMP_ULE) + return new ICmpInst(ICmpInst::ICMP_ULT, Op0, AddOne(CI)); + if (I.getPredicate() == ICmpInst::ICMP_SLE) + return new ICmpInst(ICmpInst::ICMP_SLT, Op0, AddOne(CI)); + if (I.getPredicate() == ICmpInst::ICMP_UGE) + return new ICmpInst( ICmpInst::ICMP_UGT, Op0, SubOne(CI)); + if (I.getPredicate() == ICmpInst::ICMP_SGE) + return new ICmpInst(ICmpInst::ICMP_SGT, Op0, SubOne(CI)); // See if we can fold the comparison based on bits known to be zero or one // in the input. @@ -4220,68 +4516,59 @@ // Given the known and unknown bits, compute a range that the LHS could be // in. if (KnownOne | KnownZero) { - if (Ty->isUnsigned()) { // Unsigned comparison. - uint64_t Min, Max; - uint64_t RHSVal = CI->getZExtValue(); - ComputeUnsignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne, - Min, Max); - switch (I.getOpcode()) { // LE/GE have been folded already. - default: assert(0 && "Unknown setcc opcode!"); - case Instruction::SetEQ: - if (Max < RHSVal || Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - break; - case Instruction::SetNE: - if (Max < RHSVal || Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getTrue()); - break; - case Instruction::SetLT: - if (Max < RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getTrue()); - if (Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - break; - case Instruction::SetGT: - if (Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getTrue()); - if (Max < RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - break; - } - } else { // Signed comparison. - int64_t Min, Max; - int64_t RHSVal = CI->getSExtValue(); - ComputeSignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne, - Min, Max); - switch (I.getOpcode()) { // LE/GE have been folded already. - default: assert(0 && "Unknown setcc opcode!"); - case Instruction::SetEQ: - if (Max < RHSVal || Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - break; - case Instruction::SetNE: - if (Max < RHSVal || Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getTrue()); - break; - case Instruction::SetLT: - if (Max < RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getTrue()); - if (Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - break; - case Instruction::SetGT: - if (Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getTrue()); - if (Max < RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - break; - } + // Compute the Min, Max and RHS values based on the known bits. For the + // EQ and NE we use unsigned values. + uint64_t UMin, UMax, URHSVal; + int64_t SMin, SMax, SRHSVal; + if (ICmpInst::isSignedPredicate(I.getPredicate())) { + SRHSVal = CI->getSExtValue(); + ComputeSignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne, SMin, + SMax); + } else { + URHSVal = CI->getZExtValue(); + ComputeUnsignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne, UMin, + UMax); + } + switch (I.getPredicate()) { // LE/GE have been folded already. + default: assert(0 && "Unknown icmp opcode!"); + case ICmpInst::ICMP_EQ: + if (UMax < URHSVal || UMin > URHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); + break; + case ICmpInst::ICMP_NE: + if (UMax < URHSVal || UMin > URHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + break; + case ICmpInst::ICMP_ULT: + if (UMax < URHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (UMin > URHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); + break; + case ICmpInst::ICMP_UGT: + if (UMin > URHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (UMax < URHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); + break; + case ICmpInst::ICMP_SLT: + if (SMax < SRHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (SMin > SRHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); + break; + case ICmpInst::ICMP_SGT: + if (SMin > SRHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (SMax < SRHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); + break; } } - // Since the RHS is a constantInt (CI), if the left hand side is an + // Since the RHS is a ConstantInt (CI), if the left hand side is an // instruction, see if that instruction also has constants so that the - // instruction can be folded into the setcc + // instruction can be folded into the icmp if (Instruction *LHSI = dyn_cast(Op0)) switch (LHSI->getOpcode()) { case Instruction::And: @@ -4289,7 +4576,7 @@ LHSI->getOperand(0)->hasOneUse()) { ConstantInt *AndCST = cast(LHSI->getOperand(1)); - // If an operand is an AND of a truncating cast, we can widen the + // If the LHS is an AND of a truncating cast, we can widen the // and/compare to be the input width without changing the value // produced, eliminating a cast. if (CastInst *Cast = dyn_cast(LHSI->getOperand(0))) { @@ -4318,7 +4605,7 @@ BinaryOperator::createAnd(Cast->getOperand(0), NewCST, LHSI->getName()); InsertNewInstBefore(NewAnd, I); - return new SetCondInst(I.getOpcode(), NewAnd, NewCI); + return new ICmpInst(I.getPredicate(), NewAnd, NewCI); } } @@ -4372,9 +4659,9 @@ // If we shifted bits out, the fold is not going to work out. // As a special case, check to see if this means that the // result is always true or false now. - if (I.getOpcode() == Instruction::SetEQ) + if (I.getPredicate() == ICmpInst::ICMP_EQ) return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - if (I.getOpcode() == Instruction::SetNE) + if (I.getPredicate() == ICmpInst::ICMP_NE) return ReplaceInstUsesWith(I, ConstantBool::getTrue()); } else { I.setOperand(1, NewCst); @@ -4438,7 +4725,7 @@ } break; - case Instruction::Shl: // (setcc (shl X, ShAmt), CI) + case Instruction::Shl: // (icmp pred (shl X, ShAmt), CI) if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { if (I.isEquality()) { unsigned TypeBits = CI->getType()->getPrimitiveSizeInBits(); @@ -4454,8 +4741,8 @@ Constant *Comp = ConstantExpr::getShl(ConstantExpr::getLShr(CI, ShAmt), ShAmt); if (Comp != CI) {// Comparing against a bit that we know is zero. - bool IsSetNE = I.getOpcode() == Instruction::SetNE; - Constant *Cst = ConstantBool::get(IsSetNE); + bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; + Constant *Cst = ConstantBool::get(IsICMP_NE); return ReplaceInstUsesWith(I, Cst); } @@ -4477,14 +4764,14 @@ BinaryOperator::createAnd(LHSI->getOperand(0), Mask, LHSI->getName()+".mask"); Value *And = InsertNewInstBefore(AndI, I); - return new SetCondInst(I.getOpcode(), And, + return new ICmpInst(I.getPredicate(), And, ConstantExpr::getLShr(CI, ShAmt)); } } } break; - case Instruction::LShr: // (setcc (shr X, ShAmt), CI) + case Instruction::LShr: // (icmp pred (shr X, ShAmt), CI) case Instruction::AShr: if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { if (I.isEquality()) { @@ -4506,8 +4793,8 @@ ShAmt); if (Comp != CI) {// Comparing against a bit that we know is zero. - bool IsSetNE = I.getOpcode() == Instruction::SetNE; - Constant *Cst = ConstantBool::get(IsSetNE); + bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; + Constant *Cst = ConstantBool::get(IsICMP_NE); return ReplaceInstUsesWith(I, Cst); } @@ -4530,7 +4817,7 @@ BinaryOperator::createAnd(LHSI->getOperand(0), Mask, LHSI->getName()+".mask"); Value *And = InsertNewInstBefore(AndI, I); - return new SetCondInst(I.getOpcode(), And, + return new ICmpInst(I.getPredicate(), And, ConstantExpr::getShl(CI, ShAmt)); } } @@ -4539,7 +4826,7 @@ case Instruction::SDiv: case Instruction::UDiv: - // Fold: setcc ([us]div X, C1), C2 -> range test + // Fold: icmp pred ([us]div X, C1), C2 -> range test // Fold this div into the comparison, producing a range check. // Determine, based on the divide type, what the range is being // checked. If there is an overflow on the low or high side, remember @@ -4554,11 +4841,8 @@ // (x /u C1) getType(); - unsigned DivOpCode = LHSI->getOpcode(); - if (I.isEquality() && - ((DivOpCode == Instruction::SDiv && DivRHSTy->isUnsigned()) || - (DivOpCode == Instruction::UDiv && DivRHSTy->isSigned()))) + bool DivIsSigned = LHSI->getOpcode() == Instruction::SDiv; + if (!I.isEquality() && DivIsSigned != I.isSignedPredicate()) break; // Initialize the variables that will indicate the nature of the @@ -4577,16 +4861,15 @@ // not equal to the divide. Make sure we do the same kind of divide // as in the LHS instruction that we're folding. bool ProdOV = !DivRHS->isNullValue() && - (DivOpCode == Instruction::SDiv ? - ConstantExpr::getSDiv(Prod, DivRHS) : + (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS) : ConstantExpr::getUDiv(Prod, DivRHS)) != CI; - // Get the SetCC opcode - Instruction::BinaryOps Opcode = I.getOpcode(); + // Get the ICmp opcode + ICmpInst::Predicate predicate = I.getPredicate(); if (DivRHS->isNullValue()) { // Don't hack on divide by zeros! - } else if (DivOpCode == Instruction::UDiv) { // udiv + } else if (!DivIsSigned) { // udiv LoBound = Prod; LoOverflow = ProdOV; HiOverflow = ProdOV || AddWithOverflow(HiBound, LoBound, DivRHS); @@ -4624,48 +4907,59 @@ } // Dividing by a negate swaps the condition. - Opcode = SetCondInst::getSwappedCondition(Opcode); + predicate = ICmpInst::getSwappedPredicate(predicate); } if (LoBound) { Value *X = LHSI->getOperand(0); - switch (Opcode) { - default: assert(0 && "Unhandled setcc opcode!"); - case Instruction::SetEQ: + switch (predicate) { + default: assert(0 && "Unhandled icmp opcode!"); + case ICmpInst::ICMP_EQ: if (LoOverflow && HiOverflow) return ReplaceInstUsesWith(I, ConstantBool::getFalse()); else if (HiOverflow) - return new SetCondInst(Instruction::SetGE, X, LoBound); + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : + ICmpInst::ICMP_UGE, X, LoBound); else if (LoOverflow) - return new SetCondInst(Instruction::SetLT, X, HiBound); + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : + ICmpInst::ICMP_ULT, X, HiBound); else - return InsertRangeTest(X, LoBound, HiBound, true, I); - case Instruction::SetNE: + return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, + true, I); + case ICmpInst::ICMP_NE: if (LoOverflow && HiOverflow) return ReplaceInstUsesWith(I, ConstantBool::getTrue()); else if (HiOverflow) - return new SetCondInst(Instruction::SetLT, X, LoBound); + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : + ICmpInst::ICMP_ULT, X, LoBound); else if (LoOverflow) - return new SetCondInst(Instruction::SetGE, X, HiBound); + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : + ICmpInst::ICMP_UGE, X, HiBound); else - return InsertRangeTest(X, LoBound, HiBound, false, I); - case Instruction::SetLT: + return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, + false, I); + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: if (LoOverflow) return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - return new SetCondInst(Instruction::SetLT, X, LoBound); - case Instruction::SetGT: + return new ICmpInst(predicate, X, LoBound); + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: if (HiOverflow) return ReplaceInstUsesWith(I, ConstantBool::getFalse()); - return new SetCondInst(Instruction::SetGE, X, HiBound); + if (predicate == ICmpInst::ICMP_UGT) + return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound); + else + return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound); } } } break; } - // Simplify seteq and setne instructions with integer constant RHS. + // Simplify icmp_eq and icmp_ne instructions with integer constant RHS. if (I.isEquality()) { - bool isSetNE = I.getOpcode() == Instruction::SetNE; + bool isICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; // If the first operand is (add|sub|and|or|xor|rem) with a constant, and // the second operand is a constant, simplify a bit. @@ -4679,8 +4973,8 @@ if (V > 1 && isPowerOf2_64(V)) { Value *NewRem = InsertNewInstBefore(BinaryOperator::createURem( BO->getOperand(0), BO->getOperand(1), BO->getName()), I); - return BinaryOperator::create(I.getOpcode(), NewRem, - Constant::getNullValue(BO->getType())); + return new ICmpInst(I.getPredicate(), NewRem, + Constant::getNullValue(BO->getType())); } } break; @@ -4688,22 +4982,22 @@ // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { if (BO->hasOneUse()) - return new SetCondInst(I.getOpcode(), BO->getOperand(0), - ConstantExpr::getSub(CI, BOp1C)); + return new ICmpInst(I.getPredicate(), BO->getOperand(0), + ConstantExpr::getSub(CI, BOp1C)); } else if (CI->isNullValue()) { // Replace ((add A, B) != 0) with (A != -B) if A or B is // efficiently invertible, or if the add has just this one use. Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1); if (Value *NegVal = dyn_castNegVal(BOp1)) - return new SetCondInst(I.getOpcode(), BOp0, NegVal); + return new ICmpInst(I.getPredicate(), BOp0, NegVal); else if (Value *NegVal = dyn_castNegVal(BOp0)) - return new SetCondInst(I.getOpcode(), NegVal, BOp1); + return new ICmpInst(I.getPredicate(), NegVal, BOp1); else if (BO->hasOneUse()) { Instruction *Neg = BinaryOperator::createNeg(BOp1, BO->getName()); BO->setName(""); InsertNewInstBefore(Neg, I); - return new SetCondInst(I.getOpcode(), BOp0, Neg); + return new ICmpInst(I.getPredicate(), BOp0, Neg); } } break; @@ -4711,15 +5005,15 @@ // For the xor case, we can xor two constants together, eliminating // the explicit xor. if (Constant *BOC = dyn_cast(BO->getOperand(1))) - return BinaryOperator::create(I.getOpcode(), BO->getOperand(0), - ConstantExpr::getXor(CI, BOC)); + return new ICmpInst(I.getPredicate(), BO->getOperand(0), + ConstantExpr::getXor(CI, BOC)); // FALLTHROUGH case Instruction::Sub: // Replace (([sub|xor] A, B) != 0) with (A != B) if (CI->isNullValue()) - return new SetCondInst(I.getOpcode(), BO->getOperand(0), - BO->getOperand(1)); + return new ICmpInst(I.getPredicate(), BO->getOperand(0), + BO->getOperand(1)); break; case Instruction::Or: @@ -4728,7 +5022,7 @@ if (Constant *BOC = dyn_cast(BO->getOperand(1))) { Constant *NotCI = ConstantExpr::getNot(CI); if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue()) - return ReplaceInstUsesWith(I, ConstantBool::get(isSetNE)); + return ReplaceInstUsesWith(I, ConstantBool::get(isICMP_NE)); } break; @@ -4738,16 +5032,15 @@ // comparison can never succeed! if (!ConstantExpr::getAnd(CI, ConstantExpr::getNot(BOC))->isNullValue()) - return ReplaceInstUsesWith(I, ConstantBool::get(isSetNE)); + return ReplaceInstUsesWith(I, ConstantBool::get(isICMP_NE)); // If we have ((X & C) == C), turn it into ((X & C) != 0). if (CI == BOC && isOneBitSet(CI)) - return new SetCondInst(isSetNE ? Instruction::SetEQ : - Instruction::SetNE, Op0, - Constant::getNullValue(CI->getType())); + return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : + ICmpInst::ICMP_NE, Op0, + Constant::getNullValue(CI->getType())); - // Replace (and X, (1 << size(X)-1) != 0) with x < 0, converting X - // to be a signed value as appropriate. + // Replace (and X, (1 << size(X)-1) != 0) with x s< 0 if (isSignBit(BOC)) { Value *X = BO->getOperand(0); // If 'X' is not signed, insert a cast now... @@ -4755,25 +5048,19 @@ const Type *DestTy = BOC->getType()->getSignedVersion(); X = InsertCastBefore(Instruction::BitCast, X, DestTy, I); } - return new SetCondInst(isSetNE ? Instruction::SetLT : - Instruction::SetGE, X, - Constant::getNullValue(X->getType())); + Constant *Zero = Constant::getNullValue(X->getType()); + ICmpInst::Predicate pred = isICMP_NE ? + ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE; + return new ICmpInst(pred, X, Zero); } // ((X & ~7) == 0) --> X < 8 if (CI->isNullValue() && isHighOnes(BOC)) { Value *X = BO->getOperand(0); Constant *NegX = ConstantExpr::getNeg(BOC); - - // If 'X' is signed, insert a cast now. - if (NegX->getType()->isSigned()) { - const Type *DestTy = NegX->getType()->getUnsignedVersion(); - X = InsertCastBefore(Instruction::BitCast, X, DestTy, I); - NegX = ConstantExpr::getBitCast(NegX, DestTy); - } - - return new SetCondInst(isSetNE ? Instruction::SetGE : - Instruction::SetLT, X, NegX); + ICmpInst::Predicate pred = isICMP_NE ? + ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; + return new ICmpInst(pred, X, NegX); } } @@ -4783,19 +5070,22 @@ // Handle set{eq|ne} , intcst. switch (II->getIntrinsicID()) { default: break; - case Intrinsic::bswap_i16: // seteq (bswap(x)), c -> seteq(x,bswap(c)) + case Intrinsic::bswap_i16: + // icmp eq (bswap(x)), c -> icmp eq (x,bswap(c)) WorkList.push_back(II); // Dead? I.setOperand(0, II->getOperand(1)); I.setOperand(1, ConstantInt::get(Type::UShortTy, ByteSwap_16(CI->getZExtValue()))); return &I; - case Intrinsic::bswap_i32: // seteq (bswap(x)), c -> seteq(x,bswap(c)) + case Intrinsic::bswap_i32: + // icmp eq (bswap(x)), c -> icmp eq (x,bswap(c)) WorkList.push_back(II); // Dead? I.setOperand(0, II->getOperand(1)); I.setOperand(1, ConstantInt::get(Type::UIntTy, ByteSwap_32(CI->getZExtValue()))); return &I; - case Intrinsic::bswap_i64: // seteq (bswap(x)), c -> seteq(x,bswap(c)) + case Intrinsic::bswap_i64: + // icmp eq (bswap(x)), c -> icmp eq (x,bswap(c)) WorkList.push_back(II); // Dead? I.setOperand(0, II->getOperand(1)); I.setOperand(1, ConstantInt::get(Type::ULongTy, @@ -4803,53 +5093,47 @@ return &I; } } - } else { // Not a SetEQ/SetNE - // If the LHS is a cast from an integral value of the same size, + } else { // Not a ICMP_EQ/ICMP_NE + // If the LHS is a cast from an integral value of the same size, then + // since we know the RHS is a constant, try to simlify. if (CastInst *Cast = dyn_cast(Op0)) { Value *CastOp = Cast->getOperand(0); const Type *SrcTy = CastOp->getType(); unsigned SrcTySize = SrcTy->getPrimitiveSizeInBits(); - if (SrcTy != Cast->getType() && SrcTy->isInteger() && + if (SrcTy->isInteger() && SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) { - assert((SrcTy->isSigned() ^ Cast->getType()->isSigned()) && - "Source and destination signednesses should differ!"); - if (Cast->getType()->isSigned()) { - // If this is a signed comparison, check for comparisons in the - // vicinity of zero. - if (I.getOpcode() == Instruction::SetLT && CI->isNullValue()) - // X < 0 => x > 127 - return BinaryOperator::createSetGT(CastOp, - ConstantInt::get(SrcTy, (1ULL << (SrcTySize-1))-1)); - else if (I.getOpcode() == Instruction::SetGT && - cast(CI)->getSExtValue() == -1) - // X > -1 => x < 128 - return BinaryOperator::createSetLT(CastOp, - ConstantInt::get(SrcTy, 1ULL << (SrcTySize-1))); - } else { - ConstantInt *CUI = cast(CI); - if (I.getOpcode() == Instruction::SetLT && - CUI->getZExtValue() == 1ULL << (SrcTySize-1)) - // X < 128 => X > -1 - return BinaryOperator::createSetGT(CastOp, - ConstantInt::get(SrcTy, -1)); - else if (I.getOpcode() == Instruction::SetGT && - CUI->getZExtValue() == (1ULL << (SrcTySize-1))-1) - // X > 127 => X < 0 - return BinaryOperator::createSetLT(CastOp, - Constant::getNullValue(SrcTy)); + // If this is an unsigned comparison, try to make the comparison use + // smaller constant values. + switch (I.getPredicate()) { + default: break; + case ICmpInst::ICMP_ULT: { // X u< 128 => X s> -1 + ConstantInt *CUI = cast(CI); + if (CUI->getZExtValue() == 1ULL << (SrcTySize-1)) + return new ICmpInst(ICmpInst::ICMP_SGT, CastOp, + ConstantInt::get(SrcTy, -1)); + break; + } + case ICmpInst::ICMP_UGT: { // X u> 127 => X s< 0 + ConstantInt *CUI = cast(CI); + if (CUI->getZExtValue() == (1ULL << (SrcTySize-1))-1) + return new ICmpInst(ICmpInst::ICMP_SLT, CastOp, + Constant::getNullValue(SrcTy)); + break; + } } + } } } } - // Handle setcc with constant RHS's that can be integer, FP or pointer. + // Handle icmp with constant RHS if (Constant *RHSC = dyn_cast(Op1)) { if (Instruction *LHSI = dyn_cast(Op0)) switch (LHSI->getOpcode()) { case Instruction::GetElementPtr: if (RHSC->isNullValue()) { - // Transform setcc GEP P, int 0, int 0, int 0, null -> setcc P, null + // icmp pred GEP (P, int 0, int 0, int 0), null -> icmp pred P, null bool isAllZeros = true; for (unsigned i = 1, e = LHSI->getNumOperands(); i != e; ++i) if (!isa(LHSI->getOperand(i)) || @@ -4858,7 +5142,7 @@ break; } if (isAllZeros) - return new SetCondInst(I.getOpcode(), LHSI->getOperand(0), + return new ICmpInst(I.getPredicate(), LHSI->getOperand(0), Constant::getNullValue(LHSI->getOperand(0)->getType())); } break; @@ -4875,18 +5159,18 @@ if (LHSI->hasOneUse()) { if (Constant *C = dyn_cast(LHSI->getOperand(1))) { // Fold the known value into the constant operand. - Op1 = ConstantExpr::get(I.getOpcode(), C, RHSC); - // Insert a new SetCC of the other select operand. - Op2 = InsertNewInstBefore(new SetCondInst(I.getOpcode(), - LHSI->getOperand(2), RHSC, - I.getName()), I); + Op1 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC); + // Insert a new ICmp of the other select operand. + Op2 = InsertNewInstBefore(new ICmpInst(I.getPredicate(), + LHSI->getOperand(2), RHSC, + I.getName()), I); } else if (Constant *C = dyn_cast(LHSI->getOperand(2))) { // Fold the known value into the constant operand. - Op2 = ConstantExpr::get(I.getOpcode(), C, RHSC); - // Insert a new SetCC of the other select operand. - Op1 = InsertNewInstBefore(new SetCondInst(I.getOpcode(), - LHSI->getOperand(1), RHSC, - I.getName()), I); + Op2 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC); + // Insert a new ICmp of the other select operand. + Op1 = InsertNewInstBefore(new ICmpInst(I.getPredicate(), + LHSI->getOperand(1), RHSC, + I.getName()), I); } } @@ -4896,16 +5180,16 @@ } } - // If we can optimize a 'setcc GEP, P' or 'setcc P, GEP', do so now. + // If we can optimize a 'icmp GEP, P' or 'icmp P, GEP', do so now. if (User *GEP = dyn_castGetElementPtr(Op0)) - if (Instruction *NI = FoldGEPSetCC(GEP, Op1, I.getOpcode(), I)) + if (Instruction *NI = FoldGEPICmp(GEP, Op1, I.getPredicate(), I)) return NI; if (User *GEP = dyn_castGetElementPtr(Op1)) - if (Instruction *NI = FoldGEPSetCC(GEP, Op0, - SetCondInst::getSwappedCondition(I.getOpcode()), I)) + if (Instruction *NI = FoldGEPICmp(GEP, Op0, + ICmpInst::getSwappedPredicate(I.getPredicate()), I)) return NI; - // Test to see if the operands of the setcc are casted versions of other + // Test to see if the operands of the icmp are casted versions of other // values. If the cast can be stripped off both arguments, we do so now. if (CastInst *CI = dyn_cast(Op0)) { Value *CastOp0 = CI->getOperand(0); @@ -4928,20 +5212,20 @@ if (Constant *Op1C = dyn_cast(Op1)) { Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType()); } else { - // Otherwise, cast the RHS right before the setcc + // Otherwise, cast the RHS right before the icmp Op1 = InsertCastBefore(Instruction::BitCast, Op1, Op0->getType(), I); } - return BinaryOperator::create(I.getOpcode(), Op0, Op1); + return new ICmpInst(I.getPredicate(), Op0, Op1); } - // Handle the special case of: setcc (cast bool to X), + // Handle the special case of: icmp (cast bool to X), // This comes up when you have code like // int X = A < B; // if (X) ... // For generality, we handle any zero-extension of any operand comparison // with a constant or another cast from the same type. if (isa(Op1) || isa(Op1)) - if (Instruction *R = visitSetCondInstWithCastAndCast(I)) + if (Instruction *R = visitICmpInstWithCastAndCast(I)) return R; } @@ -4951,22 +5235,22 @@ (A == Op1 || B == Op1)) { // (A^B) == A -> B == 0 Value *OtherVal = A == Op1 ? B : A; - return BinaryOperator::create(I.getOpcode(), OtherVal, - Constant::getNullValue(A->getType())); + return new ICmpInst(I.getPredicate(), OtherVal, + Constant::getNullValue(A->getType())); } else if (match(Op1, m_Xor(m_Value(A), m_Value(B))) && (A == Op0 || B == Op0)) { // A == (A^B) -> B == 0 Value *OtherVal = A == Op0 ? B : A; - return BinaryOperator::create(I.getOpcode(), OtherVal, - Constant::getNullValue(A->getType())); + return new ICmpInst(I.getPredicate(), OtherVal, + Constant::getNullValue(A->getType())); } else if (match(Op0, m_Sub(m_Value(A), m_Value(B))) && A == Op1) { // (A-B) == A -> B == 0 - return BinaryOperator::create(I.getOpcode(), B, - Constant::getNullValue(B->getType())); + return new ICmpInst(I.getPredicate(), B, + Constant::getNullValue(B->getType())); } else if (match(Op1, m_Sub(m_Value(A), m_Value(B))) && A == Op0) { // A == (A-B) -> B == 0 - return BinaryOperator::create(I.getOpcode(), B, - Constant::getNullValue(B->getType())); + return new ICmpInst(I.getPredicate(), B, + Constant::getNullValue(B->getType())); } Value *C, *D; @@ -4998,116 +5282,113 @@ return Changed ? &I : 0; } -// visitSetCondInstWithCastAndCast - Handle setcond (cast x to y), (cast/cst). +// visitICmpInstWithCastAndCast - Handle icmp (cast x to y), (cast/cst). // We only handle extending casts so far. // -Instruction *InstCombiner::visitSetCondInstWithCastAndCast(SetCondInst &SCI) { - const CastInst *LHSCI = cast(SCI.getOperand(0)); +Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { + const CastInst *LHSCI = cast(ICI.getOperand(0)); Value *LHSCIOp = LHSCI->getOperand(0); const Type *SrcTy = LHSCIOp->getType(); - const Type *DestTy = SCI.getOperand(0)->getType(); + const Type *DestTy = LHSCI->getType(); Value *RHSCIOp; - if (!DestTy->isIntegral() || !SrcTy->isIntegral()) + // We only handle extension cast instructions, so far. Enforce this. + if (LHSCI->getOpcode() != Instruction::ZExt && + LHSCI->getOpcode() != Instruction::SExt) return 0; - unsigned SrcBits = SrcTy->getPrimitiveSizeInBits(); - unsigned DestBits = DestTy->getPrimitiveSizeInBits(); - if (SrcBits >= DestBits) return 0; // Only handle extending cast. - - // Is this a sign or zero extension? - bool isSignSrc = SrcTy->isSigned(); - bool isSignDest = DestTy->isSigned(); + bool isSignedExt = LHSCI->getOpcode() == Instruction::SExt; + bool isSignedCmp = ICI.isSignedPredicate(); - if (CastInst *CI = dyn_cast(SCI.getOperand(1))) { + if (CastInst *CI = dyn_cast(ICI.getOperand(1))) { // Not an extension from the same type? RHSCIOp = CI->getOperand(0); - if (RHSCIOp->getType() != LHSCIOp->getType()) return 0; - } else if (ConstantInt *CI = dyn_cast(SCI.getOperand(1))) { - // Compute the constant that would happen if we truncated to SrcTy then - // reextended to DestTy. - Constant *Res1 = ConstantExpr::getTrunc(CI, SrcTy); - Constant *Res2 = ConstantExpr::getCast(LHSCI->getOpcode(), Res1, DestTy); + if (RHSCIOp->getType() != LHSCIOp->getType()) + return 0; + else + // Okay, just insert a compare of the reduced operands now! + return new ICmpInst(ICI.getPredicate(), LHSCIOp, RHSCIOp); + } - if (Res2 == CI) { - // Make sure that src sign and dest sign match. For example, - // - // %A = cast short %X to uint - // %B = setgt uint %A, 1330 - // - // It is incorrect to transform this into - // - // %B = setgt short %X, 1330 - // - // because %A may have negative value. - // However, it is OK if SrcTy is bool (See cast-set.ll testcase) - // OR operation is EQ/NE. - if (isSignSrc == isSignDest || SrcTy == Type::BoolTy || SCI.isEquality()) - RHSCIOp = Res1; - else - return 0; - } else { - // If the value cannot be represented in the shorter type, we cannot emit - // a simple comparison. - if (SCI.getOpcode() == Instruction::SetEQ) - return ReplaceInstUsesWith(SCI, ConstantBool::getFalse()); - if (SCI.getOpcode() == Instruction::SetNE) - return ReplaceInstUsesWith(SCI, ConstantBool::getTrue()); - - // Evaluate the comparison for LT. - Value *Result; - if (DestTy->isSigned()) { - // We're performing a signed comparison. - if (isSignSrc) { - // Signed extend and signed comparison. - if (cast(CI)->getSExtValue() < 0)// X < (small) --> false - Result = ConstantBool::getFalse(); - else - Result = ConstantBool::getTrue(); // X < (large) --> true - } else { - // Unsigned extend and signed comparison. - if (cast(CI)->getSExtValue() < 0) - Result = ConstantBool::getFalse(); - else - Result = ConstantBool::getTrue(); - } - } else { - // We're performing an unsigned comparison. - if (!isSignSrc) { - // Unsigned extend & compare -> always true. - Result = ConstantBool::getTrue(); - } else { - // We're performing an unsigned comp with a sign extended value. - // This is true if the input is >= 0. [aka >s -1] - Constant *NegOne = ConstantIntegral::getAllOnesValue(SrcTy); - Result = InsertNewInstBefore(BinaryOperator::createSetGT(LHSCIOp, - NegOne, SCI.getName()), SCI); - } - } + // If we aren't dealing with a constant on the RHS, exit early + ConstantInt *CI = dyn_cast(ICI.getOperand(1)); + if (!CI) + return 0; - // Finally, return the value computed. - if (SCI.getOpcode() == Instruction::SetLT) { - return ReplaceInstUsesWith(SCI, Result); - } else { - assert(SCI.getOpcode()==Instruction::SetGT &&"SetCC should be folded!"); - if (Constant *CI = dyn_cast(Result)) - return ReplaceInstUsesWith(SCI, ConstantExpr::getNot(CI)); - else - return BinaryOperator::createNot(Result); - } - } + // Compute the constant that would happen if we truncated to SrcTy then + // reextended to DestTy. + Constant *Res1 = ConstantExpr::getTrunc(CI, SrcTy); + Constant *Res2 = ConstantExpr::getCast(LHSCI->getOpcode(), Res1, DestTy); + + // If the re-extended constant didn't change... + if (Res2 == CI) { + // Make sure that sign of the Cmp and the sign of the Cast are the same. + // For example, we might have: + // %A = sext short %X to uint + // %B = icmp ugt uint %A, 1330 + // It is incorrect to transform this into + // %B = icmp ugt short %X, 1330 + // because %A may have negative value. + // + // However, it is OK if SrcTy is bool (See cast-set.ll testcase) + // OR operation is EQ/NE. + if (isSignedExt == isSignedCmp || SrcTy == Type::BoolTy || ICI.isEquality()) + return new ICmpInst(ICI.getPredicate(), LHSCIOp, Res1); + else + return 0; + } + + // The re-extended constant changed so the constant cannot be represented + // in the shorter type. Consequently, we cannot emit a simple comparison. + + // First, handle some easy cases. We know the result cannot be equal at this + // point so handle the ICI.isEquality() cases + if (ICI.getPredicate() == ICmpInst::ICMP_EQ) + return ReplaceInstUsesWith(ICI, ConstantBool::getFalse()); + if (ICI.getPredicate() == ICmpInst::ICMP_NE) + return ReplaceInstUsesWith(ICI, ConstantBool::getTrue()); + + // Evaluate the comparison for LT (we invert for GT below). LE and GE cases + // should have been folded away previously and not enter in here. + Value *Result; + if (isSignedCmp) { + // We're performing a signed comparison. + if (cast(CI)->getSExtValue() < 0) + Result = ConstantBool::getFalse(); // X < (small) --> false + else + Result = ConstantBool::getTrue(); // X < (large) --> true } else { - return 0; + // We're performing an unsigned comparison. + if (isSignedExt) { + // We're performing an unsigned comp with a sign extended value. + // This is true if the input is >= 0. [aka >s -1] + Constant *NegOne = ConstantIntegral::getAllOnesValue(SrcTy); + Result = InsertNewInstBefore(new ICmpInst(ICmpInst::ICMP_SGT, LHSCIOp, + NegOne, ICI.getName()), ICI); + } else { + // Unsigned extend & unsigned compare -> always true. + Result = ConstantBool::getTrue(); + } } - // Okay, just insert a compare of the reduced operands now! - return BinaryOperator::create(SCI.getOpcode(), LHSCIOp, RHSCIOp); + // Finally, return the value computed. + if (ICI.getPredicate() == ICmpInst::ICMP_ULT || + ICI.getPredicate() == ICmpInst::ICMP_SLT) { + return ReplaceInstUsesWith(ICI, Result); + } else { + assert((ICI.getPredicate()==ICmpInst::ICMP_UGT || + ICI.getPredicate()==ICmpInst::ICMP_SGT) && + "ICmp should be folded!"); + if (Constant *CI = dyn_cast(Result)) + return ReplaceInstUsesWith(ICI, ConstantExpr::getNot(CI)); + else + return BinaryOperator::createNot(Result); + } } Instruction *InstCombiner::visitShiftInst(ShiftInst &I) { assert(I.getOperand(1)->getType() == Type::UByteTy); Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - bool isLeftShift = I.getOpcode() == Instruction::Shl; // shl X, 0 == X and shr X, 0 == X // shl 0, X == 0 and shr 0, X == 0 @@ -5115,17 +5396,17 @@ Op0 == Constant::getNullValue(Op0->getType())) return ReplaceInstUsesWith(I, Op0); - if (isa(Op0)) { // undef >>s X -> undef - if (!isLeftShift && I.getType()->isSigned()) + if (isa(Op0)) { + if (I.getOpcode() == Instruction::AShr) // undef >>s X -> undef return ReplaceInstUsesWith(I, Op0); - else // undef << X -> 0 AND undef >>u X -> 0 + else // undef << X -> 0, undef >>u X -> 0 return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); } if (isa(Op1)) { - if (isLeftShift || I.getType()->isUnsigned())// X << undef, X >>u undef -> 0 + if (I.getOpcode() == Instruction::AShr) // X >>s undef -> X + return ReplaceInstUsesWith(I, Op0); + else // X << undef, X >>u undef -> 0 return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); - else - return ReplaceInstUsesWith(I, Op0); // X >>s undef -> X } // ashr int -1, X = -1 (for any arithmetic shift rights of ~0) @@ -5157,9 +5438,8 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, ShiftInst &I) { - bool isLeftShift = I.getOpcode() == Instruction::Shl; - bool isSignedShift = isLeftShift ? Op0->getType()->isSigned() : - I.getOpcode() == Instruction::AShr; + bool isLeftShift = I.getOpcode() == Instruction::Shl; + bool isSignedShift = I.getOpcode() == Instruction::AShr; bool isUnsignedShift = !isSignedShift; // See if we can simplify any instructions used by the instruction whose sole @@ -5348,10 +5628,8 @@ // Find the operands and properties of the input shift. Note that the // signedness of the input shift may differ from the current shift if there // is a noop cast between the two. - bool isShiftOfLeftShift = ShiftOp->getOpcode() == Instruction::Shl; - bool isShiftOfSignedShift = isShiftOfLeftShift ? - ShiftOp->getType()->isSigned() : - ShiftOp->getOpcode() == Instruction::AShr; + bool isShiftOfLeftShift = ShiftOp->getOpcode() == Instruction::Shl; + bool isShiftOfSignedShift = ShiftOp->getOpcode() == Instruction::AShr; bool isShiftOfUnsignedShift = !isShiftOfSignedShift; ConstantInt *ShiftAmt1C = cast(ShiftOp->getOperand(1)); @@ -5781,11 +6059,11 @@ // If the source isn't an instruction or has more than one use then we // can't do anything more. - if (!isa(Src) || !Src->hasOneUse()) + Instruction *SrcI = dyn_cast(Src); + if (!SrcI || !Src->hasOneUse()) return 0; // Attempt to propagate the cast into the instruction. - Instruction *SrcI = cast(Src); int NumCastsRemoved = 0; if (CanEvaluateInDifferentType(SrcI, DestTy, NumCastsRemoved)) { // If this cast is a truncate, evaluting in a different type always @@ -5867,8 +6145,8 @@ // two casts to be inserted if the sizes are the same. This could // only be converting signedness, which is a noop. if (DestBitSize == SrcBitSize || - !ValueRequiresCast(Op1, DestTy,TD) || - !ValueRequiresCast(Op0, DestTy, TD)) { + !ValueRequiresCast(CI.getOpcode(), Op1, DestTy,TD) || + !ValueRequiresCast(CI.getOpcode(), Op0, DestTy, TD)) { Instruction::CastOps opcode = CI.getOpcode(); Value *Op0c = InsertOperandCastBefore(opcode, Op0, DestTy, SrcI); Value *Op1c = InsertOperandCastBefore(opcode, Op1, DestTy, SrcI); @@ -5881,7 +6159,7 @@ if (isa(CI) && SrcBitSize == 1 && SrcI->getOpcode() == Instruction::Xor && Op1 == ConstantBool::getTrue() && - (!Op0->hasOneUse() || !isa(Op0))) { + (!Op0->hasOneUse() || !isa(Op0))) { Value *New = InsertOperandCastBefore(Instruction::ZExt, Op0, DestTy, &CI); return BinaryOperator::createXor(New, ConstantInt::get(CI.getType(), 1)); } @@ -5895,8 +6173,8 @@ // Don't insert two casts if they cannot be eliminated. We allow // two casts to be inserted if the sizes are the same. This could // only be converting signedness, which is a noop. - if (!ValueRequiresCast(Op1, DestTy,TD) || - !ValueRequiresCast(Op0, DestTy, TD)) { + if (!ValueRequiresCast(CI.getOpcode(), Op1, DestTy, TD) || + !ValueRequiresCast(CI.getOpcode(), Op0, DestTy, TD)) { Value *Op0c = InsertOperandCastBefore(Instruction::BitCast, Op0, DestTy, SrcI); Value *Op1c = InsertOperandCastBefore(Instruction::BitCast, @@ -5935,10 +6213,9 @@ } break; - case Instruction::SetEQ: - case Instruction::SetNE: - // If we are just checking for a seteq of a single bit and casting it - // to an integer. If so, shift the bit to the appropriate place then + case Instruction::ICmp: + // If we are just checking for a icmp eq of a single bit and casting it + // to an integer, then shift the bit to the appropriate place and then // cast to integer to avoid the comparison. if (ConstantInt *Op1C = dyn_cast(Op1)) { uint64_t Op1CV = Op1C->getZExtValue(); @@ -5955,13 +6232,18 @@ uint64_t KnownZero, KnownOne; uint64_t TypeMask = Op1->getType()->getIntegralTypeMask(); ComputeMaskedBits(Op0, TypeMask, KnownZero, KnownOne); + + // This only works for EQ and NE + ICmpInst::Predicate pred = cast(SrcI)->getPredicate(); + if (pred != ICmpInst::ICMP_NE && pred != ICmpInst::ICMP_EQ) + break; if (isPowerOf2_64(KnownZero^TypeMask)) { // Exactly 1 possible 1? - bool isSetNE = SrcI->getOpcode() == Instruction::SetNE; + bool isNE = pred == ICmpInst::ICMP_NE; if (Op1CV && (Op1CV != (KnownZero^TypeMask))) { // (X&4) == 2 --> false // (X&4) != 2 --> true - Constant *Res = ConstantBool::get(isSetNE); + Constant *Res = ConstantBool::get(isNE); Res = ConstantExpr::getZExt(Res, CI.getType()); return ReplaceInstUsesWith(CI, Res); } @@ -5977,7 +6259,7 @@ In->getName()+".lobit"), CI); } - if ((Op1CV != 0) == isSetNE) { // Toggle the low bit. + if ((Op1CV != 0) == isNE) { // Toggle the low bit. Constant *One = ConstantInt::get(In->getType(), 1); In = BinaryOperator::createXor(In, One, "tmp"); InsertNewInstBefore(cast(In), CI); @@ -6039,7 +6321,7 @@ SrcI->getOperand(0), "tmp"), CI); Value *Zero = Constant::getNullValue(V->getType()); - return BinaryOperator::createSetNE(V, Zero); + return new ICmpInst(ICmpInst::ICMP_NE, V, Zero); } } break; @@ -6272,8 +6554,14 @@ TI->getType()); } - // Only handle binary operators here. - if (!isa(TI) && !isa(TI)) + // Only handle binary, compare and shift operators here. + if (!isa(TI) && !isa(TI) && !isa(TI)) + return 0; + + // If the CmpInst predicates don't match, then the instructions aren't the + // same and we can't continue. + if (isa(TI) && isa(FI) && + (cast(TI)->getPredicate() != cast(FI)->getPredicate())) return 0; // Figure out if the operations have any operands in common. @@ -6387,20 +6675,20 @@ return CastInst::create(Instruction::ZExt, NotCond, SI.getType()); } - if (SetCondInst *IC = dyn_cast(SI.getCondition())) { + if (ICmpInst *IC = dyn_cast(SI.getCondition())) { - // (x sra x, 31 - // (x >u 2147483647) ? -1 : 0 -> sra x, 31 + // (x ashr x, 31 + // (x >u 2147483647) ? -1 : 0 -> ashr x, 31 if (TrueValC->isAllOnesValue() && FalseValC->isNullValue()) if (ConstantInt *CmpCst = dyn_cast(IC->getOperand(1))) { bool CanXForm = false; - if (CmpCst->getType()->isSigned()) + if (IC->isSignedPredicate()) CanXForm = CmpCst->isNullValue() && - IC->getOpcode() == Instruction::SetLT; + IC->getPredicate() == ICmpInst::ICMP_SLT; else { unsigned Bits = CmpCst->getType()->getPrimitiveSizeInBits(); CanXForm = (CmpCst->getZExtValue() == ~0ULL >> (64-Bits+1)) && - IC->getOpcode() == Instruction::SetGT; + IC->getPredicate() == ICmpInst::ICMP_UGT; } if (CanXForm) { @@ -6428,7 +6716,7 @@ // If one of the constants is zero (we know they can't both be) and we - // have a setcc instruction with zero, and we have an 'and' with the + // have a fcmp instruction with zero, and we have an 'and' with the // non-constant value, eliminate this whole mess. This corresponds to // cases like this: ((X & 27) ? 27 : 0) if (TrueValC->isNullValue() || FalseValC->isNullValue()) @@ -6441,10 +6729,10 @@ ICA->getOperand(1) == FalseValC) && isOneBitSet(cast(ICA->getOperand(1)))) { // Okay, now we know that everything is set up, we just don't - // know whether we have a setne or seteq and whether the true or - // false val is the zero. + // know whether we have a icmp_ne or icmp_eq and whether the + // true or false val is the zero. bool ShouldNotVal = !TrueValC->isNullValue(); - ShouldNotVal ^= IC->getOpcode() == Instruction::SetNE; + ShouldNotVal ^= IC->getPredicate() == ICmpInst::ICMP_NE; Value *V = ICA; if (ShouldNotVal) V = InsertNewInstBefore(BinaryOperator::create( @@ -6455,22 +6743,44 @@ } // See if we are selecting two values based on a comparison of the two values. - if (SetCondInst *SCI = dyn_cast(CondVal)) { - if (SCI->getOperand(0) == TrueVal && SCI->getOperand(1) == FalseVal) { + if (FCmpInst *FCI = dyn_cast(CondVal)) { + if (FCI->getOperand(0) == TrueVal && FCI->getOperand(1) == FalseVal) { // Transform (X == Y) ? X : Y -> Y - if (SCI->getOpcode() == Instruction::SetEQ) + if (FCI->getPredicate() == FCmpInst::FCMP_OEQ) return ReplaceInstUsesWith(SI, FalseVal); // Transform (X != Y) ? X : Y -> X - if (SCI->getOpcode() == Instruction::SetNE) + if (FCI->getPredicate() == FCmpInst::FCMP_ONE) return ReplaceInstUsesWith(SI, TrueVal); // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc. - } else if (SCI->getOperand(0) == FalseVal && SCI->getOperand(1) == TrueVal){ + } else if (FCI->getOperand(0) == FalseVal && FCI->getOperand(1) == TrueVal){ // Transform (X == Y) ? Y : X -> X - if (SCI->getOpcode() == Instruction::SetEQ) + if (FCI->getPredicate() == FCmpInst::FCMP_OEQ) return ReplaceInstUsesWith(SI, FalseVal); // Transform (X != Y) ? Y : X -> Y - if (SCI->getOpcode() == Instruction::SetNE) + if (FCI->getPredicate() == FCmpInst::FCMP_ONE) + return ReplaceInstUsesWith(SI, TrueVal); + // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc. + } + } + + // See if we are selecting two values based on a comparison of the two values. + if (ICmpInst *ICI = dyn_cast(CondVal)) { + if (ICI->getOperand(0) == TrueVal && ICI->getOperand(1) == FalseVal) { + // Transform (X == Y) ? X : Y -> Y + if (ICI->getPredicate() == ICmpInst::ICMP_EQ) + return ReplaceInstUsesWith(SI, FalseVal); + // Transform (X != Y) ? X : Y -> X + if (ICI->getPredicate() == ICmpInst::ICMP_NE) + return ReplaceInstUsesWith(SI, TrueVal); + // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc. + + } else if (ICI->getOperand(0) == FalseVal && ICI->getOperand(1) == TrueVal){ + // Transform (X == Y) ? Y : X -> X + if (ICI->getPredicate() == ICmpInst::ICMP_EQ) + return ReplaceInstUsesWith(SI, FalseVal); + // Transform (X != Y) ? Y : X -> Y + if (ICI->getPredicate() == ICmpInst::ICMP_NE) return ReplaceInstUsesWith(SI, TrueVal); // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc. } @@ -7096,7 +7406,7 @@ Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) { Instruction *FirstInst = cast(PN.getIncomingValue(0)); assert(isa(FirstInst) || isa(FirstInst) || - isa(FirstInst)); + isa(FirstInst) || isa(FirstInst)); unsigned Opc = FirstInst->getOpcode(); Value *LHSVal = FirstInst->getOperand(0); Value *RHSVal = FirstInst->getOperand(1); @@ -7109,11 +7419,17 @@ for (unsigned i = 0; i != PN.getNumIncomingValues(); ++i) { Instruction *I = dyn_cast(PN.getIncomingValue(i)); if (!I || I->getOpcode() != Opc || !I->hasOneUse() || - // Verify type of the LHS matches so we don't fold setcc's of different + // Verify type of the LHS matches so we don't fold cmp's of different // types or GEP's with different index types. I->getOperand(0)->getType() != LHSType || I->getOperand(1)->getType() != RHSType) return 0; + + // If they are CmpInst instructions, check their predicates + if (Opc == Instruction::ICmp || Opc == Instruction::FCmp) + if (cast(I)->getPredicate() != + cast(FirstInst)->getPredicate()) + return 0; // Keep track of which operand needs a phi node. if (I->getOperand(0) != LHSVal) LHSVal = 0; @@ -7161,6 +7477,9 @@ if (BinaryOperator *BinOp = dyn_cast(FirstInst)) return BinaryOperator::create(BinOp->getOpcode(), LHSVal, RHSVal); + else if (CmpInst *CIOp = dyn_cast(FirstInst)) + return CmpInst::create(CIOp->getOpcode(), CIOp->getPredicate(), LHSVal, + RHSVal); else if (ShiftInst *SI = dyn_cast(FirstInst)) return new ShiftInst(SI->getOpcode(), LHSVal, RHSVal); else { @@ -7198,9 +7517,10 @@ bool isVolatile = false; if (isa(FirstInst)) { CastSrcTy = FirstInst->getOperand(0)->getType(); - } else if (isa(FirstInst) || isa(FirstInst)) { - // Can fold binop or shift here if the RHS is a constant, otherwise call - // FoldPHIArgBinOpIntoPHI. + } else if (isa(FirstInst) || isa(FirstInst) || + isa(FirstInst)) { + // Can fold binop, compare or shift here if the RHS is a constant, + // otherwise call FoldPHIArgBinOpIntoPHI. ConstantOp = dyn_cast(FirstInst->getOperand(1)); if (ConstantOp == 0) return FoldPHIArgBinOpIntoPHI(PN); @@ -7224,14 +7544,14 @@ for (unsigned i = 1, e = PN.getNumIncomingValues(); i != e; ++i) { if (!isa(PN.getIncomingValue(i))) return 0; Instruction *I = cast(PN.getIncomingValue(i)); - if (!I->hasOneUse() || I->getOpcode() != FirstInst->getOpcode()) + if (!I->hasOneUse() || !I->isSameOperationAs(FirstInst)) return 0; if (CastSrcTy) { if (I->getOperand(0)->getType() != CastSrcTy) return 0; // Cast operation must match. } else if (LoadInst *LI = dyn_cast(I)) { - // We can't sink the load if the loaded value could be modified between the - // load and the PHI. + // We can't sink the load if the loaded value could be modified between + // the load and the PHI. if (LI->isVolatile() != isVolatile || LI->getParent() != PN.getIncomingBlock(i) || !isSafeToSinkLoad(LI)) @@ -7276,6 +7596,9 @@ return new LoadInst(PhiVal, "", isVolatile); else if (BinaryOperator *BinOp = dyn_cast(FirstInst)) return BinaryOperator::create(BinOp->getOpcode(), PhiVal, ConstantOp); + else if (CmpInst *CIOp = dyn_cast(FirstInst)) + return CmpInst::create(CIOp->getOpcode(), CIOp->getPredicate(), + PhiVal, ConstantOp); else return new ShiftInst(cast(FirstInst)->getOpcode(), PhiVal, ConstantOp); @@ -7380,11 +7703,9 @@ } } else if (SrcTy->getPrimitiveSize() < DestTy->getPrimitiveSize() && SrcTy->getPrimitiveSize() == 4) { - // We can always eliminate a cast from int to [u]long. We can - // eliminate a cast from uint to [u]long iff the target is a 32-bit - // pointer target. - if (SrcTy->isSigned() || - SrcTy->getPrimitiveSizeInBits() >= TD->getPointerSizeInBits()) { + // We can eliminate a cast from [u]int to [u]long iff the target + // is a 32-bit pointer target. + if (SrcTy->getPrimitiveSizeInBits() >= TD->getPointerSizeInBits()) { MadeChange = true; GEP.setOperand(i, Src); } @@ -7398,8 +7719,7 @@ Value *Op = GEP.getOperand(i); if (Op->getType()->getPrimitiveSize() > TD->getPointerSize()) if (Constant *C = dyn_cast(Op)) { - GEP.setOperand(i, ConstantExpr::getTrunc(C, - TD->getIntPtrType()->getSignedVersion())); + GEP.setOperand(i, ConstantExpr::getTrunc(C, TD->getIntPtrType())); MadeChange = true; } else { Op = InsertCastBefore(Instruction::Trunc, Op, TD->getIntPtrType(), @@ -7407,7 +7727,6 @@ GEP.setOperand(i, Op); MadeChange = true; } - // If this is a constant idx, make sure to canonicalize it to be a signed // operand, otherwise CSE and other optimizations are pessimized. if (ConstantInt *CUI = dyn_cast(Op)) @@ -7589,10 +7908,7 @@ isa(Inst->getOperand(1))) { unsigned ShAmt = cast(Inst->getOperand(1))->getZExtValue(); - if (Inst->getType()->isSigned()) - Scale = ConstantInt::get(Inst->getType(), 1ULL << ShAmt); - else - Scale = ConstantInt::get(Inst->getType(), 1ULL << ShAmt); + Scale = ConstantInt::get(Inst->getType(), 1ULL << ShAmt); NewIdx = Inst->getOperand(0); } else if (Inst->getOpcode() == Instruction::Mul && isa(Inst->getOperand(1))) { @@ -8104,16 +8420,37 @@ return &BI; } - // Cannonicalize setne -> seteq - Instruction::BinaryOps Op; Value *Y; - if (match(&BI, m_Br(m_SetCond(Op, m_Value(X), m_Value(Y)), + // Cannonicalize fcmp_one -> fcmp_oeq + FCmpInst::Predicate FPred; Value *Y; + if (match(&BI, m_Br(m_FCmp(FPred, m_Value(X), m_Value(Y)), + TrueDest, FalseDest))) + if ((FPred == FCmpInst::FCMP_ONE || FPred == FCmpInst::FCMP_OLE || + FPred == FCmpInst::FCMP_OGE) && BI.getCondition()->hasOneUse()) { + FCmpInst *I = cast(BI.getCondition()); + std::string Name = I->getName(); I->setName(""); + FCmpInst::Predicate NewPred = FCmpInst::getInversePredicate(FPred); + Value *NewSCC = new FCmpInst(NewPred, X, Y, Name, I); + // Swap Destinations and condition... + BI.setCondition(NewSCC); + BI.setSuccessor(0, FalseDest); + BI.setSuccessor(1, TrueDest); + removeFromWorkList(I); + I->getParent()->getInstList().erase(I); + WorkList.push_back(cast(NewSCC)); + return &BI; + } + + // Cannonicalize icmp_ne -> icmp_eq + ICmpInst::Predicate IPred; + if (match(&BI, m_Br(m_ICmp(IPred, m_Value(X), m_Value(Y)), TrueDest, FalseDest))) - if ((Op == Instruction::SetNE || Op == Instruction::SetLE || - Op == Instruction::SetGE) && BI.getCondition()->hasOneUse()) { - SetCondInst *I = cast(BI.getCondition()); + if ((IPred == ICmpInst::ICMP_NE || IPred == ICmpInst::ICMP_ULE || + IPred == ICmpInst::ICMP_SLE || IPred == ICmpInst::ICMP_UGE || + IPred == ICmpInst::ICMP_SGE) && BI.getCondition()->hasOneUse()) { + ICmpInst *I = cast(BI.getCondition()); std::string Name = I->getName(); I->setName(""); - Instruction::BinaryOps NewOpcode = SetCondInst::getInverseCondition(Op); - Value *NewSCC = BinaryOperator::create(NewOpcode, X, Y, Name, I); + ICmpInst::Predicate NewPred = ICmpInst::getInversePredicate(IPred); + Value *NewSCC = new ICmpInst(NewPred, X, Y, Name, I); // Swap Destinations and condition... BI.setCondition(NewSCC); BI.setSuccessor(0, FalseDest); @@ -8173,6 +8510,11 @@ (CheapToScalarize(BO->getOperand(0), isConstant) || CheapToScalarize(BO->getOperand(1), isConstant))) return true; + if (CmpInst *CI = dyn_cast(I)) + if (CI->hasOneUse() && + (CheapToScalarize(CI->getOperand(0), isConstant) || + CheapToScalarize(CI->getOperand(1), isConstant))) + return true; return false; } Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.83 llvm/lib/Transforms/Scalar/LICM.cpp:1.84 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.83 Tue Dec 19 15:40:18 2006 +++ llvm/lib/Transforms/Scalar/LICM.cpp Sat Dec 23 00:05:41 2006 @@ -385,7 +385,7 @@ // Otherwise these instructions are hoistable/sinkable return isa(I) || isa(I) || isa(I) || - isa(I) || isa(I); + isa(I) || isa(I) || isa(I); } /// isNotUsedInLoop - Return true if the only users of this instruction are Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.101 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.102 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.101 Tue Dec 19 15:40:18 2006 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sat Dec 23 00:05:41 2006 @@ -1191,9 +1191,6 @@ void LoopStrengthReduce::OptimizeIndvars(Loop *L) { // TODO: implement optzns here. - - - // Finally, get the terminating condition for the loop if possible. If we // can, we want to change it to use a post-incremented version of its // induction variable, to allow coalescing the live ranges for the IV into @@ -1203,10 +1200,10 @@ BasicBlock *LatchBlock = SomePHI->getIncomingBlock(SomePHI->getIncomingBlock(0) == Preheader); BranchInst *TermBr = dyn_cast(LatchBlock->getTerminator()); - if (!TermBr || TermBr->isUnconditional() || - !isa(TermBr->getCondition())) + if (!TermBr || TermBr->isUnconditional() || + !isa(TermBr->getCondition())) return; - SetCondInst *Cond = cast(TermBr->getCondition()); + ICmpInst *Cond = cast(TermBr->getCondition()); // Search IVUsesByStride to find Cond's IVUse if there is one. IVStrideUse *CondUse = 0; @@ -1239,7 +1236,7 @@ Cond->moveBefore(TermBr); } else { // Otherwise, clone the terminating condition and insert into the loopend. - Cond = cast(Cond->clone()); + Cond = cast(Cond->clone()); Cond->setName(L->getHeader()->getName() + ".termcond"); LatchBlock->getInstList().insert(TermBr, Cond); @@ -1360,9 +1357,9 @@ // FIXME: this needs to eliminate an induction variable even if it's being // compared against some value to decide loop termination. if (PN->hasOneUse()) { - BinaryOperator *BO = dyn_cast(*(PN->use_begin())); - if (BO && BO->hasOneUse()) { - if (PN == *(BO->use_begin())) { + Instruction *BO = dyn_cast(*PN->use_begin()); + if (BO && (isa(BO) || isa(BO))) { + if (BO->hasOneUse() && PN == *(BO->use_begin())) { DeadInsts.insert(BO); // Break the cycle, then delete the PHI. PN->replaceAllUsesWith(UndefValue::get(PN->getType())); Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.52 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.53 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.52 Tue Dec 19 15:40:18 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Sat Dec 23 00:05:41 2006 @@ -486,12 +486,11 @@ // Insert a conditional branch on LIC to the two preheaders. The original // code is the true version and the new code is the false version. Value *BranchVal = LIC; - if (!isa(Val)) { - BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", InsertPt); - } else if (Val != ConstantBool::getTrue()) { + if (!isa(Val)) + BranchVal = new ICmpInst(ICmpInst::ICMP_EQ, LIC, Val, "tmp", InsertPt); + else if (Val != ConstantBool::getTrue()) // We want to enter the new loop when the condition is true. std::swap(TrueDest, FalseDest); - } // Insert the new branch. new BranchInst(TrueDest, FalseDest, BranchVal, InsertPt); Index: llvm/lib/Transforms/Scalar/LowerPacked.cpp diff -u llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.13 llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.14 --- llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.13 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/Scalar/LowerPacked.cpp Sat Dec 23 00:05:41 2006 @@ -54,6 +54,10 @@ /// @param BO the binary operator to convert void visitBinaryOperator(BinaryOperator& BO); + /// @brief Lowers packed icmp operations. + /// @param CI the icmp operator to convert + void visitICmpInst(ICmpInst& IC); + /// @brief Lowers packed select instructions. /// @param SELI the select operator to convert void visitSelectInst(SelectInst& SELI); @@ -269,6 +273,35 @@ } } +void LowerPacked::visitICmpInst(ICmpInst& IC) +{ + // Make sure both operands are PackedTypes + if (isa(IC.getOperand(0)->getType())) { + std::vector& op0Vals = getValues(IC.getOperand(0)); + std::vector& op1Vals = getValues(IC.getOperand(1)); + std::vector result; + assert((op0Vals.size() == op1Vals.size()) && + "The two packed operand to scalar maps must be equal in size."); + + result.reserve(op0Vals.size()); + + // generate the new binary op and save the result + for (unsigned i = 0; i != op0Vals.size(); ++i) { + result.push_back(CmpInst::create(IC.getOpcode(), + IC.getPredicate(), + op0Vals[i], + op1Vals[i], + IC.getName() + + "." + utostr(i), + &IC)); + } + + setValues(&IC,result); + Changed = true; + instrsToRemove.push_back(&IC); + } +} + void LowerPacked::visitStoreInst(StoreInst& SI) { if (const PackedType* PKT = @@ -376,12 +409,12 @@ } } else { for (unsigned i = 0; i != Vals.size(); ++i) { - SetCondInst *setcc = - new SetCondInst(Instruction::SetEQ, Idx, - ConstantInt::get(Type::UIntTy, i), - "setcc", &IE); + ICmpInst *icmp = + new ICmpInst(ICmpInst::ICMP_EQ, Idx, + ConstantInt::get(Type::UIntTy, i), + "icmp", &IE); SelectInst *select = - new SelectInst(setcc, Elt, Vals[i], "select", &IE); + new SelectInst(icmp, Elt, Vals[i], "select", &IE); result.push_back(select); } } Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.39 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.40 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.39 Tue Dec 19 15:49:03 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Sat Dec 23 00:05:41 2006 @@ -559,7 +559,8 @@ void addToWorklist(Instruction *I) { //DOUT << "addToWorklist: " << *I << "\n"; - if (!isa(I) && !isa(I)) return; + if (!isa(I) && !isa(I) && !isa(I)) + return; const Type *Ty = I->getType(); if (Ty == Type::VoidTy || Ty->isFPOrFPVector()) return; @@ -855,102 +856,6 @@ addEqual(BO, ConstantExpr::get(BO->getOpcode(), CI1, CI2)); switch (BO->getOpcode()) { - case Instruction::SetEQ: - // "seteq int %a, %b" EQ true then %a EQ %b - // "seteq int %a, %b" EQ false then %a NE %b - if (Canonical == ConstantBool::getTrue()) - addEqual(Op0, Op1); - else if (Canonical == ConstantBool::getFalse()) - addNotEqual(Op0, Op1); - - // %a EQ %b then "seteq int %a, %b" EQ true - // %a NE %b then "seteq int %a, %b" EQ false - if (isEqual(Op0, Op1)) - addEqual(BO, ConstantBool::getTrue()); - else if (isNotEqual(Op0, Op1)) - addEqual(BO, ConstantBool::getFalse()); - - break; - case Instruction::SetNE: - // "setne int %a, %b" EQ true then %a NE %b - // "setne int %a, %b" EQ false then %a EQ %b - if (Canonical == ConstantBool::getTrue()) - addNotEqual(Op0, Op1); - else if (Canonical == ConstantBool::getFalse()) - addEqual(Op0, Op1); - - // %a EQ %b then "setne int %a, %b" EQ false - // %a NE %b then "setne int %a, %b" EQ true - if (isEqual(Op0, Op1)) - addEqual(BO, ConstantBool::getFalse()); - else if (isNotEqual(Op0, Op1)) - addEqual(BO, ConstantBool::getTrue()); - - break; - case Instruction::SetLT: - // "setlt int %a, %b" EQ true then %a LT %b - // "setlt int %a, %b" EQ false then %b LE %a - if (Canonical == ConstantBool::getTrue()) - addLess(Op0, Op1); - else if (Canonical == ConstantBool::getFalse()) - addLessEqual(Op1, Op0); - - // %a LT %b then "setlt int %a, %b" EQ true - // %a GE %b then "setlt int %a, %b" EQ false - if (isLess(Op0, Op1)) - addEqual(BO, ConstantBool::getTrue()); - else if (isGreaterEqual(Op0, Op1)) - addEqual(BO, ConstantBool::getFalse()); - - break; - case Instruction::SetLE: - // "setle int %a, %b" EQ true then %a LE %b - // "setle int %a, %b" EQ false then %b LT %a - if (Canonical == ConstantBool::getTrue()) - addLessEqual(Op0, Op1); - else if (Canonical == ConstantBool::getFalse()) - addLess(Op1, Op0); - - // %a LE %b then "setle int %a, %b" EQ true - // %a GT %b then "setle int %a, %b" EQ false - if (isLessEqual(Op0, Op1)) - addEqual(BO, ConstantBool::getTrue()); - else if (isGreater(Op0, Op1)) - addEqual(BO, ConstantBool::getFalse()); - - break; - case Instruction::SetGT: - // "setgt int %a, %b" EQ true then %b LT %a - // "setgt int %a, %b" EQ false then %a LE %b - if (Canonical == ConstantBool::getTrue()) - addLess(Op1, Op0); - else if (Canonical == ConstantBool::getFalse()) - addLessEqual(Op0, Op1); - - // %a GT %b then "setgt int %a, %b" EQ true - // %a LE %b then "setgt int %a, %b" EQ false - if (isGreater(Op0, Op1)) - addEqual(BO, ConstantBool::getTrue()); - else if (isLessEqual(Op0, Op1)) - addEqual(BO, ConstantBool::getFalse()); - - break; - case Instruction::SetGE: - // "setge int %a, %b" EQ true then %b LE %a - // "setge int %a, %b" EQ false then %a LT %b - if (Canonical == ConstantBool::getTrue()) - addLessEqual(Op1, Op0); - else if (Canonical == ConstantBool::getFalse()) - addLess(Op0, Op1); - - // %a GE %b then "setge int %a, %b" EQ true - // %a LT %b then "setlt int %a, %b" EQ false - if (isGreaterEqual(Op0, Op1)) - addEqual(BO, ConstantBool::getTrue()); - else if (isLess(Op0, Op1)) - addEqual(BO, ConstantBool::getFalse()); - - break; case Instruction::And: { // "and int %a, %b" EQ -1 then %a EQ -1 and %b EQ -1 // "and bool %a, %b" EQ true then %a EQ true and %b EQ true @@ -1030,6 +935,250 @@ break; } } + } else if (FCmpInst *CI = dyn_cast(I)) { + Value *Op0 = cIG.canonicalize(CI->getOperand(0)), + *Op1 = cIG.canonicalize(CI->getOperand(1)); + + ConstantFP *CI1 = dyn_cast(Op0), + *CI2 = dyn_cast(Op1); + + if (CI1 && CI2) + addEqual(CI, ConstantExpr::getFCmp(CI->getPredicate(), CI1, CI2)); + + switch (CI->getPredicate()) { + case FCmpInst::FCMP_OEQ: + case FCmpInst::FCMP_UEQ: + // "eq int %a, %b" EQ true then %a EQ %b + // "eq int %a, %b" EQ false then %a NE %b + if (Canonical == ConstantBool::getTrue()) + addEqual(Op0, Op1); + else if (Canonical == ConstantBool::getFalse()) + addNotEqual(Op0, Op1); + + // %a EQ %b then "eq int %a, %b" EQ true + // %a NE %b then "eq int %a, %b" EQ false + if (isEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isNotEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + case FCmpInst::FCMP_ONE: + case FCmpInst::FCMP_UNE: + // "ne int %a, %b" EQ true then %a NE %b + // "ne int %a, %b" EQ false then %a EQ %b + if (Canonical == ConstantBool::getTrue()) + addNotEqual(Op0, Op1); + else if (Canonical == ConstantBool::getFalse()) + addEqual(Op0, Op1); + + // %a EQ %b then "ne int %a, %b" EQ false + // %a NE %b then "ne int %a, %b" EQ true + if (isEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + else if (isNotEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + + break; + case FCmpInst::FCMP_ULT: + case FCmpInst::FCMP_OLT: + // "lt int %a, %b" EQ true then %a LT %b + // "lt int %a, %b" EQ false then %b LE %a + if (Canonical == ConstantBool::getTrue()) + addLess(Op0, Op1); + else if (Canonical == ConstantBool::getFalse()) + addLessEqual(Op1, Op0); + + // %a LT %b then "lt int %a, %b" EQ true + // %a GE %b then "lt int %a, %b" EQ false + if (isLess(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isGreaterEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + case FCmpInst::FCMP_ULE: + case FCmpInst::FCMP_OLE: + // "le int %a, %b" EQ true then %a LE %b + // "le int %a, %b" EQ false then %b LT %a + if (Canonical == ConstantBool::getTrue()) + addLessEqual(Op0, Op1); + else if (Canonical == ConstantBool::getFalse()) + addLess(Op1, Op0); + + // %a LE %b then "le int %a, %b" EQ true + // %a GT %b then "le int %a, %b" EQ false + if (isLessEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isGreater(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + case FCmpInst::FCMP_UGT: + case FCmpInst::FCMP_OGT: + // "gt int %a, %b" EQ true then %b LT %a + // "gt int %a, %b" EQ false then %a LE %b + if (Canonical == ConstantBool::getTrue()) + addLess(Op1, Op0); + else if (Canonical == ConstantBool::getFalse()) + addLessEqual(Op0, Op1); + + // %a GT %b then "gt int %a, %b" EQ true + // %a LE %b then "gt int %a, %b" EQ false + if (isGreater(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isLessEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + case FCmpInst::FCMP_UGE: + case FCmpInst::FCMP_OGE: + // "ge int %a, %b" EQ true then %b LE %a + // "ge int %a, %b" EQ false then %a LT %b + if (Canonical == ConstantBool::getTrue()) + addLessEqual(Op1, Op0); + else if (Canonical == ConstantBool::getFalse()) + addLess(Op0, Op1); + + // %a GE %b then "ge int %a, %b" EQ true + // %a LT %b then "lt int %a, %b" EQ false + if (isGreaterEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isLess(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + default: + break; + } + + // "%x = add int %y, %z" and %x EQ %y then %z EQ 0 + // "%x = mul int %y, %z" and %x EQ %y then %z EQ 1 + // 1. Repeat all of the above, with order of operands reversed. + // "%x = fdiv float %y, %z" and %x EQ %y then %z EQ 1 + Value *Known = Op0, *Unknown = Op1; + if (Known != BO) std::swap(Known, Unknown); + } else if (ICmpInst *CI = dyn_cast(I)) { + Value *Op0 = cIG.canonicalize(CI->getOperand(0)), + *Op1 = cIG.canonicalize(CI->getOperand(1)); + + ConstantIntegral *CI1 = dyn_cast(Op0), + *CI2 = dyn_cast(Op1); + + if (CI1 && CI2) + addEqual(CI, ConstantExpr::getICmp(CI->getPredicate(), CI1, CI2)); + + switch (CI->getPredicate()) { + case ICmpInst::ICMP_EQ: + // "eq int %a, %b" EQ true then %a EQ %b + // "eq int %a, %b" EQ false then %a NE %b + if (Canonical == ConstantBool::getTrue()) + addEqual(Op0, Op1); + else if (Canonical == ConstantBool::getFalse()) + addNotEqual(Op0, Op1); + + // %a EQ %b then "eq int %a, %b" EQ true + // %a NE %b then "eq int %a, %b" EQ false + if (isEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isNotEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + case ICmpInst::ICMP_NE: + // "ne int %a, %b" EQ true then %a NE %b + // "ne int %a, %b" EQ false then %a EQ %b + if (Canonical == ConstantBool::getTrue()) + addNotEqual(Op0, Op1); + else if (Canonical == ConstantBool::getFalse()) + addEqual(Op0, Op1); + + // %a EQ %b then "ne int %a, %b" EQ false + // %a NE %b then "ne int %a, %b" EQ true + if (isEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + else if (isNotEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + + break; + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + // "lt int %a, %b" EQ true then %a LT %b + // "lt int %a, %b" EQ false then %b LE %a + if (Canonical == ConstantBool::getTrue()) + addLess(Op0, Op1); + else if (Canonical == ConstantBool::getFalse()) + addLessEqual(Op1, Op0); + + // %a LT %b then "lt int %a, %b" EQ true + // %a GE %b then "lt int %a, %b" EQ false + if (isLess(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isGreaterEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: + // "le int %a, %b" EQ true then %a LE %b + // "le int %a, %b" EQ false then %b LT %a + if (Canonical == ConstantBool::getTrue()) + addLessEqual(Op0, Op1); + else if (Canonical == ConstantBool::getFalse()) + addLess(Op1, Op0); + + // %a LE %b then "le int %a, %b" EQ true + // %a GT %b then "le int %a, %b" EQ false + if (isLessEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isGreater(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + // "gt int %a, %b" EQ true then %b LT %a + // "gt int %a, %b" EQ false then %a LE %b + if (Canonical == ConstantBool::getTrue()) + addLess(Op1, Op0); + else if (Canonical == ConstantBool::getFalse()) + addLessEqual(Op0, Op1); + + // %a GT %b then "gt int %a, %b" EQ true + // %a LE %b then "gt int %a, %b" EQ false + if (isGreater(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isLessEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + // "ge int %a, %b" EQ true then %b LE %a + // "ge int %a, %b" EQ false then %a LT %b + if (Canonical == ConstantBool::getTrue()) + addLessEqual(Op1, Op0); + else if (Canonical == ConstantBool::getFalse()) + addLess(Op0, Op1); + + // %a GE %b then "ge int %a, %b" EQ true + // %a LT %b then "lt int %a, %b" EQ false + if (isGreaterEqual(Op0, Op1)) + addEqual(CI, ConstantBool::getTrue()); + else if (isLess(Op0, Op1)) + addEqual(CI, ConstantBool::getFalse()); + + break; + default: + break; + } + + // "%x = add int %y, %z" and %x EQ %y then %z EQ 0 + // "%x = mul int %y, %z" and %x EQ %y then %z EQ 1 + // 1. Repeat all of the above, with order of operands reversed. + // "%x = fdiv float %y, %z" and %x EQ %y then %z EQ 1 + Value *Known = Op0, *Unknown = Op1; + if (Known != BO) std::swap(Known, Unknown); } else if (SelectInst *SI = dyn_cast(I)) { // Given: "%a = select bool %x, int %b, int %c" // %a EQ %b then %x EQ true @@ -1108,6 +1257,7 @@ void visitStoreInst(StoreInst &SI); void visitBinaryOperator(BinaryOperator &BO); + void visitCmpInst(CmpInst &CI) {} }; // Used by terminator instructions to proceed from the current basic Index: llvm/lib/Transforms/Scalar/Reassociate.cpp diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.69 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.70 --- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.69 Tue Dec 19 15:40:18 2006 +++ llvm/lib/Transforms/Scalar/Reassociate.cpp Sat Dec 23 00:05:41 2006 @@ -95,10 +95,11 @@ FunctionPass *llvm::createReassociatePass() { return new Reassociate(); } void Reassociate::RemoveDeadBinaryOp(Value *V) { - BinaryOperator *BOp = dyn_cast(V); - if (!BOp || !BOp->use_empty()) return; + Instruction *Op = dyn_cast(V); + if (!Op || !isa(Op) || !isa(Op) || !Op->use_empty()) + return; - Value *LHS = BOp->getOperand(0), *RHS = BOp->getOperand(1); + Value *LHS = Op->getOperand(0), *RHS = Op->getOperand(1); RemoveDeadBinaryOp(LHS); RemoveDeadBinaryOp(RHS); } @@ -755,7 +756,7 @@ } // Reject cases where it is pointless to do this. - if (!isa(BI) || BI->getType()->isFloatingPoint() || + if (!isa(BI) || BI->getType()->isFloatingPoint() || isa(BI->getType())) continue; // Floating point ops are not associative. Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.143 llvm/lib/Transforms/Scalar/SCCP.cpp:1.144 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.143 Wed Dec 20 00:21:33 2006 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Sat Dec 23 00:05:41 2006 @@ -373,6 +373,7 @@ void visitCastInst(CastInst &I); void visitSelectInst(SelectInst &I); void visitBinaryOperator(Instruction &I); + void visitCmpInst(CmpInst &I); void visitShiftInst(ShiftInst &I) { visitBinaryOperator(I); } void visitExtractElementInst(ExtractElementInst &I); void visitInsertElementInst(InsertElementInst &I); @@ -796,6 +797,93 @@ } } +// Handle ICmpInst instruction... +void SCCPSolver::visitCmpInst(CmpInst &I) { + LatticeVal &IV = ValueState[&I]; + if (IV.isOverdefined()) return; + + LatticeVal &V1State = getValueState(I.getOperand(0)); + LatticeVal &V2State = getValueState(I.getOperand(1)); + + if (V1State.isOverdefined() || V2State.isOverdefined()) { + // If both operands are PHI nodes, it is possible that this instruction has + // a constant value, despite the fact that the PHI node doesn't. Check for + // this condition now. + if (PHINode *PN1 = dyn_cast(I.getOperand(0))) + if (PHINode *PN2 = dyn_cast(I.getOperand(1))) + if (PN1->getParent() == PN2->getParent()) { + // Since the two PHI nodes are in the same basic block, they must have + // entries for the same predecessors. Walk the predecessor list, and + // if all of the incoming values are constants, and the result of + // evaluating this expression with all incoming value pairs is the + // same, then this expression is a constant even though the PHI node + // is not a constant! + LatticeVal Result; + for (unsigned i = 0, e = PN1->getNumIncomingValues(); i != e; ++i) { + LatticeVal &In1 = getValueState(PN1->getIncomingValue(i)); + BasicBlock *InBlock = PN1->getIncomingBlock(i); + LatticeVal &In2 = + getValueState(PN2->getIncomingValueForBlock(InBlock)); + + if (In1.isOverdefined() || In2.isOverdefined()) { + Result.markOverdefined(); + break; // Cannot fold this operation over the PHI nodes! + } else if (In1.isConstant() && In2.isConstant()) { + Constant *V = ConstantExpr::getCompare(I.getPredicate(), + In1.getConstant(), + In2.getConstant()); + if (Result.isUndefined()) + Result.markConstant(V); + else if (Result.isConstant() && Result.getConstant() != V) { + Result.markOverdefined(); + break; + } + } + } + + // If we found a constant value here, then we know the instruction is + // constant despite the fact that the PHI nodes are overdefined. + if (Result.isConstant()) { + markConstant(IV, &I, Result.getConstant()); + // Remember that this instruction is virtually using the PHI node + // operands. + UsersOfOverdefinedPHIs.insert(std::make_pair(PN1, &I)); + UsersOfOverdefinedPHIs.insert(std::make_pair(PN2, &I)); + return; + } else if (Result.isUndefined()) { + return; + } + + // Okay, this really is overdefined now. Since we might have + // speculatively thought that this was not overdefined before, and + // added ourselves to the UsersOfOverdefinedPHIs list for the PHIs, + // make sure to clean out any entries that we put there, for + // efficiency. + std::multimap::iterator It, E; + tie(It, E) = UsersOfOverdefinedPHIs.equal_range(PN1); + while (It != E) { + if (It->second == &I) { + UsersOfOverdefinedPHIs.erase(It++); + } else + ++It; + } + tie(It, E) = UsersOfOverdefinedPHIs.equal_range(PN2); + while (It != E) { + if (It->second == &I) { + UsersOfOverdefinedPHIs.erase(It++); + } else + ++It; + } + } + + markOverdefined(IV, &I); + } else if (V1State.isConstant() && V2State.isConstant()) { + markConstant(IV, &I, ConstantExpr::getCompare(I.getPredicate(), + V1State.getConstant(), + V2State.getConstant())); + } +} + void SCCPSolver::visitExtractElementInst(ExtractElementInst &I) { // FIXME : SCCP does not handle vectors properly. markOverdefined(&I); Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.60 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.61 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.60 Fri Dec 22 17:14:42 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sat Dec 23 00:05:41 2006 @@ -394,9 +394,9 @@ assert(NumElements == 2 && "Unhandled case!"); // All users of the GEP must be loads. At each use of the GEP, insert // two loads of the appropriate indexed GEP and select between them. - Value *IsOne = BinaryOperator::createSetNE(I.getOperand(), + Value *IsOne = new ICmpInst(ICmpInst::ICMP_NE, I.getOperand(), Constant::getNullValue(I.getOperand()->getType()), - "isone", GEPI); + "isone", GEPI); // Insert the new GEP instructions, which are properly indexed. std::vector Indices(GEPI->op_begin()+1, GEPI->op_end()); Indices[1] = Constant::getNullValue(Type::IntTy); From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LoopStrengthReduce/exit_compare_live_range.ll Message-ID: <200612230607.kBN670n3022148@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LoopStrengthReduce: exit_compare_live_range.ll updated: 1.3 -> 1.4 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+1 -1) exit_compare_live_range.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/LoopStrengthReduce/exit_compare_live_range.ll diff -u llvm/test/Regression/Transforms/LoopStrengthReduce/exit_compare_live_range.ll:1.3 llvm/test/Regression/Transforms/LoopStrengthReduce/exit_compare_live_range.ll:1.4 --- llvm/test/Regression/Transforms/LoopStrengthReduce/exit_compare_live_range.ll:1.3 Fri Dec 1 22:23:09 2006 +++ llvm/test/Regression/Transforms/LoopStrengthReduce/exit_compare_live_range.ll Sat Dec 23 00:05:41 2006 @@ -2,7 +2,7 @@ ; having overlapping live ranges that result in copies. We want the setcc instruction ; immediately before the conditional branch. ; -; RUN: llvm-upgrade < %s | llvm-as | opt -loop-reduce | llvm-dis | %prcontext 'br bool' 1 | grep set +; RUN: llvm-upgrade < %s | llvm-as | opt -loop-reduce | llvm-dis | %prcontext 'br bool' 1 | grep icmp void %foo(float* %D, uint %E) { entry: From reid at x10sys.com Sat Dec 23 00:06:53 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:53 -0600 Subject: [llvm-commits] CVS: llvm/examples/ParallelJIT/ParallelJIT.cpp Message-ID: <200612230606.kBN66rwG021980@zion.cs.uiuc.edu> Changes in directory llvm/examples/ParallelJIT: ParallelJIT.cpp updated: 1.6 -> 1.7 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+1 -1) ParallelJIT.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/examples/ParallelJIT/ParallelJIT.cpp diff -u llvm/examples/ParallelJIT/ParallelJIT.cpp:1.6 llvm/examples/ParallelJIT/ParallelJIT.cpp:1.7 --- llvm/examples/ParallelJIT/ParallelJIT.cpp:1.6 Fri Oct 20 02:07:23 2006 +++ llvm/examples/ParallelJIT/ParallelJIT.cpp Sat Dec 23 00:05:40 2006 @@ -83,7 +83,7 @@ BasicBlock* RecurseBB = new BasicBlock("recurse", FibF); // Create the "if (arg < 2) goto exitbb" - Value *CondInst = BinaryOperator::createSetLE(ArgX, Two, "cond", BB); + Value *CondInst = new ICmpInst(ICmpInst::ICMP_SLE, ArgX, Two, "cond", BB); new BranchInst(RetBB, RecurseBB, CondInst, BB); // Create: ret int 1 From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200612230607.kBN670Gv022193@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.52 -> 1.53 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+1 -1) README.txt | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.52 llvm/lib/Target/README.txt:1.53 --- llvm/lib/Target/README.txt:1.52 Sun Dec 10 18:44:03 2006 +++ llvm/lib/Target/README.txt Sat Dec 23 00:05:41 2006 @@ -324,7 +324,7 @@ //===---------------------------------------------------------------------===// -instcombine should handle this transform: - setcc (sdiv X / C1 ), C2 + icmp pred (sdiv X / C1 ), C2 when X, C1, and C2 are unsigned. Similarly for udiv and signed operands. Currently InstCombine avoids this transform but will do it when the signs of From reid at x10sys.com Sat Dec 23 00:06:59 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:06:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp SimplifyLibCalls.cpp Message-ID: <200612230606.kBN66xcw022091@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.80 -> 1.81 SimplifyLibCalls.cpp updated: 1.79 -> 1.80 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+55 -49) GlobalOpt.cpp | 64 ++++++++++++++++++++++++++++----------------------- SimplifyLibCalls.cpp | 40 +++++++++++++++---------------- 2 files changed, 55 insertions(+), 49 deletions(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.80 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.81 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.80 Tue Dec 19 16:09:18 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Sat Dec 23 00:05:41 2006 @@ -238,7 +238,7 @@ if (AnalyzeGlobal(I, GS, PHIUsers)) return true; GS.isNotSuitableForSRA = true; GS.HasPHIUser = true; - } else if (isa(I)) { + } else if (isa(I)) { GS.isNotSuitableForSRA = true; } else if (isa(I) || isa(I)) { if (I->getOperand(1) == V) @@ -507,7 +507,7 @@ if (!AllUsesOfValueWillTrapIfNull(CI)) return false; } else if (GetElementPtrInst *GEPI = dyn_cast(*UI)) { if (!AllUsesOfValueWillTrapIfNull(GEPI)) return false; - } else if (isa(*UI) && + } else if (isa(*UI) && isa(UI->getOperand(1))) { // Ignore setcc X, null } else { @@ -720,29 +720,33 @@ if (LoadInst *LI = dyn_cast(GV->use_back())) { while (!LI->use_empty()) { Use &LoadUse = LI->use_begin().getUse(); - if (!isa(LoadUse.getUser())) + if (!isa(LoadUse.getUser())) LoadUse = RepValue; else { - // Replace the setcc X, 0 with a use of the bool value. - SetCondInst *SCI = cast(LoadUse.getUser()); - Value *LV = new LoadInst(InitBool, InitBool->getName()+".val", SCI); + ICmpInst *CI = cast(LoadUse.getUser()); + // Replace the cmp X, 0 with a use of the bool value. + Value *LV = new LoadInst(InitBool, InitBool->getName()+".val", CI); InitBoolUsed = true; - switch (SCI->getOpcode()) { - default: assert(0 && "Unknown opcode!"); - case Instruction::SetLT: + switch (CI->getPredicate()) { + default: assert(0 && "Unknown ICmp Predicate!"); + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: LV = ConstantBool::getFalse(); // X < null -> always false break; - case Instruction::SetEQ: - case Instruction::SetLE: - LV = BinaryOperator::createNot(LV, "notinit", SCI); + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: + case ICmpInst::ICMP_EQ: + LV = BinaryOperator::createNot(LV, "notinit", CI); break; - case Instruction::SetNE: - case Instruction::SetGE: - case Instruction::SetGT: + case ICmpInst::ICMP_NE: + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: break; // no change. } - SCI->replaceAllUsesWith(LV); - SCI->eraseFromParent(); + CI->replaceAllUsesWith(LV); + CI->eraseFromParent(); } } LI->eraseFromParent(); @@ -783,7 +787,7 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V, GlobalVariable *GV) { for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI) - if (isa(*UI) || isa(*UI)) { + if (isa(*UI) || isa(*UI)) { // Fine, ignore. } else if (StoreInst *SI = dyn_cast(*UI)) { if (SI->getOperand(0) == V && SI->getOperand(1) != GV) @@ -832,8 +836,8 @@ for (Value::use_iterator UI = LI->use_begin(), E = LI->use_end(); UI != E; ++UI) { // Comparison against null is ok. - if (SetCondInst *SCI = dyn_cast(*UI)) { - if (!isa(SCI->getOperand(1))) + if (ICmpInst *ICI = dyn_cast(*UI)) { + if (!isa(ICI->getOperand(1))) return false; continue; } @@ -865,7 +869,7 @@ Instruction *User = Ptr->use_back(); // If this is a comparison against null, handle it. - if (SetCondInst *SCI = dyn_cast(User)) { + if (ICmpInst *SCI = dyn_cast(User)) { assert(isa(SCI->getOperand(1))); // If we have a setcc of the loaded pointer, we can use a setcc of any // field. @@ -877,9 +881,9 @@ NPtr = InsertedLoadsForPtr.back(); } - Value *New = new SetCondInst(SCI->getOpcode(), NPtr, - Constant::getNullValue(NPtr->getType()), - SCI->getName(), SCI); + Value *New = new ICmpInst(SCI->getPredicate(), NPtr, + Constant::getNullValue(NPtr->getType()), + SCI->getName(), SCI); SCI->replaceAllUsesWith(New); SCI->eraseFromParent(); continue; @@ -959,7 +963,7 @@ // } Value *RunningOr = 0; for (unsigned i = 0, e = FieldMallocs.size(); i != e; ++i) { - Value *Cond = new SetCondInst(Instruction::SetEQ, FieldMallocs[i], + Value *Cond = new ICmpInst(ICmpInst::ICMP_EQ, FieldMallocs[i], Constant::getNullValue(FieldMallocs[i]->getType()), "isnull", MI); if (!RunningOr) @@ -986,9 +990,9 @@ // pointer, because some may be null while others are not. for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) { Value *GVVal = new LoadInst(FieldGlobals[i], "tmp", NullPtrBlock); - Value *Cmp = new SetCondInst(Instruction::SetNE, GVVal, - Constant::getNullValue(GVVal->getType()), - "tmp", NullPtrBlock); + Value *Cmp = new ICmpInst(ICmpInst::ICMP_NE, GVVal, + Constant::getNullValue(GVVal->getType()), + "tmp", NullPtrBlock); BasicBlock *FreeBlock = new BasicBlock("free_it", OrigBB->getParent()); BasicBlock *NextBlock = new BasicBlock("next", OrigBB->getParent()); new BranchInst(FreeBlock, NextBlock, Cmp, NullPtrBlock); @@ -1710,6 +1714,10 @@ InstResult = ConstantExpr::get(SI->getOpcode(), getVal(Values, SI->getOperand(0)), getVal(Values, SI->getOperand(1))); + } else if (CmpInst *CI = dyn_cast(CurInst)) { + InstResult = ConstantExpr::getCompare(CI->getPredicate(), + getVal(Values, CI->getOperand(0)), + getVal(Values, CI->getOperand(1))); } else if (CastInst *CI = dyn_cast(CurInst)) { InstResult = ConstantExpr::getCast(CI->getOpcode(), getVal(Values, CI->getOperand(0)), Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.79 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.80 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.79 Thu Dec 21 01:15:54 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Sat Dec 23 00:05:41 2006 @@ -887,8 +887,8 @@ // Does the call to strlen have exactly one use? if (ci->hasOneUse()) - // Is that single use a binary operator? - if (BinaryOperator* bop = dyn_cast(ci->use_back())) + // Is that single use a icmp operator? + if (ICmpInst* bop = dyn_cast(ci->use_back())) // Is it compared against a constant integer? if (ConstantInt* CI = dyn_cast(bop->getOperand(1))) { @@ -897,15 +897,15 @@ // If its compared against length 0 with == or != if (val == 0 && - (bop->getOpcode() == Instruction::SetEQ || - bop->getOpcode() == Instruction::SetNE)) + (bop->getPredicate() == ICmpInst::ICMP_EQ || + bop->getPredicate() == ICmpInst::ICMP_NE)) { // strlen(x) != 0 -> *x != 0 // strlen(x) == 0 -> *x == 0 LoadInst* load = new LoadInst(str,str->getName()+".first",ci); - BinaryOperator* rbop = BinaryOperator::create(bop->getOpcode(), - load, ConstantInt::get(Type::SByteTy,0), - bop->getName()+".strlen", ci); + ICmpInst* rbop = new ICmpInst(bop->getPredicate(), load, + ConstantInt::get(Type::SByteTy,0), + bop->getName()+".strlen", ci); bop->replaceAllUsesWith(rbop); bop->eraseFromParent(); ci->eraseFromParent(); @@ -933,10 +933,11 @@ for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) { Instruction *User = cast(*UI); - if (User->getOpcode() == Instruction::SetNE || - User->getOpcode() == Instruction::SetEQ) { - if (isa(User->getOperand(1)) && - cast(User->getOperand(1))->isNullValue()) + if (ICmpInst *IC = dyn_cast(User)) { + if ((IC->getPredicate() == ICmpInst::ICMP_NE || + IC->getPredicate() == ICmpInst::ICMP_EQ) && + isa(IC->getOperand(1)) && + cast(IC->getOperand(1))->isNullValue()) continue; } else if (CastInst *CI = dyn_cast(User)) if (CI->getType() == Type::BoolTy) @@ -1739,7 +1740,7 @@ BinaryOperator* sub_inst = BinaryOperator::createSub(cast, ConstantInt::get(Type::UIntTy,0x30), ci->getOperand(1)->getName()+".sub",ci); - SetCondInst* setcond_inst = new SetCondInst(Instruction::SetLE,sub_inst, + ICmpInst* setcond_inst = new ICmpInst(ICmpInst::ICMP_ULE,sub_inst, ConstantInt::get(Type::UIntTy,9), ci->getOperand(1)->getName()+".cmp",ci); CastInst* c2 = new ZExtInst(setcond_inst, Type::IntTy, @@ -1764,12 +1765,9 @@ virtual bool OptimizeCall(CallInst *CI, SimplifyLibCalls &SLC) { // isascii(c) -> (unsigned)c < 128 Value *V = CI->getOperand(1); - if (V->getType()->isSigned()) - V = new BitCastInst(V, V->getType()->getUnsignedVersion(), V->getName(), - CI); - Value *Cmp = BinaryOperator::createSetLT(V, ConstantInt::get(V->getType(), - 128), - V->getName()+".isascii", CI); + Value *Cmp = new ICmpInst(ICmpInst::ICMP_ULT, V, + ConstantInt::get(V->getType(), 128), + V->getName()+".isascii", CI); if (Cmp->getType() != CI->getType()) Cmp = new BitCastInst(Cmp, CI->getType(), Cmp->getName(), CI); CI->replaceAllUsesWith(Cmp); @@ -1872,9 +1870,9 @@ "tmp", TheCall); V2 = BinaryOperator::createAdd(V2, ConstantInt::get(Type::IntTy, 1), "tmp", TheCall); - Value *Cond = - BinaryOperator::createSetEQ(V, Constant::getNullValue(V->getType()), - "tmp", TheCall); + Value *Cond = new ICmpInst(ICmpInst::ICMP_EQ, V, + Constant::getNullValue(V->getType()), "tmp", + TheCall); V2 = new SelectInst(Cond, ConstantInt::get(Type::IntTy, 0), V2, TheCall->getName(), TheCall); TheCall->replaceAllUsesWith(V2); From reid at x10sys.com Sat Dec 23 00:07:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 00:07:00 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.cpp UpgradeParser.cpp.cvs UpgradeParser.h UpgradeParser.h.cvs UpgradeParser.y UpgradeParser.y.cvs Message-ID: <200612230607.kBN670LF022146@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-upgrade: UpgradeParser.cpp updated: 1.26 -> 1.27 UpgradeParser.cpp.cvs updated: 1.24 -> 1.25 UpgradeParser.h updated: 1.19 -> 1.20 UpgradeParser.h.cvs updated: 1.17 -> 1.18 UpgradeParser.y updated: 1.24 -> 1.25 UpgradeParser.y.cvs updated: 1.23 -> 1.24 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+398 -454) UpgradeParser.cpp | 406 ++++++++++++++++++++++++-------------------------- UpgradeParser.cpp.cvs | 406 ++++++++++++++++++++++++-------------------------- UpgradeParser.h | 2 UpgradeParser.h.cvs | 2 UpgradeParser.y | 18 -- UpgradeParser.y.cvs | 18 -- 6 files changed, 398 insertions(+), 454 deletions(-) Index: llvm/tools/llvm-upgrade/UpgradeParser.cpp diff -u llvm/tools/llvm-upgrade/UpgradeParser.cpp:1.26 llvm/tools/llvm-upgrade/UpgradeParser.cpp:1.27 --- llvm/tools/llvm-upgrade/UpgradeParser.cpp:1.26 Sat Dec 9 13:41:25 2006 +++ llvm/tools/llvm-upgrade/UpgradeParser.cpp Sat Dec 23 00:05:41 2006 @@ -368,7 +368,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 14 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" #include "ParserInternals.h" #include @@ -381,8 +381,6 @@ #define YYERROR_VERBOSE 1 #define YYINCLUDED_STDLIB_H #define YYDEBUG 1 -#define UPGRADE_SETCOND_OPS 0 -#define GENERATE_FCMP_INSTS 0 int yylex(); // declaration" of xxx warnings. int yyparse(); @@ -552,11 +550,7 @@ // the original intent by replace the cast with a setne const char* comparator = SrcTy.isPointer() ? ", null" : (SrcTy.isFloatingPoint() ? ", 0.0" : ", 0"); -#if UPGRADE_SETCOND_OPS - const char* compareOp = SrcTy.isFloatingPoint() ? "setne " : "icmp ne "; -#else - const char* compareOp = "setne"; -#endif + const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne "; if (isConst) { Result = "(" + Source + comparator + ")"; Result = compareOp + Result; @@ -612,16 +606,12 @@ result[6] = cc1; result[7] = cc2; if (TI.isFloatingPoint()) { -#if GENERATE_FCMP_INSTS result[0] = 'f'; - result[5] = 'o'; // FIXME: Always map to ordered comparison ? + result[5] = 'o'; if (cc1 == 'n') result[5] = 'u'; // NE maps to unordered else result[5] = 'o'; // everything else maps to ordered -#else - result = setcc; -#endif } else if (TI.isIntegral() || TI.isPointer()) { result[0] = 'i'; if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e')) @@ -657,7 +647,7 @@ #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 285 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" typedef union YYSTYPE { std::string* String; TypeInfo Type; @@ -666,7 +656,7 @@ ValueList* ValList; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 670 "UpgradeParser.tab.c" +#line 660 "UpgradeParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -678,7 +668,7 @@ /* Line 219 of yacc.c. */ -#line 682 "UpgradeParser.tab.c" +#line 672 "UpgradeParser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -1032,36 +1022,36 @@ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 348, 348, 348, 349, 349, 353, 353, 353, 353, - 353, 353, 353, 354, 354, 354, 354, 355, 355, 355, - 356, 356, 356, 356, 356, 356, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 358, 358, 358, 358, - 358, 358, 358, 358, 358, 358, 359, 359, 359, 359, - 359, 359, 360, 360, 360, 360, 361, 361, 361, 361, - 361, 361, 361, 362, 362, 362, 362, 362, 362, 367, - 367, 367, 367, 368, 368, 368, 368, 369, 369, 370, - 370, 373, 376, 381, 381, 381, 381, 381, 381, 382, - 383, 386, 386, 386, 386, 386, 387, 388, 393, 398, - 399, 402, 403, 411, 417, 418, 421, 422, 431, 432, - 445, 445, 446, 446, 447, 451, 451, 451, 451, 451, - 451, 451, 452, 452, 452, 452, 452, 454, 458, 462, - 465, 470, 476, 484, 492, 498, 502, 513, 516, 524, - 525, 530, 533, 543, 549, 554, 560, 566, 572, 577, - 583, 589, 595, 601, 607, 613, 619, 625, 631, 639, - 653, 665, 670, 676, 681, 689, 694, 699, 707, 712, - 717, 727, 732, 737, 737, 747, 752, 755, 760, 764, - 768, 770, 770, 773, 785, 790, 795, 804, 813, 822, - 831, 836, 841, 846, 848, 848, 851, 856, 863, 868, - 875, 882, 887, 888, 896, 896, 897, 897, 899, 906, - 910, 914, 917, 922, 925, 927, 947, 948, 950, 959, - 960, 962, 970, 971, 972, 976, 989, 990, 993, 993, - 993, 993, 993, 993, 993, 994, 995, 1000, 1001, 1010, - 1010, 1014, 1020, 1031, 1037, 1040, 1048, 1052, 1057, 1060, - 1066, 1066, 1068, 1073, 1078, 1083, 1091, 1098, 1104, 1124, - 1129, 1135, 1140, 1148, 1157, 1164, 1172, 1176, 1183, 1184, - 1188, 1193, 1196, 1202, 1207, 1215, 1220, 1225, 1230, 1238, - 1252, 1257, 1262, 1267, 1272, 1277, 1282, 1299, 1304, 1305, - 1309, 1310, 1313, 1320, 1327, 1334, 1341, 1346, 1353, 1360 + 0, 338, 338, 338, 339, 339, 343, 343, 343, 343, + 343, 343, 343, 344, 344, 344, 344, 345, 345, 345, + 346, 346, 346, 346, 346, 346, 347, 347, 347, 347, + 347, 347, 347, 347, 347, 347, 348, 348, 348, 348, + 348, 348, 348, 348, 348, 348, 349, 349, 349, 349, + 349, 349, 350, 350, 350, 350, 351, 351, 351, 351, + 351, 351, 351, 352, 352, 352, 352, 352, 352, 357, + 357, 357, 357, 358, 358, 358, 358, 359, 359, 360, + 360, 363, 366, 371, 371, 371, 371, 371, 371, 372, + 373, 376, 376, 376, 376, 376, 377, 378, 383, 388, + 389, 392, 393, 401, 407, 408, 411, 412, 421, 422, + 435, 435, 436, 436, 437, 441, 441, 441, 441, 441, + 441, 441, 442, 442, 442, 442, 442, 444, 448, 452, + 455, 460, 466, 474, 482, 488, 492, 503, 506, 514, + 515, 520, 523, 533, 539, 544, 550, 556, 562, 567, + 573, 579, 585, 591, 597, 603, 609, 615, 621, 629, + 643, 655, 660, 666, 671, 677, 682, 687, 695, 700, + 705, 715, 720, 725, 725, 735, 740, 743, 748, 752, + 756, 758, 758, 761, 773, 778, 783, 792, 801, 810, + 819, 824, 829, 834, 836, 836, 839, 844, 851, 856, + 863, 870, 875, 876, 884, 884, 885, 885, 887, 894, + 898, 902, 905, 910, 913, 915, 935, 936, 938, 947, + 948, 950, 958, 959, 960, 964, 977, 978, 981, 981, + 981, 981, 981, 981, 981, 982, 983, 988, 989, 998, + 998, 1002, 1008, 1019, 1025, 1028, 1036, 1040, 1045, 1048, + 1054, 1054, 1056, 1061, 1066, 1071, 1079, 1086, 1092, 1112, + 1117, 1123, 1128, 1136, 1145, 1152, 1160, 1164, 1171, 1172, + 1176, 1181, 1184, 1190, 1195, 1201, 1206, 1211, 1216, 1224, + 1238, 1243, 1248, 1253, 1258, 1263, 1268, 1285, 1290, 1291, + 1295, 1296, 1299, 1306, 1313, 1320, 1327, 1332, 1339, 1346 }; #endif @@ -2408,26 +2398,26 @@ switch (yyn) { case 81: -#line 373 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 363 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[-1].String); ;} break; case 82: -#line 376 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 366 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(""); ;} break; case 90: -#line 383 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 373 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(""); ;} break; case 97: -#line 388 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 378 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += *(yyvsp[0].String); delete (yyvsp[0].String); @@ -2436,27 +2426,27 @@ break; case 98: -#line 393 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 383 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(""); ;} break; case 99: -#line 398 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 388 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 100: -#line 399 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 389 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;} break; case 101: -#line 402 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 392 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 102: -#line 403 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 393 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, ", "); *(yyvsp[-1].String) += " " + *(yyvsp[0].String); @@ -2466,7 +2456,7 @@ break; case 103: -#line 411 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 401 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -2475,17 +2465,17 @@ break; case 104: -#line 417 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 407 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 106: -#line 421 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 411 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 107: -#line 422 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 412 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, ", "); if (!(yyvsp[0].String)->empty()) @@ -2496,7 +2486,7 @@ break; case 109: -#line 432 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 422 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -2505,7 +2495,7 @@ break; case 127: -#line 454 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 444 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Type).newTy = (yyvsp[0].String); (yyval.Type).oldTy = OpaqueTy; @@ -2513,7 +2503,7 @@ break; case 128: -#line 458 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 448 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Type).newTy = (yyvsp[0].String); (yyval.Type).oldTy = UnresolvedTy; @@ -2521,14 +2511,14 @@ break; case 129: -#line 462 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 452 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Type) = (yyvsp[0].Type); ;} break; case 130: -#line 465 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 455 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Type UpReference (yyvsp[0].String)->insert(0, "\\"); (yyval.Type).newTy = (yyvsp[0].String); @@ -2537,7 +2527,7 @@ break; case 131: -#line 470 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 460 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Function derived type? *(yyvsp[-3].Type).newTy += "( " + *(yyvsp[-1].String) + " )"; delete (yyvsp[-1].String); @@ -2547,7 +2537,7 @@ break; case 132: -#line 476 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 466 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Sized array type? (yyvsp[-3].String)->insert(0,"[ "); *(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " ]"; @@ -2559,7 +2549,7 @@ break; case 133: -#line 484 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 474 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Packed array type? (yyvsp[-3].String)->insert(0,"< "); *(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " >"; @@ -2571,7 +2561,7 @@ break; case 134: -#line 492 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 482 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Structure type? (yyvsp[-1].String)->insert(0, "{ "); *(yyvsp[-1].String) += " }"; @@ -2581,7 +2571,7 @@ break; case 135: -#line 498 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 488 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Empty structure type? (yyval.Type).newTy = new std::string("{}"); (yyval.Type).oldTy = StructTy; @@ -2589,7 +2579,7 @@ break; case 136: -#line 502 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 492 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Pointer type? *(yyvsp[-1].Type).newTy += '*'; (yyval.Type).elemTy = (yyvsp[-1].Type).oldTy; @@ -2599,14 +2589,14 @@ break; case 137: -#line 513 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 503 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].Type).newTy; ;} break; case 138: -#line 516 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 506 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", " + *(yyvsp[0].Type).newTy; delete (yyvsp[0].Type).newTy; @@ -2615,7 +2605,7 @@ break; case 140: -#line 525 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 515 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", ..."; delete (yyvsp[0].String); @@ -2624,21 +2614,21 @@ break; case 141: -#line 530 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 520 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); ;} break; case 142: -#line 533 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 523 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 143: -#line 543 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 533 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Nonempty unsized arr (yyval.Const).type = (yyvsp[-3].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy); @@ -2648,7 +2638,7 @@ break; case 144: -#line 549 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 539 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-2].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy); @@ -2657,7 +2647,7 @@ break; case 145: -#line 554 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 544 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-2].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy); @@ -2667,7 +2657,7 @@ break; case 146: -#line 560 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 550 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Nonempty unsized arr (yyval.Const).type = (yyvsp[-3].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy); @@ -2677,7 +2667,7 @@ break; case 147: -#line 566 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 556 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-3].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy); @@ -2687,7 +2677,7 @@ break; case 148: -#line 572 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 562 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-2].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy); @@ -2696,7 +2686,7 @@ break; case 149: -#line 577 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 567 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2706,7 +2696,7 @@ break; case 150: -#line 583 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 573 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2716,7 +2706,7 @@ break; case 151: -#line 589 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 579 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2726,7 +2716,7 @@ break; case 152: -#line 595 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 585 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2736,7 +2726,7 @@ break; case 153: -#line 601 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 591 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2746,7 +2736,7 @@ break; case 154: -#line 607 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 597 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // integral constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2756,7 +2746,7 @@ break; case 155: -#line 613 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 603 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // integral constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2766,7 +2756,7 @@ break; case 156: -#line 619 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 609 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Boolean constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2776,7 +2766,7 @@ break; case 157: -#line 625 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 615 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Boolean constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2786,7 +2776,7 @@ break; case 158: -#line 631 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 621 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Float & Double constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2796,7 +2786,7 @@ break; case 159: -#line 639 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 629 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { std::string source = *(yyvsp[-3].Const).cnst; TypeInfo DstTy = (yyvsp[-1].Type); @@ -2814,7 +2804,7 @@ break; case 160: -#line 653 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 643 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst; for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) { @@ -2830,7 +2820,7 @@ break; case 161: -#line 665 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 655 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2839,7 +2829,7 @@ break; case 162: -#line 670 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 660 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type); (yyval.String) = new std::string(op); @@ -2849,7 +2839,7 @@ break; case 163: -#line 676 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 666 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2858,11 +2848,9 @@ break; case 164: -#line 681 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 671 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { -#if UPGRADE_SETCOND_OPS *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const).type); -#endif *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); (yyval.String) = (yyvsp[-5].String); @@ -2870,7 +2858,7 @@ break; case 165: -#line 689 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 677 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += "(" + *(yyvsp[-5].String) + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2879,7 +2867,7 @@ break; case 166: -#line 694 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 682 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += "(" + *(yyvsp[-5].String) + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2888,7 +2876,7 @@ break; case 167: -#line 699 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 687 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const char* shiftop = (yyvsp[-5].String)->c_str(); if (*(yyvsp[-5].String) == "shr") @@ -2900,7 +2888,7 @@ break; case 168: -#line 707 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 695 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2909,7 +2897,7 @@ break; case 169: -#line 712 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 700 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2918,7 +2906,7 @@ break; case 170: -#line 717 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 705 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2927,7 +2915,7 @@ break; case 171: -#line 727 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 715 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst; (yyvsp[0].Const).destroy(); @@ -2936,25 +2924,25 @@ break; case 172: -#line 732 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 720 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;} break; case 175: -#line 747 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 735 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { ;} break; case 176: -#line 752 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 740 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 177: -#line 755 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 743 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -2963,7 +2951,7 @@ break; case 178: -#line 760 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 748 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << "module asm " << " " << *(yyvsp[0].String) << "\n"; (yyval.String) = 0; @@ -2971,7 +2959,7 @@ break; case 179: -#line 764 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 752 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << "implementation\n"; (yyval.String) = 0; @@ -2979,17 +2967,17 @@ break; case 180: -#line 768 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 756 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 182: -#line 770 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 758 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;} break; case 183: -#line 773 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 761 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { EnumeratedTypes.push_back((yyvsp[0].Type)); if (!(yyvsp[-2].String)->empty()) { @@ -3005,7 +2993,7 @@ break; case 184: -#line 785 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 773 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Function prototypes can be in const pool *O << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3014,7 +3002,7 @@ break; case 185: -#line 790 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 778 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Asm blocks can be in the const pool *O << *(yyvsp[-2].String) << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String); @@ -3023,7 +3011,7 @@ break; case 186: -#line 795 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 783 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-4].String)->empty()) { *O << *(yyvsp[-4].String) << " = "; @@ -3036,7 +3024,7 @@ break; case 187: -#line 804 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 792 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-4].String)->empty()) { *O << *(yyvsp[-4].String) << " = "; @@ -3049,7 +3037,7 @@ break; case 188: -#line 813 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 801 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-4].String)->empty()) { *O << *(yyvsp[-4].String) << " = "; @@ -3062,7 +3050,7 @@ break; case 189: -#line 822 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 810 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-4].String)->empty()) { *O << *(yyvsp[-4].String) << " = "; @@ -3075,7 +3063,7 @@ break; case 190: -#line 831 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 819 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << *(yyvsp[-1].String) << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[-1].String); delete (yyvsp[0].String); @@ -3084,7 +3072,7 @@ break; case 191: -#line 836 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 824 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << "\n"; delete (yyvsp[-2].String); delete (yyvsp[0].String); @@ -3093,14 +3081,14 @@ break; case 192: -#line 841 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 829 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 196: -#line 851 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 839 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3109,7 +3097,7 @@ break; case 197: -#line 856 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 844 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); if (*(yyvsp[0].String) == "64") @@ -3120,7 +3108,7 @@ break; case 198: -#line 863 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 851 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3129,7 +3117,7 @@ break; case 199: -#line 868 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 856 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3138,7 +3126,7 @@ break; case 200: -#line 875 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 863 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, "[ "); *(yyvsp[-1].String) += " ]"; @@ -3147,7 +3135,7 @@ break; case 201: -#line 882 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 870 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3156,19 +3144,19 @@ break; case 203: -#line 888 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 876 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 207: -#line 897 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 885 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 208: -#line 899 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 887 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[-1].Type).newTy; if (!(yyvsp[0].String)->empty()) @@ -3178,7 +3166,7 @@ break; case 209: -#line 906 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 894 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3186,21 +3174,21 @@ break; case 210: -#line 910 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 898 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); ;} break; case 211: -#line 914 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 902 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); ;} break; case 212: -#line 917 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 905 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", ..."; (yyval.String) = (yyvsp[-2].String); @@ -3209,19 +3197,19 @@ break; case 213: -#line 922 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 910 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); ;} break; case 214: -#line 925 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 913 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 215: -#line 928 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 916 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-7].String)->empty()) { *(yyvsp[-7].String) += " "; @@ -3243,17 +3231,17 @@ break; case 216: -#line 947 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 935 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;} break; case 217: -#line 948 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 936 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string ("{"); ;} break; case 218: -#line 950 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 938 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-2].String)->empty()) { *O << *(yyvsp[-2].String) << " "; @@ -3265,17 +3253,17 @@ break; case 219: -#line 959 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 947 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;} break; case 220: -#line 960 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 948 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string("}"); ;} break; case 221: -#line 962 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 950 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[-1].String)) *O << *(yyvsp[-1].String); @@ -3285,12 +3273,12 @@ break; case 222: -#line 970 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 958 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 225: -#line 976 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 964 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-1].String)->empty()) *(yyvsp[-2].String) += " " + *(yyvsp[-1].String); @@ -3302,12 +3290,12 @@ break; case 226: -#line 989 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 977 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 236: -#line 995 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 983 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, "<"); *(yyvsp[-1].String) += ">"; @@ -3316,7 +3304,7 @@ break; case 238: -#line 1001 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 989 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-3].String)->empty()) { *(yyvsp[-4].String) += " " + *(yyvsp[-3].String); @@ -3328,7 +3316,7 @@ break; case 241: -#line 1014 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1002 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Value).val = (yyvsp[0].String); (yyval.Value).constant = false; @@ -3338,7 +3326,7 @@ break; case 242: -#line 1020 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1008 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Value).val = (yyvsp[0].String); (yyval.Value).constant = true; @@ -3348,7 +3336,7 @@ break; case 243: -#line 1031 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1019 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Value) = (yyvsp[0].Value); (yyval.Value).type = (yyvsp[-1].Type); @@ -3357,28 +3345,28 @@ break; case 244: -#line 1037 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1025 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 245: -#line 1040 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1028 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Do not allow functions with 0 basic blocks (yyval.String) = 0; ;} break; case 246: -#line 1048 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1036 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 247: -#line 1052 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1040 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3387,14 +3375,14 @@ break; case 248: -#line 1057 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1045 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 249: -#line 1060 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1048 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3403,12 +3391,12 @@ break; case 251: -#line 1066 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1054 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;} break; case 252: -#line 1068 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1056 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Return with a result... *O << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].Value).val << "\n"; delete (yyvsp[-1].String); (yyvsp[0].Value).destroy(); @@ -3417,7 +3405,7 @@ break; case 253: -#line 1073 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1061 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Return with no result... *O << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].Type).newTy << "\n"; delete (yyvsp[-1].String); (yyvsp[0].Type).destroy(); @@ -3426,7 +3414,7 @@ break; case 254: -#line 1078 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1066 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Unconditional Branch... *O << " " << *(yyvsp[-2].String) << " " << *(yyvsp[-1].Type).newTy << " " << *(yyvsp[0].Value).val << "\n"; delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy(); @@ -3435,7 +3423,7 @@ break; case 255: -#line 1083 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1071 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[-8].String) << " " << *(yyvsp[-7].Type).newTy << " " << *(yyvsp[-6].Value).val << ", " << *(yyvsp[-4].Type).newTy << " " << *(yyvsp[-3].Value).val << ", " << *(yyvsp[-1].Type).newTy << " " @@ -3447,7 +3435,7 @@ break; case 256: -#line 1091 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1079 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[-8].String) << " " << *(yyvsp[-7].Type).newTy << " " << *(yyvsp[-6].Value).val << ", " << *(yyvsp[-4].Type).newTy << " " << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n"; @@ -3458,7 +3446,7 @@ break; case 257: -#line 1098 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1086 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[-7].String) << " " << *(yyvsp[-6].Type).newTy << " " << *(yyvsp[-5].Value).val << ", " << *(yyvsp[-3].Type).newTy << " " << *(yyvsp[-2].Value).val << "[]\n"; @@ -3468,7 +3456,7 @@ break; case 258: -#line 1105 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1093 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " "; if (!(yyvsp[-13].String)->empty()) @@ -3491,7 +3479,7 @@ break; case 259: -#line 1124 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1112 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3500,7 +3488,7 @@ break; case 260: -#line 1129 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1117 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3509,7 +3497,7 @@ break; case 261: -#line 1135 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1123 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + " " + *(yyvsp[-3].String) + ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val; (yyvsp[-4].Type).destroy(); delete (yyvsp[-3].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy(); @@ -3518,7 +3506,7 @@ break; case 262: -#line 1140 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1128 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-3].String)->insert(0, *(yyvsp[-4].Type).newTy + " " ); *(yyvsp[-3].String) += ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val; @@ -3528,7 +3516,7 @@ break; case 263: -#line 1148 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1136 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-1].String)->empty()) *(yyvsp[-1].String) += " = "; @@ -3539,7 +3527,7 @@ break; case 264: -#line 1157 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1145 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Used for PHI nodes (yyvsp[-3].Value).val->insert(0, *(yyvsp[-5].Type).newTy + "["); *(yyvsp[-3].Value).val += "," + *(yyvsp[-1].Value).val + "]"; @@ -3550,7 +3538,7 @@ break; case 265: -#line 1164 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1152 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += ", [" + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + "]"; (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy(); @@ -3559,7 +3547,7 @@ break; case 266: -#line 1172 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = new ValueList(); (yyval.ValList)->push_back((yyvsp[0].Value)); @@ -3567,7 +3555,7 @@ break; case 267: -#line 1176 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1164 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-2].ValList)->push_back((yyvsp[0].Value)); (yyval.ValList) = (yyvsp[-2].ValList); @@ -3575,17 +3563,17 @@ break; case 268: -#line 1183 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1171 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = (yyvsp[0].ValList); ;} break; case 269: -#line 1184 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1172 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = new ValueList(); ;} break; case 270: -#line 1188 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3594,7 +3582,7 @@ break; case 272: -#line 1196 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1184 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type)); (yyval.String) = new std::string(op); @@ -3604,7 +3592,7 @@ break; case 273: -#line 1202 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1190 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3613,11 +3601,9 @@ break; case 274: -#line 1207 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { -#if UPGRADE_SETCOND_OPS *(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type)); -#endif *(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); (yyval.String) = (yyvsp[-4].String); @@ -3625,7 +3611,7 @@ break; case 275: -#line 1215 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1201 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " " + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + ")"; delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy(); @@ -3634,7 +3620,7 @@ break; case 276: -#line 1220 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " " + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + ")"; delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy(); @@ -3643,7 +3629,7 @@ break; case 277: -#line 1225 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val; (yyvsp[0].Value).destroy(); @@ -3652,7 +3638,7 @@ break; case 278: -#line 1230 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const char* shiftop = (yyvsp[-3].String)->c_str(); if (*(yyvsp[-3].String) == "shr") @@ -3664,7 +3650,7 @@ break; case 279: -#line 1238 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { std::string source = *(yyvsp[-2].Value).val; TypeInfo SrcTy = (yyvsp[-2].Value).type; @@ -3682,7 +3668,7 @@ break; case 280: -#line 1252 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1238 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3691,7 +3677,7 @@ break; case 281: -#line 1257 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1243 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Type).newTy; (yyvsp[-2].Value).destroy(); (yyvsp[0].Type).destroy(); @@ -3700,7 +3686,7 @@ break; case 282: -#line 1262 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1248 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3709,7 +3695,7 @@ break; case 283: -#line 1267 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1253 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3718,7 +3704,7 @@ break; case 284: -#line 1272 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3727,7 +3713,7 @@ break; case 285: -#line 1277 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1263 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3736,7 +3722,7 @@ break; case 286: -#line 1282 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1268 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-5].String)->empty()) *(yyvsp[-6].String) += " " + *(yyvsp[-5].String); @@ -3757,22 +3743,22 @@ break; case 288: -#line 1304 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1290 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = (yyvsp[0].ValList); ;} break; case 289: -#line 1305 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1291 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = new ValueList(); ;} break; case 291: -#line 1310 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1296 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 292: -#line 1313 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1299 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy; if (!(yyvsp[0].String)->empty()) @@ -3783,7 +3769,7 @@ break; case 293: -#line 1320 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1306 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val; if (!(yyvsp[0].String)->empty()) @@ -3794,7 +3780,7 @@ break; case 294: -#line 1327 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1313 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy; if (!(yyvsp[0].String)->empty()) @@ -3805,7 +3791,7 @@ break; case 295: -#line 1334 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1320 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val; if (!(yyvsp[0].String)->empty()) @@ -3816,7 +3802,7 @@ break; case 296: -#line 1341 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1327 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val; (yyvsp[0].Value).destroy(); @@ -3825,7 +3811,7 @@ break; case 297: -#line 1346 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1332 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-3].String)->empty()) *(yyvsp[-3].String) += " "; @@ -3836,7 +3822,7 @@ break; case 298: -#line 1353 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1339 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-5].String)->empty()) *(yyvsp[-5].String) += " "; @@ -3847,7 +3833,7 @@ break; case 299: -#line 1360 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1346 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Upgrade the indices for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) { @@ -3878,7 +3864,7 @@ } /* Line 1126 of yacc.c. */ -#line 3882 "UpgradeParser.tab.c" +#line 3868 "UpgradeParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -4146,7 +4132,7 @@ } -#line 1384 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1370 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" int yyerror(const char *ErrorMsg) { Index: llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs diff -u llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.24 llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.25 --- llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.24 Sat Dec 9 13:41:25 2006 +++ llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs Sat Dec 23 00:05:41 2006 @@ -368,7 +368,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 14 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" #include "ParserInternals.h" #include @@ -381,8 +381,6 @@ #define YYERROR_VERBOSE 1 #define YYINCLUDED_STDLIB_H #define YYDEBUG 1 -#define UPGRADE_SETCOND_OPS 0 -#define GENERATE_FCMP_INSTS 0 int yylex(); // declaration" of xxx warnings. int yyparse(); @@ -552,11 +550,7 @@ // the original intent by replace the cast with a setne const char* comparator = SrcTy.isPointer() ? ", null" : (SrcTy.isFloatingPoint() ? ", 0.0" : ", 0"); -#if UPGRADE_SETCOND_OPS - const char* compareOp = SrcTy.isFloatingPoint() ? "setne " : "icmp ne "; -#else - const char* compareOp = "setne"; -#endif + const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne "; if (isConst) { Result = "(" + Source + comparator + ")"; Result = compareOp + Result; @@ -612,16 +606,12 @@ result[6] = cc1; result[7] = cc2; if (TI.isFloatingPoint()) { -#if GENERATE_FCMP_INSTS result[0] = 'f'; - result[5] = 'o'; // FIXME: Always map to ordered comparison ? + result[5] = 'o'; if (cc1 == 'n') result[5] = 'u'; // NE maps to unordered else result[5] = 'o'; // everything else maps to ordered -#else - result = setcc; -#endif } else if (TI.isIntegral() || TI.isPointer()) { result[0] = 'i'; if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e')) @@ -657,7 +647,7 @@ #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 285 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" typedef union YYSTYPE { std::string* String; TypeInfo Type; @@ -666,7 +656,7 @@ ValueList* ValList; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 670 "UpgradeParser.tab.c" +#line 660 "UpgradeParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -678,7 +668,7 @@ /* Line 219 of yacc.c. */ -#line 682 "UpgradeParser.tab.c" +#line 672 "UpgradeParser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -1032,36 +1022,36 @@ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 348, 348, 348, 349, 349, 353, 353, 353, 353, - 353, 353, 353, 354, 354, 354, 354, 355, 355, 355, - 356, 356, 356, 356, 356, 356, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 358, 358, 358, 358, - 358, 358, 358, 358, 358, 358, 359, 359, 359, 359, - 359, 359, 360, 360, 360, 360, 361, 361, 361, 361, - 361, 361, 361, 362, 362, 362, 362, 362, 362, 367, - 367, 367, 367, 368, 368, 368, 368, 369, 369, 370, - 370, 373, 376, 381, 381, 381, 381, 381, 381, 382, - 383, 386, 386, 386, 386, 386, 387, 388, 393, 398, - 399, 402, 403, 411, 417, 418, 421, 422, 431, 432, - 445, 445, 446, 446, 447, 451, 451, 451, 451, 451, - 451, 451, 452, 452, 452, 452, 452, 454, 458, 462, - 465, 470, 476, 484, 492, 498, 502, 513, 516, 524, - 525, 530, 533, 543, 549, 554, 560, 566, 572, 577, - 583, 589, 595, 601, 607, 613, 619, 625, 631, 639, - 653, 665, 670, 676, 681, 689, 694, 699, 707, 712, - 717, 727, 732, 737, 737, 747, 752, 755, 760, 764, - 768, 770, 770, 773, 785, 790, 795, 804, 813, 822, - 831, 836, 841, 846, 848, 848, 851, 856, 863, 868, - 875, 882, 887, 888, 896, 896, 897, 897, 899, 906, - 910, 914, 917, 922, 925, 927, 947, 948, 950, 959, - 960, 962, 970, 971, 972, 976, 989, 990, 993, 993, - 993, 993, 993, 993, 993, 994, 995, 1000, 1001, 1010, - 1010, 1014, 1020, 1031, 1037, 1040, 1048, 1052, 1057, 1060, - 1066, 1066, 1068, 1073, 1078, 1083, 1091, 1098, 1104, 1124, - 1129, 1135, 1140, 1148, 1157, 1164, 1172, 1176, 1183, 1184, - 1188, 1193, 1196, 1202, 1207, 1215, 1220, 1225, 1230, 1238, - 1252, 1257, 1262, 1267, 1272, 1277, 1282, 1299, 1304, 1305, - 1309, 1310, 1313, 1320, 1327, 1334, 1341, 1346, 1353, 1360 + 0, 338, 338, 338, 339, 339, 343, 343, 343, 343, + 343, 343, 343, 344, 344, 344, 344, 345, 345, 345, + 346, 346, 346, 346, 346, 346, 347, 347, 347, 347, + 347, 347, 347, 347, 347, 347, 348, 348, 348, 348, + 348, 348, 348, 348, 348, 348, 349, 349, 349, 349, + 349, 349, 350, 350, 350, 350, 351, 351, 351, 351, + 351, 351, 351, 352, 352, 352, 352, 352, 352, 357, + 357, 357, 357, 358, 358, 358, 358, 359, 359, 360, + 360, 363, 366, 371, 371, 371, 371, 371, 371, 372, + 373, 376, 376, 376, 376, 376, 377, 378, 383, 388, + 389, 392, 393, 401, 407, 408, 411, 412, 421, 422, + 435, 435, 436, 436, 437, 441, 441, 441, 441, 441, + 441, 441, 442, 442, 442, 442, 442, 444, 448, 452, + 455, 460, 466, 474, 482, 488, 492, 503, 506, 514, + 515, 520, 523, 533, 539, 544, 550, 556, 562, 567, + 573, 579, 585, 591, 597, 603, 609, 615, 621, 629, + 643, 655, 660, 666, 671, 677, 682, 687, 695, 700, + 705, 715, 720, 725, 725, 735, 740, 743, 748, 752, + 756, 758, 758, 761, 773, 778, 783, 792, 801, 810, + 819, 824, 829, 834, 836, 836, 839, 844, 851, 856, + 863, 870, 875, 876, 884, 884, 885, 885, 887, 894, + 898, 902, 905, 910, 913, 915, 935, 936, 938, 947, + 948, 950, 958, 959, 960, 964, 977, 978, 981, 981, + 981, 981, 981, 981, 981, 982, 983, 988, 989, 998, + 998, 1002, 1008, 1019, 1025, 1028, 1036, 1040, 1045, 1048, + 1054, 1054, 1056, 1061, 1066, 1071, 1079, 1086, 1092, 1112, + 1117, 1123, 1128, 1136, 1145, 1152, 1160, 1164, 1171, 1172, + 1176, 1181, 1184, 1190, 1195, 1201, 1206, 1211, 1216, 1224, + 1238, 1243, 1248, 1253, 1258, 1263, 1268, 1285, 1290, 1291, + 1295, 1296, 1299, 1306, 1313, 1320, 1327, 1332, 1339, 1346 }; #endif @@ -2408,26 +2398,26 @@ switch (yyn) { case 81: -#line 373 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 363 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[-1].String); ;} break; case 82: -#line 376 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 366 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(""); ;} break; case 90: -#line 383 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 373 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(""); ;} break; case 97: -#line 388 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 378 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += *(yyvsp[0].String); delete (yyvsp[0].String); @@ -2436,27 +2426,27 @@ break; case 98: -#line 393 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 383 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(""); ;} break; case 99: -#line 398 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 388 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 100: -#line 399 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 389 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;} break; case 101: -#line 402 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 392 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 102: -#line 403 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 393 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, ", "); *(yyvsp[-1].String) += " " + *(yyvsp[0].String); @@ -2466,7 +2456,7 @@ break; case 103: -#line 411 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 401 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -2475,17 +2465,17 @@ break; case 104: -#line 417 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 407 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 106: -#line 421 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 411 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 107: -#line 422 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 412 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, ", "); if (!(yyvsp[0].String)->empty()) @@ -2496,7 +2486,7 @@ break; case 109: -#line 432 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 422 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -2505,7 +2495,7 @@ break; case 127: -#line 454 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 444 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Type).newTy = (yyvsp[0].String); (yyval.Type).oldTy = OpaqueTy; @@ -2513,7 +2503,7 @@ break; case 128: -#line 458 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 448 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Type).newTy = (yyvsp[0].String); (yyval.Type).oldTy = UnresolvedTy; @@ -2521,14 +2511,14 @@ break; case 129: -#line 462 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 452 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Type) = (yyvsp[0].Type); ;} break; case 130: -#line 465 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 455 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Type UpReference (yyvsp[0].String)->insert(0, "\\"); (yyval.Type).newTy = (yyvsp[0].String); @@ -2537,7 +2527,7 @@ break; case 131: -#line 470 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 460 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Function derived type? *(yyvsp[-3].Type).newTy += "( " + *(yyvsp[-1].String) + " )"; delete (yyvsp[-1].String); @@ -2547,7 +2537,7 @@ break; case 132: -#line 476 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 466 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Sized array type? (yyvsp[-3].String)->insert(0,"[ "); *(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " ]"; @@ -2559,7 +2549,7 @@ break; case 133: -#line 484 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 474 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Packed array type? (yyvsp[-3].String)->insert(0,"< "); *(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " >"; @@ -2571,7 +2561,7 @@ break; case 134: -#line 492 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 482 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Structure type? (yyvsp[-1].String)->insert(0, "{ "); *(yyvsp[-1].String) += " }"; @@ -2581,7 +2571,7 @@ break; case 135: -#line 498 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 488 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Empty structure type? (yyval.Type).newTy = new std::string("{}"); (yyval.Type).oldTy = StructTy; @@ -2589,7 +2579,7 @@ break; case 136: -#line 502 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 492 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Pointer type? *(yyvsp[-1].Type).newTy += '*'; (yyval.Type).elemTy = (yyvsp[-1].Type).oldTy; @@ -2599,14 +2589,14 @@ break; case 137: -#line 513 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 503 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].Type).newTy; ;} break; case 138: -#line 516 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 506 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", " + *(yyvsp[0].Type).newTy; delete (yyvsp[0].Type).newTy; @@ -2615,7 +2605,7 @@ break; case 140: -#line 525 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 515 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", ..."; delete (yyvsp[0].String); @@ -2624,21 +2614,21 @@ break; case 141: -#line 530 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 520 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); ;} break; case 142: -#line 533 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 523 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 143: -#line 543 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 533 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Nonempty unsized arr (yyval.Const).type = (yyvsp[-3].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy); @@ -2648,7 +2638,7 @@ break; case 144: -#line 549 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 539 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-2].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy); @@ -2657,7 +2647,7 @@ break; case 145: -#line 554 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 544 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-2].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy); @@ -2667,7 +2657,7 @@ break; case 146: -#line 560 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 550 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Nonempty unsized arr (yyval.Const).type = (yyvsp[-3].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy); @@ -2677,7 +2667,7 @@ break; case 147: -#line 566 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 556 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-3].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy); @@ -2687,7 +2677,7 @@ break; case 148: -#line 572 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 562 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-2].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy); @@ -2696,7 +2686,7 @@ break; case 149: -#line 577 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 567 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2706,7 +2696,7 @@ break; case 150: -#line 583 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 573 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2716,7 +2706,7 @@ break; case 151: -#line 589 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 579 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2726,7 +2716,7 @@ break; case 152: -#line 595 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 585 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2736,7 +2726,7 @@ break; case 153: -#line 601 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 591 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2746,7 +2736,7 @@ break; case 154: -#line 607 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 597 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // integral constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2756,7 +2746,7 @@ break; case 155: -#line 613 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 603 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // integral constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2766,7 +2756,7 @@ break; case 156: -#line 619 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 609 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Boolean constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2776,7 +2766,7 @@ break; case 157: -#line 625 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 615 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Boolean constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2786,7 +2776,7 @@ break; case 158: -#line 631 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 621 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Float & Double constants (yyval.Const).type = (yyvsp[-1].Type); (yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy); @@ -2796,7 +2786,7 @@ break; case 159: -#line 639 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 629 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { std::string source = *(yyvsp[-3].Const).cnst; TypeInfo DstTy = (yyvsp[-1].Type); @@ -2814,7 +2804,7 @@ break; case 160: -#line 653 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 643 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst; for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) { @@ -2830,7 +2820,7 @@ break; case 161: -#line 665 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 655 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2839,7 +2829,7 @@ break; case 162: -#line 670 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 660 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type); (yyval.String) = new std::string(op); @@ -2849,7 +2839,7 @@ break; case 163: -#line 676 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 666 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2858,11 +2848,9 @@ break; case 164: -#line 681 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 671 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { -#if UPGRADE_SETCOND_OPS *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const).type); -#endif *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); (yyval.String) = (yyvsp[-5].String); @@ -2870,7 +2858,7 @@ break; case 165: -#line 689 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 677 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += "(" + *(yyvsp[-5].String) + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2879,7 +2867,7 @@ break; case 166: -#line 694 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 682 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += "(" + *(yyvsp[-5].String) + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2888,7 +2876,7 @@ break; case 167: -#line 699 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 687 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const char* shiftop = (yyvsp[-5].String)->c_str(); if (*(yyvsp[-5].String) == "shr") @@ -2900,7 +2888,7 @@ break; case 168: -#line 707 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 695 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2909,7 +2897,7 @@ break; case 169: -#line 712 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 700 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2918,7 +2906,7 @@ break; case 170: -#line 717 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 705 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); @@ -2927,7 +2915,7 @@ break; case 171: -#line 727 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 715 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst; (yyvsp[0].Const).destroy(); @@ -2936,25 +2924,25 @@ break; case 172: -#line 732 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 720 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;} break; case 175: -#line 747 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 735 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { ;} break; case 176: -#line 752 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 740 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 177: -#line 755 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 743 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -2963,7 +2951,7 @@ break; case 178: -#line 760 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 748 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << "module asm " << " " << *(yyvsp[0].String) << "\n"; (yyval.String) = 0; @@ -2971,7 +2959,7 @@ break; case 179: -#line 764 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 752 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << "implementation\n"; (yyval.String) = 0; @@ -2979,17 +2967,17 @@ break; case 180: -#line 768 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 756 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 182: -#line 770 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 758 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;} break; case 183: -#line 773 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 761 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { EnumeratedTypes.push_back((yyvsp[0].Type)); if (!(yyvsp[-2].String)->empty()) { @@ -3005,7 +2993,7 @@ break; case 184: -#line 785 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 773 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Function prototypes can be in const pool *O << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3014,7 +3002,7 @@ break; case 185: -#line 790 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 778 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Asm blocks can be in the const pool *O << *(yyvsp[-2].String) << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String); @@ -3023,7 +3011,7 @@ break; case 186: -#line 795 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 783 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-4].String)->empty()) { *O << *(yyvsp[-4].String) << " = "; @@ -3036,7 +3024,7 @@ break; case 187: -#line 804 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 792 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-4].String)->empty()) { *O << *(yyvsp[-4].String) << " = "; @@ -3049,7 +3037,7 @@ break; case 188: -#line 813 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 801 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-4].String)->empty()) { *O << *(yyvsp[-4].String) << " = "; @@ -3062,7 +3050,7 @@ break; case 189: -#line 822 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 810 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-4].String)->empty()) { *O << *(yyvsp[-4].String) << " = "; @@ -3075,7 +3063,7 @@ break; case 190: -#line 831 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 819 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << *(yyvsp[-1].String) << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[-1].String); delete (yyvsp[0].String); @@ -3084,7 +3072,7 @@ break; case 191: -#line 836 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 824 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << "\n"; delete (yyvsp[-2].String); delete (yyvsp[0].String); @@ -3093,14 +3081,14 @@ break; case 192: -#line 841 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 829 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 196: -#line 851 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 839 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3109,7 +3097,7 @@ break; case 197: -#line 856 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 844 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); if (*(yyvsp[0].String) == "64") @@ -3120,7 +3108,7 @@ break; case 198: -#line 863 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 851 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3129,7 +3117,7 @@ break; case 199: -#line 868 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 856 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3138,7 +3126,7 @@ break; case 200: -#line 875 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 863 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, "[ "); *(yyvsp[-1].String) += " ]"; @@ -3147,7 +3135,7 @@ break; case 201: -#line 882 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 870 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3156,19 +3144,19 @@ break; case 203: -#line 888 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 876 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 207: -#line 897 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 885 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 208: -#line 899 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 887 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[-1].Type).newTy; if (!(yyvsp[0].String)->empty()) @@ -3178,7 +3166,7 @@ break; case 209: -#line 906 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 894 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3186,21 +3174,21 @@ break; case 210: -#line 910 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 898 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); ;} break; case 211: -#line 914 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 902 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); ;} break; case 212: -#line 917 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 905 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += ", ..."; (yyval.String) = (yyvsp[-2].String); @@ -3209,19 +3197,19 @@ break; case 213: -#line 922 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 910 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); ;} break; case 214: -#line 925 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 913 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 215: -#line 928 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 916 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-7].String)->empty()) { *(yyvsp[-7].String) += " "; @@ -3243,17 +3231,17 @@ break; case 216: -#line 947 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 935 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;} break; case 217: -#line 948 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 936 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string ("{"); ;} break; case 218: -#line 950 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 938 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-2].String)->empty()) { *O << *(yyvsp[-2].String) << " "; @@ -3265,17 +3253,17 @@ break; case 219: -#line 959 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 947 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;} break; case 220: -#line 960 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 948 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string("}"); ;} break; case 221: -#line 962 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 950 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if ((yyvsp[-1].String)) *O << *(yyvsp[-1].String); @@ -3285,12 +3273,12 @@ break; case 222: -#line 970 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 958 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 225: -#line 976 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 964 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-1].String)->empty()) *(yyvsp[-2].String) += " " + *(yyvsp[-1].String); @@ -3302,12 +3290,12 @@ break; case 226: -#line 989 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 977 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 236: -#line 995 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 983 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, "<"); *(yyvsp[-1].String) += ">"; @@ -3316,7 +3304,7 @@ break; case 238: -#line 1001 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 989 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-3].String)->empty()) { *(yyvsp[-4].String) += " " + *(yyvsp[-3].String); @@ -3328,7 +3316,7 @@ break; case 241: -#line 1014 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1002 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Value).val = (yyvsp[0].String); (yyval.Value).constant = false; @@ -3338,7 +3326,7 @@ break; case 242: -#line 1020 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1008 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Value).val = (yyvsp[0].String); (yyval.Value).constant = true; @@ -3348,7 +3336,7 @@ break; case 243: -#line 1031 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1019 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Value) = (yyvsp[0].Value); (yyval.Value).type = (yyvsp[-1].Type); @@ -3357,28 +3345,28 @@ break; case 244: -#line 1037 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1025 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 245: -#line 1040 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1028 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Do not allow functions with 0 basic blocks (yyval.String) = 0; ;} break; case 246: -#line 1048 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1036 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 247: -#line 1052 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1040 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3387,14 +3375,14 @@ break; case 248: -#line 1057 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1045 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = 0; ;} break; case 249: -#line 1060 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1048 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3403,12 +3391,12 @@ break; case 251: -#line 1066 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1054 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;} break; case 252: -#line 1068 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1056 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Return with a result... *O << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].Value).val << "\n"; delete (yyvsp[-1].String); (yyvsp[0].Value).destroy(); @@ -3417,7 +3405,7 @@ break; case 253: -#line 1073 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1061 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Return with no result... *O << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].Type).newTy << "\n"; delete (yyvsp[-1].String); (yyvsp[0].Type).destroy(); @@ -3426,7 +3414,7 @@ break; case 254: -#line 1078 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1066 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Unconditional Branch... *O << " " << *(yyvsp[-2].String) << " " << *(yyvsp[-1].Type).newTy << " " << *(yyvsp[0].Value).val << "\n"; delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy(); @@ -3435,7 +3423,7 @@ break; case 255: -#line 1083 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1071 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[-8].String) << " " << *(yyvsp[-7].Type).newTy << " " << *(yyvsp[-6].Value).val << ", " << *(yyvsp[-4].Type).newTy << " " << *(yyvsp[-3].Value).val << ", " << *(yyvsp[-1].Type).newTy << " " @@ -3447,7 +3435,7 @@ break; case 256: -#line 1091 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1079 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[-8].String) << " " << *(yyvsp[-7].Type).newTy << " " << *(yyvsp[-6].Value).val << ", " << *(yyvsp[-4].Type).newTy << " " << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n"; @@ -3458,7 +3446,7 @@ break; case 257: -#line 1098 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1086 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[-7].String) << " " << *(yyvsp[-6].Type).newTy << " " << *(yyvsp[-5].Value).val << ", " << *(yyvsp[-3].Type).newTy << " " << *(yyvsp[-2].Value).val << "[]\n"; @@ -3468,7 +3456,7 @@ break; case 258: -#line 1105 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1093 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " "; if (!(yyvsp[-13].String)->empty()) @@ -3491,7 +3479,7 @@ break; case 259: -#line 1124 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1112 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3500,7 +3488,7 @@ break; case 260: -#line 1129 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1117 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *O << " " << *(yyvsp[0].String) << "\n"; delete (yyvsp[0].String); @@ -3509,7 +3497,7 @@ break; case 261: -#line 1135 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1123 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + " " + *(yyvsp[-3].String) + ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val; (yyvsp[-4].Type).destroy(); delete (yyvsp[-3].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy(); @@ -3518,7 +3506,7 @@ break; case 262: -#line 1140 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1128 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-3].String)->insert(0, *(yyvsp[-4].Type).newTy + " " ); *(yyvsp[-3].String) += ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val; @@ -3528,7 +3516,7 @@ break; case 263: -#line 1148 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1136 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-1].String)->empty()) *(yyvsp[-1].String) += " = "; @@ -3539,7 +3527,7 @@ break; case 264: -#line 1157 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1145 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Used for PHI nodes (yyvsp[-3].Value).val->insert(0, *(yyvsp[-5].Type).newTy + "["); *(yyvsp[-3].Value).val += "," + *(yyvsp[-1].Value).val + "]"; @@ -3550,7 +3538,7 @@ break; case 265: -#line 1164 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1152 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += ", [" + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + "]"; (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy(); @@ -3559,7 +3547,7 @@ break; case 266: -#line 1172 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = new ValueList(); (yyval.ValList)->push_back((yyvsp[0].Value)); @@ -3567,7 +3555,7 @@ break; case 267: -#line 1176 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1164 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-2].ValList)->push_back((yyvsp[0].Value)); (yyval.ValList) = (yyvsp[-2].ValList); @@ -3575,17 +3563,17 @@ break; case 268: -#line 1183 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1171 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = (yyvsp[0].ValList); ;} break; case 269: -#line 1184 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1172 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = new ValueList(); ;} break; case 270: -#line 1188 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3594,7 +3582,7 @@ break; case 272: -#line 1196 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1184 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type)); (yyval.String) = new std::string(op); @@ -3604,7 +3592,7 @@ break; case 273: -#line 1202 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1190 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3613,11 +3601,9 @@ break; case 274: -#line 1207 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { -#if UPGRADE_SETCOND_OPS *(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type)); -#endif *(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); (yyval.String) = (yyvsp[-4].String); @@ -3625,7 +3611,7 @@ break; case 275: -#line 1215 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1201 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " " + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + ")"; delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy(); @@ -3634,7 +3620,7 @@ break; case 276: -#line 1220 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " " + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + ")"; delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy(); @@ -3643,7 +3629,7 @@ break; case 277: -#line 1225 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val; (yyvsp[0].Value).destroy(); @@ -3652,7 +3638,7 @@ break; case 278: -#line 1230 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { const char* shiftop = (yyvsp[-3].String)->c_str(); if (*(yyvsp[-3].String) == "shr") @@ -3664,7 +3650,7 @@ break; case 279: -#line 1238 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { std::string source = *(yyvsp[-2].Value).val; TypeInfo SrcTy = (yyvsp[-2].Value).type; @@ -3682,7 +3668,7 @@ break; case 280: -#line 1252 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1238 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3691,7 +3677,7 @@ break; case 281: -#line 1257 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1243 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Type).newTy; (yyvsp[-2].Value).destroy(); (yyvsp[0].Type).destroy(); @@ -3700,7 +3686,7 @@ break; case 282: -#line 1262 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1248 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3709,7 +3695,7 @@ break; case 283: -#line 1267 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1253 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3718,7 +3704,7 @@ break; case 284: -#line 1272 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); @@ -3727,7 +3713,7 @@ break; case 285: -#line 1277 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1263 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3736,7 +3722,7 @@ break; case 286: -#line 1282 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1268 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-5].String)->empty()) *(yyvsp[-6].String) += " " + *(yyvsp[-5].String); @@ -3757,22 +3743,22 @@ break; case 288: -#line 1304 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1290 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = (yyvsp[0].ValList); ;} break; case 289: -#line 1305 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1291 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.ValList) = new ValueList(); ;} break; case 291: -#line 1310 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1296 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 292: -#line 1313 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1299 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy; if (!(yyvsp[0].String)->empty()) @@ -3783,7 +3769,7 @@ break; case 293: -#line 1320 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1306 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val; if (!(yyvsp[0].String)->empty()) @@ -3794,7 +3780,7 @@ break; case 294: -#line 1327 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1313 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy; if (!(yyvsp[0].String)->empty()) @@ -3805,7 +3791,7 @@ break; case 295: -#line 1334 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1320 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val; if (!(yyvsp[0].String)->empty()) @@ -3816,7 +3802,7 @@ break; case 296: -#line 1341 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1327 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val; (yyvsp[0].Value).destroy(); @@ -3825,7 +3811,7 @@ break; case 297: -#line 1346 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1332 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-3].String)->empty()) *(yyvsp[-3].String) += " "; @@ -3836,7 +3822,7 @@ break; case 298: -#line 1353 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1339 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { if (!(yyvsp[-5].String)->empty()) *(yyvsp[-5].String) += " "; @@ -3847,7 +3833,7 @@ break; case 299: -#line 1360 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1346 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" { // Upgrade the indices for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) { @@ -3878,7 +3864,7 @@ } /* Line 1126 of yacc.c. */ -#line 3882 "UpgradeParser.tab.c" +#line 3868 "UpgradeParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -4146,7 +4132,7 @@ } -#line 1384 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 1370 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" int yyerror(const char *ErrorMsg) { Index: llvm/tools/llvm-upgrade/UpgradeParser.h diff -u llvm/tools/llvm-upgrade/UpgradeParser.h:1.19 llvm/tools/llvm-upgrade/UpgradeParser.h:1.20 --- llvm/tools/llvm-upgrade/UpgradeParser.h:1.19 Sat Dec 9 10:57:22 2006 +++ llvm/tools/llvm-upgrade/UpgradeParser.h Sat Dec 23 00:05:41 2006 @@ -333,7 +333,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 285 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" typedef union YYSTYPE { std::string* String; TypeInfo Type; Index: llvm/tools/llvm-upgrade/UpgradeParser.h.cvs diff -u llvm/tools/llvm-upgrade/UpgradeParser.h.cvs:1.17 llvm/tools/llvm-upgrade/UpgradeParser.h.cvs:1.18 --- llvm/tools/llvm-upgrade/UpgradeParser.h.cvs:1.17 Sat Dec 9 10:57:22 2006 +++ llvm/tools/llvm-upgrade/UpgradeParser.h.cvs Sat Dec 23 00:05:41 2006 @@ -333,7 +333,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 285 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y" +#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" typedef union YYSTYPE { std::string* String; TypeInfo Type; Index: llvm/tools/llvm-upgrade/UpgradeParser.y diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.24 llvm/tools/llvm-upgrade/UpgradeParser.y:1.25 --- llvm/tools/llvm-upgrade/UpgradeParser.y:1.24 Sat Dec 9 13:40:41 2006 +++ llvm/tools/llvm-upgrade/UpgradeParser.y Sat Dec 23 00:05:41 2006 @@ -23,8 +23,6 @@ #define YYERROR_VERBOSE 1 #define YYINCLUDED_STDLIB_H #define YYDEBUG 1 -#define UPGRADE_SETCOND_OPS 0 -#define GENERATE_FCMP_INSTS 0 int yylex(); // declaration" of xxx warnings. int yyparse(); @@ -194,11 +192,7 @@ // the original intent by replace the cast with a setne const char* comparator = SrcTy.isPointer() ? ", null" : (SrcTy.isFloatingPoint() ? ", 0.0" : ", 0"); -#if UPGRADE_SETCOND_OPS - const char* compareOp = SrcTy.isFloatingPoint() ? "setne " : "icmp ne "; -#else - const char* compareOp = "setne"; -#endif + const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne "; if (isConst) { Result = "(" + Source + comparator + ")"; Result = compareOp + Result; @@ -254,16 +248,12 @@ result[6] = cc1; result[7] = cc2; if (TI.isFloatingPoint()) { -#if GENERATE_FCMP_INSTS result[0] = 'f'; - result[5] = 'o'; // FIXME: Always map to ordered comparison ? + result[5] = 'o'; if (cc1 == 'n') result[5] = 'u'; // NE maps to unordered else result[5] = 'o'; // everything else maps to ordered -#else - result = setcc; -#endif } else if (TI.isIntegral() || TI.isPointer()) { result[0] = 'i'; if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e')) @@ -679,9 +669,7 @@ $$ = $1; } | SetCondOps '(' ConstVal ',' ConstVal ')' { -#if UPGRADE_SETCOND_OPS *$1 = getCompareOp(*$1, $3.type); -#endif *$1 += "(" + *$3.cnst + "," + *$5.cnst + ")"; $3.destroy(); $5.destroy(); $$ = $1; @@ -1205,9 +1193,7 @@ $$ = $1; } | SetCondOps Types ValueRef ',' ValueRef { -#if UPGRADE_SETCOND_OPS *$1 = getCompareOp(*$1, $2); -#endif *$1 += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val; $2.destroy(); $3.destroy(); $5.destroy(); $$ = $1; Index: llvm/tools/llvm-upgrade/UpgradeParser.y.cvs diff -u llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.23 llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.24 --- llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.23 Sat Dec 9 13:41:25 2006 +++ llvm/tools/llvm-upgrade/UpgradeParser.y.cvs Sat Dec 23 00:05:41 2006 @@ -23,8 +23,6 @@ #define YYERROR_VERBOSE 1 #define YYINCLUDED_STDLIB_H #define YYDEBUG 1 -#define UPGRADE_SETCOND_OPS 0 -#define GENERATE_FCMP_INSTS 0 int yylex(); // declaration" of xxx warnings. int yyparse(); @@ -194,11 +192,7 @@ // the original intent by replace the cast with a setne const char* comparator = SrcTy.isPointer() ? ", null" : (SrcTy.isFloatingPoint() ? ", 0.0" : ", 0"); -#if UPGRADE_SETCOND_OPS - const char* compareOp = SrcTy.isFloatingPoint() ? "setne " : "icmp ne "; -#else - const char* compareOp = "setne"; -#endif + const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne "; if (isConst) { Result = "(" + Source + comparator + ")"; Result = compareOp + Result; @@ -254,16 +248,12 @@ result[6] = cc1; result[7] = cc2; if (TI.isFloatingPoint()) { -#if GENERATE_FCMP_INSTS result[0] = 'f'; - result[5] = 'o'; // FIXME: Always map to ordered comparison ? + result[5] = 'o'; if (cc1 == 'n') result[5] = 'u'; // NE maps to unordered else result[5] = 'o'; // everything else maps to ordered -#else - result = setcc; -#endif } else if (TI.isIntegral() || TI.isPointer()) { result[0] = 'i'; if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e')) @@ -679,9 +669,7 @@ $$ = $1; } | SetCondOps '(' ConstVal ',' ConstVal ')' { -#if UPGRADE_SETCOND_OPS *$1 = getCompareOp(*$1, $3.type); -#endif *$1 += "(" + *$3.cnst + "," + *$5.cnst + ")"; $3.destroy(); $5.destroy(); $$ = $1; @@ -1205,9 +1193,7 @@ $$ = $1; } | SetCondOps Types ValueRef ',' ValueRef { -#if UPGRADE_SETCOND_OPS *$1 = getCompareOp(*$1, $2); -#endif *$1 += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val; $2.destroy(); $3.destroy(); $5.destroy(); $$ = $1; From rspencer at reidspencer.com Sat Dec 23 00:08:03 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Fri, 22 Dec 2006 22:08:03 -0800 Subject: [llvm-commits] [llvm-gcc] SETCC Removal Patch (Please Commit) Message-ID: <1166854083.18862.18.camel@bashful.x10sys.com> All, As the SetCondInst instruction has been replaced with the new FCmpInst and ICmpInst instrucitons in LLVM, the attached patch compensates for this in llvm-gcc. Since the Apple developers are unlikely to commit this for over a week, if you're working over the holidays you'll need to apply this manually to your llvm-gcc tree. Thanks, Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: SETCC.patch Type: text/x-patch Size: 13167 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061222/b8922a58/attachment.bin From reid at x10sys.com Sat Dec 23 04:21:42 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 04:21:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200612231021.kBNALgq8004169@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.119 -> 1.120 --- Log message: Don't overload var names. --- Diffs of the changes: (+4 -4) ConstantFolding.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.119 llvm/lib/VMCore/ConstantFolding.cpp:1.120 --- llvm/lib/VMCore/ConstantFolding.cpp:1.119 Sat Dec 23 00:05:41 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Sat Dec 23 04:21:26 2006 @@ -883,11 +883,11 @@ // null pointer, do the comparison with the pre-casted value. if (V2->isNullValue() && (isa(CE1->getType()) || CE1->getType()->isIntegral())) { - bool isSigned = CE1->getOpcode() == Instruction::ZExt ? false : + bool sgnd = CE1->getOpcode() == Instruction::ZExt ? false : (CE1->getOpcode() == Instruction::SExt ? true : (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned)); return evaluateICmpRelation( - CE1Op0, Constant::getNullValue(CE1Op0->getType()), isSigned); + CE1Op0, Constant::getNullValue(CE1Op0->getType()), sgnd); } // If the dest type is a pointer type, and the RHS is a constantexpr cast @@ -898,11 +898,11 @@ if (CE2->isCast() && isa(CE1->getType()) && CE1->getOperand(0)->getType() == CE2->getOperand(0)->getType() && CE1->getOperand(0)->getType()->isIntegral()) { - bool isSigned = CE1->getOpcode() == Instruction::ZExt ? false : + bool sgnd = CE1->getOpcode() == Instruction::ZExt ? false : (CE1->getOpcode() == Instruction::SExt ? true : (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned)); return evaluateICmpRelation(CE1->getOperand(0), CE2->getOperand(0), - isSigned); + sgnd); } break; From reid at x10sys.com Sat Dec 23 12:58:19 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 12:58:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612231858.kBNIwJss013964@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.573 -> 1.574 --- Log message: For PR1065: http://llvm.org/PR1065 : Don't allow CmpInst instances to be processed in FoldSelectOpOp because you can't easily swap their operands. --- Diffs of the changes: (+7 -12) InstructionCombining.cpp | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.573 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.574 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.573 Sat Dec 23 00:05:41 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Dec 23 12:58:04 2006 @@ -6555,13 +6555,7 @@ } // Only handle binary, compare and shift operators here. - if (!isa(TI) && !isa(TI) && !isa(TI)) - return 0; - - // If the CmpInst predicates don't match, then the instructions aren't the - // same and we can't continue. - if (isa(TI) && isa(FI) && - (cast(TI)->getPredicate() != cast(FI)->getPredicate())) + if (!isa(TI) && !isa(TI)) return 0; // Figure out if the operations have any operands in common. @@ -6603,12 +6597,13 @@ return BinaryOperator::create(BO->getOpcode(), MatchOp, NewSI); else return BinaryOperator::create(BO->getOpcode(), NewSI, MatchOp); - } else { - if (MatchIsOpZero) - return new ShiftInst(cast(TI)->getOpcode(), MatchOp, NewSI); - else - return new ShiftInst(cast(TI)->getOpcode(), NewSI, MatchOp); } + + assert(isa(TI) && "Should only have Shift here"); + if (MatchIsOpZero) + return new ShiftInst(cast(TI)->getOpcode(), MatchOp, NewSI); + else + return new ShiftInst(cast(TI)->getOpcode(), NewSI, MatchOp); } Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { From reid at x10sys.com Sat Dec 23 13:07:09 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 13:07:09 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/InstrTypes.h Message-ID: <200612231907.kBNJ79xS014147@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: InstrTypes.h updated: 1.56 -> 1.57 --- Log message: Add some documentation to make Nick happy. --- Diffs of the changes: (+2 -1) InstrTypes.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/InstrTypes.h diff -u llvm/include/llvm/InstrTypes.h:1.56 llvm/include/llvm/InstrTypes.h:1.57 --- llvm/include/llvm/InstrTypes.h:1.56 Sat Dec 23 00:05:40 2006 +++ llvm/include/llvm/InstrTypes.h Sat Dec 23 13:06:54 2006 @@ -532,7 +532,8 @@ unsigned getNumOperands() const { return 2; } /// This is just a convenience that dispatches to the subclasses. - /// @brief Swap the operands. + /// @brief Swap the operands and adjust predicate accordingly to retain + /// the same comparison. void swapOperands(); /// This is just a convenience that dispatches to the subclasses. From reid at x10sys.com Sat Dec 23 13:14:26 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 13:14:26 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll Message-ID: <200612231914.kBNJEQhe014288@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2006-12-23-Select-Cmp-Cmp.ll added (r1.1) --- Log message: Test case for PR1065: http://llvm.org/PR1065 . --- Diffs of the changes: (+33 -0) 2006-12-23-Select-Cmp-Cmp.ll | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll:1.1 *** /dev/null Sat Dec 23 13:14:20 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll Sat Dec 23 13:14:10 2006 *************** *** 0 **** --- 1,33 ---- + ; For PR1065. This causes an assertion in instcombine if a select with two cmp + ; operands is encountered. + ; RUN: llvm-as < %s | opt -instcombine -disable-output + ; ModuleID = 'PR1065.bc' + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + %struct.internal_state = type { int } + %struct.mng_data = type { uint, sbyte*, uint, uint, uint, uint, uint, uint, uint, uint, uint, ubyte, uint, uint, uint, sbyte, uint, uint, uint, uint, ushort, ushort, ushort, sbyte, sbyte, double, double, double, sbyte, sbyte, sbyte, sbyte, uint, uint, uint, uint, int, sbyte, int, int, sbyte*, sbyte* (uint)*, void (sbyte*, uint)*, void (sbyte*, sbyte*, uint)*, sbyte (%struct.mng_data*)*, sbyte (%struct.mng_data*)*, sbyte (%struct.mng_data*, sbyte*, uint, uint*)*, sbyte (%struct.mng_data*, sbyte*, uint, uint*)*, sbyte (%struct.mng_data*, int, sbyte, int, uint, int, int, sbyte*)*, sbyte (%struct.mng_data*, int, int, sbyte*)*, sbyte (%struct.mng_data*, uint, uint)*, sbyte (%struct.mng_data*, ubyte, sbyte*, sbyte*, sbyte*, sbyte*)*, sbyte (%struct.mng_data*)*, sbyte (%struct.mng_data*, sbyte*)*, sbyte (%struct.mng_data*, sbyte*)*, sbyte (%struct.mng_data*, uint, uint)*, sbyte (%struct.mng_data*, int, uint, sbyte*)*, sbyte (%struct.mng_data*, ubyte, ubyte, uint, uint)*, sbyte* ! (%struct.mng_data*, uint)*, sbyte* (%struct.mng_data*, uint)*, sbyte* (%struct.mng_data*, uint)*, sbyte (%struct.mng_data*, uint, uint, uint, uint)*, uint (%struct.mng_data*)*, sbyte (%struct.mng_data*, uint)*, sbyte (%struct.mng_data*, uint)*, sbyte (%struct.mng_data*, uint, uint, uint, uint, uint, uint, uint, uint)*, sbyte (%struct.mng_data*, ubyte)*, sbyte (%struct.mng_data*, uint, sbyte*)*, sbyte (%struct.mng_data*, uint, sbyte, sbyte*)*, sbyte, int, uint, sbyte*, sbyte*, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, uint, uint, ubyte, ubyte, ubyte, ubyte, ubyte, uint, sbyte, sbyte, sbyte, uint, ubyte*, uint, ubyte*, uint, sbyte, ubyte, sbyte, uint, ubyte*, ubyte*, uint, uint, ubyte*, ubyte*, %struct.mng_pushdata*, %struct.mng_pushdata*, %struct.mng_pushdata*, %struct.mng_pushdata*, sbyte, sbyte, int, uint, ubyte*, sbyte, sbyte, uint, uint, ui! nt, uint, uint, uint, sbyte, sbyte, sbyte, sbyte, int, int, sb! yte*, ui nt, uint, uint, sbyte, sbyte, uint, uint, uint, uint, sbyte, sbyte, ubyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, uint, sbyte*, sbyte*, sbyte*, uint, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct.mng_savedata*, uint, uint, uint, uint, sbyte, int, int, int, int, int, int, int, int, int, int, int, int, uint, uint, uint, uint, ubyte*, ubyte*, ubyte*, sbyte, sbyte, int, int, int, int, int, int, int, int, int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, [256 x ubyte], double, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, ushort, sbyte, ubyte, sbyte, ubyte, sbyte, int, int, sbyte, int, int, int, int, ushort, ushort, ushort, ubyte, ushort, ubyte, int, int, uint, uint, ubyte, uint, uint, sbyte, int, int, int, int, ubyte, uint, uint, sbyte, int, int, int, int, uint, sbyte, uint, ubyte, ushort, ushort, ushort, short, uint, [256 x %struct.mng_palette8e], uint, [256 x ubyte], uint, uint, uint, uint, uint,! uint, uint, uint, uint, ubyte, uint, sbyte*, ushort, ushort, ushort, sbyte*, ubyte, ubyte, uint, uint, uint, uint, sbyte, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, sbyte*, ubyte, ubyte, ubyte, uint, sbyte*, sbyte*, ushort, ushort, ushort, ushort, int, int, sbyte*, %struct.z_stream, int, int, int, int, int, uint, sbyte, sbyte, [256 x uint], sbyte } + %struct.mng_palette8e = type { ubyte, ubyte, ubyte } + %struct.mng_pushdata = type { sbyte*, sbyte*, uint, sbyte, ubyte*, uint } + %struct.mng_savedata = type { sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, ushort, ushort, ushort, ubyte, ushort, ubyte, ubyte, uint, uint, sbyte, int, int, int, int, uint, [256 x %struct.mng_palette8e], uint, [256 x ubyte], uint, uint, uint, uint, uint, uint, uint, uint, uint, ubyte, uint, sbyte*, ushort, ushort, ushort } + %struct.z_stream = type { ubyte*, uint, uint, ubyte*, uint, uint, sbyte*, %struct.internal_state*, sbyte* (sbyte*, uint, uint)*, void (sbyte*, sbyte*)*, sbyte*, int, uint, uint } + + implementation ; Functions: + + void %mng_write_basi() { + entry: + %tmp = load ubyte* null ; [#uses=1] + %tmp = icmp ugt ubyte %tmp, 8 ; [#uses=1] + %tmp = load ushort* null ; [#uses=2] + %tmp3 = icmp eq ushort %tmp, 255 ; [#uses=1] + %tmp7 = icmp eq ushort %tmp, -1 ; [#uses=1] + %bOpaque.0.in = select bool %tmp, bool %tmp7, bool %tmp3 ; [#uses=1] + br bool %bOpaque.0.in, label %cond_next90, label %bb95 + + cond_next90: ; preds = %entry + ret void + + bb95: ; preds = %entry + ret void + } From reid at x10sys.com Sat Dec 23 13:18:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 13:18:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612231918.kBNJIDGA014352@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.574 -> 1.575 --- Log message: Shut up some compilers that can't accurately analyze variable usage correctly and emit "may be used uninitialized" warnings. --- Diffs of the changes: (+2 -2) InstructionCombining.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.574 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.575 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.574 Sat Dec 23 12:58:04 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Dec 23 13:17:57 2006 @@ -4518,8 +4518,8 @@ if (KnownOne | KnownZero) { // Compute the Min, Max and RHS values based on the known bits. For the // EQ and NE we use unsigned values. - uint64_t UMin, UMax, URHSVal; - int64_t SMin, SMax, SRHSVal; + uint64_t UMin = 0, UMax = 0, URHSVal = 0; + int64_t SMin = 0, SMax = 0, SRHSVal = 0; if (ICmpInst::isSignedPredicate(I.getPredicate())) { SRHSVal = CI->getSExtValue(); ComputeSignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne, SMin, From reid at x10sys.com Sat Dec 23 18:41:14 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 23 Dec 2006 18:41:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612240041.kBO0fE8t019490@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.575 -> 1.576 --- Log message: For PR1066: http://llvm.org/PR1066 : Fix this by ensuring that a bitcast is inserted to do sign switching. This is only temporarily needed as the merging of signed and unsigned is next on the SignlessTypes plate. --- Diffs of the changes: (+8 -2) InstructionCombining.cpp | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.575 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.576 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.575 Sat Dec 23 13:17:57 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Dec 23 18:40:59 2006 @@ -2002,8 +2002,14 @@ if (CU->getZExtValue() == SI->getType()->getPrimitiveSizeInBits()-1) { // Ok, the transformation is safe. Insert AShr. - return new ShiftInst(Instruction::AShr, SI->getOperand(0), - CU, SI->getName()); + // FIXME: Once integer types are signless, this cast should be + // removed. + Value *ShiftOp = SI->getOperand(0); + if (ShiftOp->getType() != I.getType()) + ShiftOp = InsertCastBefore(Instruction::BitCast, ShiftOp, + I.getType(), I); + return new ShiftInst(Instruction::AShr, ShiftOp, CU, + SI->getName()); } } } From reid at x10sys.com Sun Dec 24 12:42:45 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 24 Dec 2006 12:42:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200612241842.kBOIgjSq005763@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.191 -> 1.192 --- Log message: Fix some comments. --- Diffs of the changes: (+2 -2) Constants.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.191 llvm/lib/VMCore/Constants.cpp:1.192 --- llvm/lib/VMCore/Constants.cpp:1.191 Sat Dec 23 00:05:41 2006 +++ llvm/lib/VMCore/Constants.cpp Sun Dec 24 12:42:29 2006 @@ -1818,7 +1818,7 @@ std::vector ArgVec; ArgVec.push_back(LHS); ArgVec.push_back(RHS); - // Fake up an opcode value that encodes both the opcode and predicate + // Get the key type with both the opcode and predicate const ExprMapKeyType Key(Instruction::ICmp, ArgVec, pred); return ExprConstants->getOrCreate(Type::BoolTy, Key); } @@ -1835,7 +1835,7 @@ std::vector ArgVec; ArgVec.push_back(LHS); ArgVec.push_back(RHS); - // Fake up an opcode value that encodes both the opcode and predicate + // Get the key type with both the opcode and predicate const ExprMapKeyType Key(Instruction::FCmp, ArgVec, pred); return ExprConstants->getOrCreate(Type::BoolTy, Key); } From reid at x10sys.com Sun Dec 24 12:52:23 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 24 Dec 2006 12:52:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp ConstantFolding.h Message-ID: <200612241852.kBOIqNV0005916@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.120 -> 1.121 ConstantFolding.h updated: 1.51 -> 1.52 --- Log message: Cleanup ConstantFoldCompareInstruction: 1. Make the arguments const like the other ConstantFold* functions. 2. Clean up evaluateFCmpRelation so it makes sense for floating point. 3. Implement the use of evaluateFCmpRelation to fold floating point CEs 4. Shorten a variable name so more things fit on one line. 5. Fix various comments. --- Diffs of the changes: (+203 -135) ConstantFolding.cpp | 335 +++++++++++++++++++++++++++++++--------------------- ConstantFolding.h | 3 2 files changed, 203 insertions(+), 135 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.120 llvm/lib/VMCore/ConstantFolding.cpp:1.121 --- llvm/lib/VMCore/ConstantFolding.cpp:1.120 Sat Dec 23 04:21:26 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Sun Dec 24 12:52:08 2006 @@ -742,50 +742,61 @@ /// things like ConstantFP comparisons, but should instead handle ConstantExprs. /// If we can determine that the two constants have a particular relation to /// each other, we should return the corresponding FCmpInst predicate, -/// otherwise return FCmpInst::BAD_FCMP_PREDICATE. +/// otherwise return FCmpInst::BAD_FCMP_PREDICATE. This is used below in +/// ConstantFoldCompareInstruction. /// /// To simplify this code we canonicalize the relation so that the first -/// operand is always the most "complex" of the two. We consider simple -/// constants (like ConstantFP) to be the simplest, followed by -/// GlobalValues, followed by ConstantExpr's (the most complex). -static FCmpInst::Predicate evaluateFCmpRelation(Constant *V1, Constant *V2) { +/// operand is always the most "complex" of the two. We consider ConstantFP +/// to be the simplest, and ConstantExprs to be the most complex. +static FCmpInst::Predicate evaluateFCmpRelation(const Constant *V1, + const Constant *V2) { assert(V1->getType() == V2->getType() && - "Cannot compare different types of values!"); + "Cannot compare values of different types!"); + // Handle degenerate case quickly if (V1 == V2) return FCmpInst::FCMP_OEQ; - if (!isa(V1) && !isa(V1)) { - if (!isa(V2) && !isa(V2)) { - // We distilled this down to a simple case, use the standard constant - // folder. - ConstantBool *R = dyn_cast( - ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, V1, V2)); + if (!isa(V1)) { + if (!isa(V2)) { + // We distilled thisUse the standard constant folder for a few cases + ConstantBool *R = 0; + Constant *C1 = const_cast(V1); + Constant *C2 = const_cast(V2); + R = dyn_cast( + ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, C1, C2)); if (R && R->getValue()) return FCmpInst::FCMP_OEQ; R = dyn_cast( - ConstantExpr::getFCmp(FCmpInst::FCMP_OLT, V1, V2)); + ConstantExpr::getFCmp(FCmpInst::FCMP_OLT, C1, C2)); if (R && R->getValue()) return FCmpInst::FCMP_OLT; R = dyn_cast( - ConstantExpr::getFCmp(FCmpInst::FCMP_OGT, V1, V2)); - if (R && R->getValue()) return FCmpInst::FCMP_OGT; - - // If we couldn't figure it out, bail. + ConstantExpr::getFCmp(FCmpInst::FCMP_OGT, C1, C2)); + if (R && R->getValue()) + return FCmpInst::FCMP_OGT; + + // Nothing more we can do return FCmpInst::BAD_FCMP_PREDICATE; } - // If the first operand is simple, swap operands. - FCmpInst::Predicate SwappedPredicate = evaluateFCmpRelation(V2, V1); - if (SwappedPredicate != FCmpInst::BAD_FCMP_PREDICATE) - return FCmpInst::getSwappedPredicate(SwappedPredicate); - - return FCmpInst::BAD_FCMP_PREDICATE; + // If the first operand is simple and second is ConstantExpr, swap operands. + FCmpInst::Predicate SwappedRelation = evaluateFCmpRelation(V2, V1); + if (SwappedRelation != FCmpInst::BAD_FCMP_PREDICATE) + return FCmpInst::getSwappedPredicate(SwappedRelation); + } else { + // Ok, the LHS is known to be a constantexpr. The RHS can be any of a + // constantexpr or a simple constant. + const ConstantExpr *CE1 = cast(V1); + switch (CE1->getOpcode()) { + case Instruction::FPTrunc: + case Instruction::FPExt: + case Instruction::UIToFP: + case Instruction::SIToFP: + // We might be able to do something with these but we don't right now. + break; + default: + break; + } } - - // Ok, the LHS is known to be a constantexpr. The RHS can be any of a - // constantexpr, a CPR, or a simple constant. - // ConstantExpr *CE1 = cast(V1); - // Constant *CE1Op0 = CE1->getOperand(0); - // There are MANY other foldings that we could perform here. They will // probably be added on demand, as they seem needed. return FCmpInst::BAD_FCMP_PREDICATE; @@ -803,7 +814,8 @@ /// constants (like ConstantInt) to be the simplest, followed by /// GlobalValues, followed by ConstantExpr's (the most complex). /// -static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2, +static ICmpInst::Predicate evaluateICmpRelation(const Constant *V1, + const Constant *V2, bool isSigned) { assert(V1->getType() == V2->getType() && "Cannot compare different types of values!"); @@ -813,17 +825,19 @@ if (!isa(V2) && !isa(V2)) { // We distilled this down to a simple case, use the standard constant // folder. + ConstantBool *R = 0; + Constant *C1 = const_cast(V1); + Constant *C2 = const_cast(V2); ICmpInst::Predicate pred = ICmpInst::ICMP_EQ; - ConstantBool *R = - dyn_cast(ConstantExpr::getICmp(pred, V1, V2)); + R = dyn_cast(ConstantExpr::getICmp(pred, C1, C2)); if (R && R->getValue()) return pred; pred = isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; - R = dyn_cast(ConstantExpr::getICmp(pred, V1, V2)); + R = dyn_cast(ConstantExpr::getICmp(pred, C1, C2)); if (R && R->getValue()) return pred; pred = isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; - R = dyn_cast(ConstantExpr::getICmp(pred, V1, V2)); + R = dyn_cast(ConstantExpr::getICmp(pred, C1, C2)); if (R && R->getValue()) return pred; @@ -861,8 +875,8 @@ } else { // Ok, the LHS is known to be a constantexpr. The RHS can be any of a // constantexpr, a CPR, or a simple constant. - ConstantExpr *CE1 = cast(V1); - Constant *CE1Op0 = CE1->getOperand(0); + const ConstantExpr *CE1 = cast(V1); + const Constant *CE1Op0 = CE1->getOperand(0); switch (CE1->getOpcode()) { case Instruction::Trunc: @@ -894,7 +908,7 @@ // from the same type as the src of the LHS, evaluate the inputs. This is // important for things like "icmp eq (cast 4 to int*), (cast 5 to int*)", // which happens a lot in compilers with tagged integers. - if (ConstantExpr *CE2 = dyn_cast(V2)) + if (const ConstantExpr *CE2 = dyn_cast(V2)) if (CE2->isCast() && isa(CE1->getType()) && CE1->getOperand(0)->getType() == CE2->getOperand(0)->getType() && CE1->getOperand(0)->getType()->isIntegral()) { @@ -912,7 +926,7 @@ if (isa(V2)) { // If we are comparing a GEP to a null pointer, check to see if the base // of the GEP equals the null pointer. - if (GlobalValue *GV = dyn_cast(CE1Op0)) { + if (const GlobalValue *GV = dyn_cast(CE1Op0)) { if (GV->hasExternalWeakLinkage()) // Weak linkage GVals could be zero or not. We're comparing that // to null pointer so its greater-or-equal @@ -1015,8 +1029,9 @@ return ICmpInst::BAD_ICMP_PREDICATE; } -Constant *llvm::ConstantFoldCompareInstruction(unsigned short predicate, - Constant *C1, Constant *C2) { +Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred, + const Constant *C1, + const Constant *C2) { // Handle some degenerate cases first if (isa(C1) || isa(C2)) @@ -1026,24 +1041,24 @@ if (C1->isNullValue()) { if (const GlobalValue *GV = dyn_cast(C2)) if (!GV->hasExternalWeakLinkage()) // External weak GV can be null - if (predicate == ICmpInst::ICMP_EQ) + if (pred == ICmpInst::ICMP_EQ) return ConstantBool::getFalse(); - else if (predicate == ICmpInst::ICMP_NE) + else if (pred == ICmpInst::ICMP_NE) return ConstantBool::getTrue(); // icmp eq/ne(GV,null) -> false/true } else if (C2->isNullValue()) { if (const GlobalValue *GV = dyn_cast(C1)) if (!GV->hasExternalWeakLinkage()) // External weak GV can be null - if (predicate == ICmpInst::ICMP_EQ) + if (pred == ICmpInst::ICMP_EQ) return ConstantBool::getFalse(); - else if (predicate == ICmpInst::ICMP_NE) + else if (pred == ICmpInst::ICMP_NE) return ConstantBool::getTrue(); } if (isa(C1) && isa(C2)) { bool C1Val = cast(C1)->getValue(); bool C2Val = cast(C2)->getValue(); - switch (predicate) { + switch (pred) { default: assert(0 && "Invalid ICmp Predicate"); return 0; case ICmpInst::ICMP_EQ: return ConstantBool::get(C1Val == C2Val); case ICmpInst::ICMP_NE: return ConstantBool::get(C1Val != C2Val); @@ -1057,10 +1072,10 @@ case ICmpInst::ICMP_SGE:return ConstantBool::get(C1Val >= C2Val); } } else if (isa(C1) && isa(C2)) { - if (ICmpInst::isSignedPredicate(ICmpInst::Predicate(predicate))) { + if (ICmpInst::isSignedPredicate(ICmpInst::Predicate(pred))) { int64_t V1 = cast(C1)->getSExtValue(); int64_t V2 = cast(C2)->getSExtValue(); - switch (predicate) { + switch (pred) { default: assert(0 && "Invalid ICmp Predicate"); return 0; case ICmpInst::ICMP_SLT:return ConstantBool::get(V1 < V2); case ICmpInst::ICMP_SGT:return ConstantBool::get(V1 > V2); @@ -1070,7 +1085,7 @@ } else { uint64_t V1 = cast(C1)->getZExtValue(); uint64_t V2 = cast(C2)->getZExtValue(); - switch (predicate) { + switch (pred) { default: assert(0 && "Invalid ICmp Predicate"); return 0; case ICmpInst::ICMP_EQ: return ConstantBool::get(V1 == V2); case ICmpInst::ICMP_NE: return ConstantBool::get(V1 != V2); @@ -1083,7 +1098,7 @@ } else if (isa(C1) && isa(C2)) { double C1Val = cast(C1)->getValue(); double C2Val = cast(C2)->getValue(); - switch (predicate) { + switch (pred) { default: assert(0 && "Invalid FCmp Predicate"); return 0; case FCmpInst::FCMP_FALSE: return ConstantBool::getFalse(); case FCmpInst::FCMP_TRUE: return ConstantBool::getTrue(); @@ -1102,9 +1117,9 @@ case FCmpInst::FCMP_UGE: case FCmpInst::FCMP_OGE: return ConstantBool::get(C1Val >= C2Val); } - } else if (ConstantPacked *CP1 = dyn_cast(C1)) { - if (ConstantPacked *CP2 = dyn_cast(C2)) { - if (predicate == FCmpInst::FCMP_OEQ || predicate == FCmpInst::FCMP_UEQ) { + } else if (const ConstantPacked *CP1 = dyn_cast(C1)) { + if (const ConstantPacked *CP2 = dyn_cast(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, const_cast(CP1->getOperand(i)), @@ -1114,7 +1129,7 @@ } // Otherwise, could not decide from any element pairs. return 0; - } else if (predicate == ICmpInst::ICMP_EQ) { + } else if (pred == ICmpInst::ICMP_EQ) { for (unsigned i = 0, e = CP1->getNumOperands(); i != e; ++i) { Constant *C = ConstantExpr::getICmp(ICmpInst::ICMP_EQ, const_cast(CP1->getOperand(i)), @@ -1128,98 +1143,150 @@ } } - // Evaluate the relation between the two constants, per the predicate. - switch (evaluateICmpRelation(const_cast(C1), - const_cast(C2), - CmpInst::isSigned(predicate))) { - default: assert(0 && "Unknown relational!"); - case ICmpInst::BAD_ICMP_PREDICATE: - break; // Couldn't determine anything about these constants. - case ICmpInst::ICMP_EQ: // We know the constants are equal! - // If we know the constants are equal, we can decide the result of this - // computation precisely. - return ConstantBool::get(predicate == ICmpInst::ICMP_EQ || - predicate == ICmpInst::ICMP_ULE || - predicate == ICmpInst::ICMP_SLE || - predicate == ICmpInst::ICMP_UGE || - predicate == ICmpInst::ICMP_SGE); - case ICmpInst::ICMP_ULT: - // If we know that C1 < C2, we can decide the result of this computation - // precisely. - return ConstantBool::get(predicate == ICmpInst::ICMP_ULT || - predicate == ICmpInst::ICMP_NE || - predicate == ICmpInst::ICMP_ULE); - case ICmpInst::ICMP_SLT: - // If we know that C1 < C2, we can decide the result of this computation - // precisely. - return ConstantBool::get(predicate == ICmpInst::ICMP_SLT || - predicate == ICmpInst::ICMP_NE || - predicate == ICmpInst::ICMP_SLE); - case ICmpInst::ICMP_UGT: - // If we know that C1 > C2, we can decide the result of this computation - // precisely. - return ConstantBool::get(predicate == ICmpInst::ICMP_UGT || - predicate == ICmpInst::ICMP_NE || - predicate == ICmpInst::ICMP_UGE); - case ICmpInst::ICMP_SGT: - // If we know that C1 > C2, we can decide the result of this computation - // precisely. - return ConstantBool::get(predicate == ICmpInst::ICMP_SGT || - predicate == ICmpInst::ICMP_NE || - predicate == ICmpInst::ICMP_SGE); - case ICmpInst::ICMP_ULE: - // If we know that C1 <= C2, we can only partially decide this relation. - if (predicate == ICmpInst::ICMP_UGT) return ConstantBool::getFalse(); - if (predicate == ICmpInst::ICMP_ULT) return ConstantBool::getTrue(); - break; - case ICmpInst::ICMP_SLE: - // If we know that C1 <= C2, we can only partially decide this relation. - if (predicate == ICmpInst::ICMP_SGT) return ConstantBool::getFalse(); - if (predicate == ICmpInst::ICMP_SLT) return ConstantBool::getTrue(); - break; - - case ICmpInst::ICMP_UGE: - // If we know that C1 >= C2, we can only partially decide this relation. - if (predicate == ICmpInst::ICMP_ULT) return ConstantBool::getFalse(); - if (predicate == ICmpInst::ICMP_UGT) return ConstantBool::getTrue(); - break; - case ICmpInst::ICMP_SGE: - // If we know that C1 >= C2, we can only partially decide this relation. - if (predicate == ICmpInst::ICMP_SLT) return ConstantBool::getFalse(); - if (predicate == ICmpInst::ICMP_SGT) return ConstantBool::getTrue(); - break; - - case ICmpInst::ICMP_NE: - // If we know that C1 != C2, we can only partially decide this relation. - if (predicate == ICmpInst::ICMP_EQ) return ConstantBool::getFalse(); - if (predicate == ICmpInst::ICMP_NE) return ConstantBool::getTrue(); - break; - } - - if (!isa(C1) && isa(C2)) { - // If C2 is a constant expr and C1 isn't, flop them around and fold the - // other way if possible. - switch (predicate) { - case ICmpInst::ICMP_EQ: - case ICmpInst::ICMP_NE: - // No change of predicate required. - return ConstantFoldCompareInstruction(predicate, C2, C1); - + if (C1->getType()->isFloatingPoint()) { + switch (evaluateFCmpRelation(C1, C2)) { + default: assert(0 && "Unknown relation!"); + case FCmpInst::FCMP_UNO: + case FCmpInst::FCMP_ORD: + case FCmpInst::FCMP_UEQ: + case FCmpInst::FCMP_UNE: + case FCmpInst::FCMP_ULT: + case FCmpInst::FCMP_UGT: + case FCmpInst::FCMP_ULE: + case FCmpInst::FCMP_UGE: + case FCmpInst::FCMP_TRUE: + case FCmpInst::FCMP_FALSE: + case FCmpInst::BAD_FCMP_PREDICATE: + break; // Couldn't determine anything about these constants. + case FCmpInst::FCMP_OEQ: // We know that C1 == C2 + return ConstantBool::get( + pred == FCmpInst::FCMP_UEQ || pred == FCmpInst::FCMP_OEQ || + pred == FCmpInst::FCMP_ULE || pred == FCmpInst::FCMP_OLE || + pred == FCmpInst::FCMP_UGE || pred == FCmpInst::FCMP_OGE); + case FCmpInst::FCMP_OLT: // We know that C1 < C2 + return ConstantBool::get( + pred == FCmpInst::FCMP_UNE || pred == FCmpInst::FCMP_ONE || + pred == FCmpInst::FCMP_ULT || pred == FCmpInst::FCMP_OLT || + pred == FCmpInst::FCMP_ULE || pred == FCmpInst::FCMP_OLE); + case FCmpInst::FCMP_OGT: // We know that C1 > C2 + return ConstantBool::get( + pred == FCmpInst::FCMP_UNE || pred == FCmpInst::FCMP_ONE || + pred == FCmpInst::FCMP_UGT || pred == FCmpInst::FCMP_OGT || + pred == FCmpInst::FCMP_UGE || pred == FCmpInst::FCMP_OGE); + case FCmpInst::FCMP_OLE: // We know that C1 <= C2 + // We can only partially decide this relation. + if (pred == FCmpInst::FCMP_UGT || pred == FCmpInst::FCMP_OGT) + return ConstantBool::getFalse(); + if (pred == FCmpInst::FCMP_ULT || pred == FCmpInst::FCMP_OLT) + return ConstantBool::getTrue(); + break; + case FCmpInst::FCMP_OGE: // We known that C1 >= C2 + // We can only partially decide this relation. + if (pred == FCmpInst::FCMP_ULT || pred == FCmpInst::FCMP_OLT) + return ConstantBool::getFalse(); + if (pred == FCmpInst::FCMP_UGT || pred == FCmpInst::FCMP_OGT) + return ConstantBool::getTrue(); + break; + case ICmpInst::ICMP_NE: // We know that C1 != C2 + // We can only partially decide this relation. + if (pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ) + return ConstantBool::getFalse(); + if (pred == FCmpInst::FCMP_ONE || pred == FCmpInst::FCMP_UNE) + return ConstantBool::getTrue(); + break; + } + } else { + // Evaluate the relation between the two constants, per the predicate. + switch (evaluateICmpRelation(C1, C2, CmpInst::isSigned(pred))) { + default: assert(0 && "Unknown relational!"); + case ICmpInst::BAD_ICMP_PREDICATE: + break; // Couldn't determine anything about these constants. + case ICmpInst::ICMP_EQ: // We know the constants are equal! + // If we know the constants are equal, we can decide the result of this + // computation precisely. + return ConstantBool::get(pred == ICmpInst::ICMP_EQ || + pred == ICmpInst::ICMP_ULE || + pred == ICmpInst::ICMP_SLE || + pred == ICmpInst::ICMP_UGE || + pred == ICmpInst::ICMP_SGE); case ICmpInst::ICMP_ULT: + // If we know that C1 < C2, we can decide the result of this computation + // precisely. + return ConstantBool::get(pred == ICmpInst::ICMP_ULT || + pred == ICmpInst::ICMP_NE || + pred == ICmpInst::ICMP_ULE); case ICmpInst::ICMP_SLT: + // If we know that C1 < C2, we can decide the result of this computation + // precisely. + return ConstantBool::get(pred == ICmpInst::ICMP_SLT || + pred == ICmpInst::ICMP_NE || + pred == ICmpInst::ICMP_SLE); case ICmpInst::ICMP_UGT: + // If we know that C1 > C2, we can decide the result of this computation + // precisely. + return ConstantBool::get(pred == ICmpInst::ICMP_UGT || + pred == ICmpInst::ICMP_NE || + pred == ICmpInst::ICMP_UGE); case ICmpInst::ICMP_SGT: + // If we know that C1 > C2, we can decide the result of this computation + // precisely. + return ConstantBool::get(pred == ICmpInst::ICMP_SGT || + pred == ICmpInst::ICMP_NE || + pred == ICmpInst::ICMP_SGE); case ICmpInst::ICMP_ULE: + // If we know that C1 <= C2, we can only partially decide this relation. + if (pred == ICmpInst::ICMP_UGT) return ConstantBool::getFalse(); + if (pred == ICmpInst::ICMP_ULT) return ConstantBool::getTrue(); + break; case ICmpInst::ICMP_SLE: + // If we know that C1 <= C2, we can only partially decide this relation. + if (pred == ICmpInst::ICMP_SGT) return ConstantBool::getFalse(); + if (pred == ICmpInst::ICMP_SLT) return ConstantBool::getTrue(); + break; + case ICmpInst::ICMP_UGE: + // If we know that C1 >= C2, we can only partially decide this relation. + if (pred == ICmpInst::ICMP_ULT) return ConstantBool::getFalse(); + if (pred == ICmpInst::ICMP_UGT) return ConstantBool::getTrue(); + break; case ICmpInst::ICMP_SGE: - // Change the predicate as necessary to swap the operands. - predicate = ICmpInst::getSwappedPredicate((ICmpInst::Predicate)predicate); - return ConstantFoldCompareInstruction(predicate, C2, C1); + // If we know that C1 >= C2, we can only partially decide this relation. + if (pred == ICmpInst::ICMP_SLT) return ConstantBool::getFalse(); + if (pred == ICmpInst::ICMP_SGT) return ConstantBool::getTrue(); + break; - default: // These predicates cannot be flopped around. + case ICmpInst::ICMP_NE: + // If we know that C1 != C2, we can only partially decide this relation. + if (pred == ICmpInst::ICMP_EQ) return ConstantBool::getFalse(); + if (pred == ICmpInst::ICMP_NE) return ConstantBool::getTrue(); break; } + + if (!isa(C1) && isa(C2)) { + // If C2 is a constant expr and C1 isn't, flop them around and fold the + // other way if possible. + switch (pred) { + case ICmpInst::ICMP_EQ: + case ICmpInst::ICMP_NE: + // No change of predicate required. + return ConstantFoldCompareInstruction(pred, C2, C1); + + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + // Change the predicate as necessary to swap the operands. + pred = ICmpInst::getSwappedPredicate((ICmpInst::Predicate)pred); + return ConstantFoldCompareInstruction(pred, C2, C1); + + default: // These predicates cannot be flopped around. + break; + } + } } return 0; } Index: llvm/lib/VMCore/ConstantFolding.h diff -u llvm/lib/VMCore/ConstantFolding.h:1.51 llvm/lib/VMCore/ConstantFolding.h:1.52 --- llvm/lib/VMCore/ConstantFolding.h:1.51 Sat Dec 23 00:05:41 2006 +++ llvm/lib/VMCore/ConstantFolding.h Sun Dec 24 12:52:08 2006 @@ -46,7 +46,8 @@ Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1, const Constant *V2); Constant *ConstantFoldCompareInstruction(unsigned short predicate, - Constant *C1, Constant *C2); + const Constant *C1, + const Constant *C2); Constant *ConstantFoldGetElementPtr(const Constant *C, const std::vector &IdxList); } // End llvm namespace