[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
Reid Spencer
reid at x10sys.com
Wed Dec 13 00:07:02 PST 2006
Changes in directory llvm/lib/Analysis:
ScalarEvolutionExpander.cpp updated: 1.9 -> 1.10
---
Log message:
Change the interface to SCEVExpander::InsertCastOfTo to take a cast opcode
so the decision of which opcode to use is pushed upward to the caller.
Adjust the callers to pass the expected opcode.
---
Diffs of the changes: (+2 -19)
ScalarEvolutionExpander.cpp | 21 ++-------------------
1 files changed, 2 insertions(+), 19 deletions(-)
Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.9 llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.10
--- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.9 Tue Dec 12 17:36:14 2006
+++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp Wed Dec 13 02:06:42 2006
@@ -19,25 +19,8 @@
/// InsertCastOfTo - Insert a cast of V to the specified type, doing what
/// we can to share the casts.
-Value *SCEVExpander::InsertCastOfTo(Value *V, const Type *Ty) {
- // Compute the Cast opcode to use
- Instruction::CastOps opcode = Instruction::BitCast;
- if (Ty->isIntegral()) {
- if (V->getType()->getTypeID() == Type::PointerTyID)
- opcode = Instruction::PtrToInt;
- else {
- unsigned SrcBits = V->getType()->getPrimitiveSizeInBits();
- unsigned DstBits = Ty->getPrimitiveSizeInBits();
- opcode = (SrcBits > DstBits ? Instruction::Trunc :
- (SrcBits == DstBits ? Instruction::BitCast :
- (V->getType()->isSigned() ? Instruction::SExt :
- Instruction::ZExt)));
- }
- } else if (Ty->isFloatingPoint())
- opcode = Instruction::UIToFP;
- else if (Ty->getTypeID() == Type::PointerTyID && V->getType()->isIntegral())
- opcode = Instruction::IntToPtr;
-
+Value *SCEVExpander::InsertCastOfTo(Instruction::CastOps opcode, Value *V,
+ const Type *Ty) {
// FIXME: keep track of the cast instruction.
if (Constant *C = dyn_cast<Constant>(V))
return ConstantExpr::getCast(opcode, C, Ty);
More information about the llvm-commits
mailing list