- Value *expandInTy(SCEV *S, const Type *Ty) {
- Value *V = expand(S);
- if (Ty && V->getType() != Ty) {
- if (isa<PointerType>(Ty) && V->getType()->isInteger())
- return InsertCastOfTo(Instruction::IntToPtr, V, Ty);
- else if (Ty->isInteger() && isa<PointerType>(V->getType()))
- return InsertCastOfTo(Instruction::PtrToInt, V, Ty);
- else if (Ty->getPrimitiveSizeInBits() ==
- V->getType()->getPrimitiveSizeInBits())
- return InsertCastOfTo(Instruction::BitCast, V, Ty);
- else if (Ty->getPrimitiveSizeInBits() >
- V->getType()->getPrimitiveSizeInBits())
- return InsertCastOfTo(Instruction::ZExt, V, Ty);
- else
- return InsertCastOfTo(Instruction::Trunc, V, Ty);
- }
- return V;
- }
+ private:
+ /// expandAddToGEP - Expand a SCEVAddExpr with a pointer type into a GEP
+ /// instead of using ptrtoint+arithmetic+inttoptr.
+ Value *expandAddToGEP(const SCEV* const *op_begin,
+ const SCEV* const *op_end,
+ const PointerType *PTy, const Type *Ty, Value *V);
+
+ Value *expand(const SCEV *S);