aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/ScalarEvolutionExpander.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Analysis/ScalarEvolutionExpander.h')
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpander.h48
1 files changed, 16 insertions, 32 deletions
diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h
index 730c97fff4d7..90dba8bcc04a 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpander.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpander.h
@@ -28,7 +28,8 @@ namespace llvm {
/// memory.
struct SCEVExpander : public SCEVVisitor<SCEVExpander, Value*> {
ScalarEvolution &SE;
- std::map<const SCEV*, AssertingVH<Value> > InsertedExpressions;
+ std::map<std::pair<const SCEV *, Instruction *>, AssertingVH<Value> >
+ InsertedExpressions;
std::set<Value*> InsertedValues;
BasicBlock::iterator InsertPt;
@@ -43,48 +44,18 @@ namespace llvm {
/// different places within the same BasicBlock can do so.
void clear() { InsertedExpressions.clear(); }
- /// isInsertedInstruction - Return true if the specified instruction was
- /// inserted by the code rewriter. If so, the client should not modify the
- /// instruction.
- bool isInsertedInstruction(Instruction *I) const {
- return InsertedValues.count(I);
- }
-
- /// isInsertedExpression - Return true if the the code rewriter has a
- /// Value* recorded for the given expression.
- bool isInsertedExpression(const SCEV *S) const {
- return InsertedExpressions.count(S);
- }
-
/// getOrInsertCanonicalInductionVariable - This method returns the
/// canonical induction variable of the specified type for the specified
/// loop (inserting one if there is none). A canonical induction variable
/// starts at zero and steps by one on each iteration.
Value *getOrInsertCanonicalInductionVariable(const Loop *L, const Type *Ty);
- /// addInsertedValue - Remember the specified instruction as being the
- /// canonical form for the specified SCEV.
- void addInsertedValue(Value *V, const SCEV *S) {
- InsertedExpressions[S] = V;
- InsertedValues.insert(V);
- }
-
- void setInsertionPoint(BasicBlock::iterator NewIP) { InsertPt = NewIP; }
-
- BasicBlock::iterator getInsertionPoint() const { return InsertPt; }
-
- /// expandCodeFor - Insert code to directly compute the specified SCEV
- /// expression into the program. The inserted code is inserted into the
- /// SCEVExpander's current insertion point. If a type is specified, the
- /// result will be expanded to have that type, with a cast if necessary.
- Value *expandCodeFor(const SCEV* SH, const Type *Ty = 0);
-
/// expandCodeFor - Insert code to directly compute the specified SCEV
/// expression into the program. The inserted code is inserted into the
/// specified block.
Value *expandCodeFor(const SCEV* SH, const Type *Ty,
BasicBlock::iterator IP) {
- setInsertionPoint(IP);
+ InsertPt = IP;
return expandCodeFor(SH, Ty);
}
@@ -111,6 +82,19 @@ namespace llvm {
Value *expand(const SCEV *S);
+ /// expandCodeFor - Insert code to directly compute the specified SCEV
+ /// expression into the program. The inserted code is inserted into the
+ /// SCEVExpander's current insertion point. If a type is specified, the
+ /// result will be expanded to have that type, with a cast if necessary.
+ Value *expandCodeFor(const SCEV* SH, const Type *Ty = 0);
+
+ /// isInsertedInstruction - Return true if the specified instruction was
+ /// inserted by the code rewriter. If so, the client should not modify the
+ /// instruction.
+ bool isInsertedInstruction(Instruction *I) const {
+ return InsertedValues.count(I);
+ }
+
Value *visitConstant(const SCEVConstant *S) {
return S->getValue();
}