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 $