aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/Fibonacci/fibonacci.cpp2
-rw-r--r--examples/ParallelJIT/ParallelJIT.cpp2
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h6
-rw-r--r--include/llvm/Constants.h13
-rw-r--r--include/llvm/InstrTypes.h14
-rw-r--r--include/llvm/Instruction.def86
-rw-r--r--include/llvm/Instruction.h16
-rw-r--r--include/llvm/Instructions.h99
-rw-r--r--include/llvm/Pass.h2
-rw-r--r--include/llvm/Support/ConstantRange.h26
-rw-r--r--include/llvm/Support/InstVisitor.h1
-rw-r--r--include/llvm/Support/PatternMatch.h46
-rw-r--r--include/llvm/Transforms/Utils/Local.h14
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp3
-rw-r--r--lib/Analysis/ConstantRange.cpp197
-rw-r--r--lib/Analysis/IPA/Andersens.cpp5
-rw-r--r--lib/Analysis/IPA/GlobalsModRef.cpp4
-rw-r--r--lib/Analysis/LoopInfo.cpp18
-rw-r--r--lib/Analysis/ScalarEvolution.cpp198
-rw-r--r--lib/Analysis/ValueNumbering.cpp5
-rw-r--r--lib/AsmParser/Lexer.cpp.cvs1268
-rw-r--r--lib/AsmParser/Lexer.l6
-rw-r--r--lib/AsmParser/Lexer.l.cvs6
-rw-r--r--lib/AsmParser/llvmAsmParser.cpp.cvs4045
-rw-r--r--lib/AsmParser/llvmAsmParser.h.cvs223
-rw-r--r--lib/AsmParser/llvmAsmParser.y24
-rw-r--r--lib/AsmParser/llvmAsmParser.y.cvs48
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp4
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp193
-rw-r--r--lib/ExecutionEngine/Interpreter/Execution.cpp441
-rw-r--r--lib/ExecutionEngine/Interpreter/Interpreter.h2
-rw-r--r--lib/Support/ConstantRange.cpp197
-rw-r--r--lib/Target/CBackend/CBackend.cpp401
-rw-r--r--lib/Target/CBackend/Makefile2
-rw-r--r--lib/Target/CBackend/Writer.cpp401
-rw-r--r--lib/Target/README.txt2
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp28
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp64
-rw-r--r--lib/Transforms/IPO/SimplifyLibCalls.cpp40
-rw-r--r--lib/Transforms/Instrumentation/RSProfiling.cpp19
-rw-r--r--lib/Transforms/LevelRaise.cpp3
-rw-r--r--lib/Transforms/Scalar/CorrelatedExprs.cpp376
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp10
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp1704
-rw-r--r--lib/Transforms/Scalar/LICM.cpp2
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp17
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp7
-rw-r--r--lib/Transforms/Scalar/LowerPacked.cpp43
-rw-r--r--lib/Transforms/Scalar/PredicateSimplifier.cpp344
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp9
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp88
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp4
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp12
-rw-r--r--lib/Transforms/Utils/Local.cpp30
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp12
-rw-r--r--lib/Transforms/Utils/LowerSwitch.cpp7
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp49
-rw-r--r--lib/VMCore/ConstantFold.cpp1377
-rw-r--r--lib/VMCore/ConstantFold.h4
-rw-r--r--lib/VMCore/ConstantFolding.h4
-rw-r--r--lib/VMCore/Constants.cpp65
-rw-r--r--lib/VMCore/Instruction.cpp54
-rw-r--r--lib/VMCore/Instructions.cpp137
-rw-r--r--lib/VMCore/SymbolTable.cpp2
-rw-r--r--lib/VMCore/Verifier.cpp4
-rw-r--r--projects/Stacker/lib/compiler/StackerCompiler.cpp50
-rw-r--r--test/CFrontend/2006-12-14-ordered_expr.c3
-rw-r--r--test/Transforms/IndVarsSimplify/tripcount_infinite.llx4
-rw-r--r--test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll2
-rw-r--r--test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll165
-rw-r--r--test/Transforms/InstCombine/2006-12-15-Range-Test.ll32
-rw-r--r--test/Transforms/InstCombine/JavaCompare.ll2
-rw-r--r--test/Transforms/InstCombine/cast.ll11
-rw-r--r--test/Transforms/InstCombine/set.ll2
-rw-r--r--test/Transforms/InstCombine/setcc-strength-reduce.ll2
-rw-r--r--test/Transforms/LoopSimplify/2006-08-11-LoopSimplifyLongTime.ll.bcbin165219 -> 165491 bytes
-rw-r--r--test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll2
-rw-r--r--test/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll144
-rw-r--r--test/Transforms/SimplifyCFG/DeadSetCC.ll2
-rw-r--r--tools/bugpoint/Miscompilation.cpp4
-rw-r--r--tools/llvm-upgrade/UpgradeParser.cpp406
-rw-r--r--tools/llvm-upgrade/UpgradeParser.cpp.cvs406
-rw-r--r--tools/llvm-upgrade/UpgradeParser.h2
-rw-r--r--tools/llvm-upgrade/UpgradeParser.h.cvs2
-rw-r--r--tools/llvm-upgrade/UpgradeParser.y18
-rw-r--r--tools/llvm-upgrade/UpgradeParser.y.cvs18
-rw-r--r--tools/llvm2cpp/CppWriter.cpp137
87 files changed, 7711 insertions, 6238 deletions
diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp
index 6f775515fb..96aeb6340a 100644
--- a/examples/Fibonacci/fibonacci.cpp
+++ b/examples/Fibonacci/fibonacci.cpp
@@ -58,7 +58,7 @@ static Function *CreateFibFunction(Module *M) {
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
diff --git a/examples/ParallelJIT/ParallelJIT.cpp b/examples/ParallelJIT/ParallelJIT.cpp
index dfda126378..7f2e1bfc10 100644
--- a/examples/ParallelJIT/ParallelJIT.cpp
+++ b/examples/ParallelJIT/ParallelJIT.cpp
@@ -83,7 +83,7 @@ static Function *CreateFibFunction(Module *M)
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
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index c261dfc8e5..b9bf93b8c7 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -426,8 +426,10 @@ namespace llvm {
/// 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;
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 2a0c62423d..a6050f44a6 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -496,8 +496,8 @@ protected:
// 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 @@ public:
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 @@ public:
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);
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index b3ec55921f..152f4773eb 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -543,6 +543,20 @@ public:
/// @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) {
diff --git a/include/llvm/Instruction.def b/include/llvm/Instruction.def
index db41734fa4..c33c4483be 100644
--- a/include/llvm/Instruction.def
+++ b/include/llvm/Instruction.def
@@ -118,61 +118,53 @@ HANDLE_BINARY_INST(15, FRem , BinaryOperator)
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
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h
index ce75969902..a0376c785e 100644
--- a/include/llvm/Instruction.h
+++ b/include/llvm/Instruction.h
@@ -71,6 +71,16 @@ public:
/// 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<Instruction>(*use_begin());}
@@ -155,12 +165,6 @@ public:
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 {
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 5f7125678d..c786623526 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -440,7 +440,8 @@ public:
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 @@ public:
/// 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 getSignedPred