LLVM: include/llvm/Analysis/ScalarEvolutionExpressions.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_ANALYSIS_SCALAREVOLUTIONEXPRESSIONS_H
14#define LLVM_ANALYSIS_SCALAREVOLUTIONEXPRESSIONS_H
15
25#include
26#include
27
28namespace llvm {
29
37
59
60
61class SCEVConstant : public SCEV {
63
65
68
69public:
72
74
75
77};
78
79
80
81class SCEVVScale : public SCEV {
83
86
88
89public:
91
92
94};
95
98 for (const auto *Arg : Args)
99 Size = Size.uadd_sat(APInt(16, Arg->getExpressionSize()));
100 return (unsigned short)Size.getZExtValue();
101}
102
103
105protected:
108
111
112public:
115 assert(i == 0 && "Operand index out of range!");
116 return Op;
117 }
121
122
127};
128
129
130
133
135
136public:
137
139};
140
141
143protected:
146
147public:
148
153};
154
155
156
159
161
162public:
163
165};
166
167
168
171
173
174public:
175
179};
180
181
182
185
187
188public:
189
193};
194
195
196
198protected:
199
200
201
202
205
207 const SCEV *const *O, size_t N)
210
211public:
213
218
222
226
230
234
236
237
245};
246
247
249protected:
251 const SCEV *const *O, size_t N)
253
254public:
255
261
262
264};
265
266
269
271
275 return Op->getType()->isPointerTy();
276 });
277 if (FirstPointerTypedOp != operands().end())
278 Ty = (*FirstPointerTypedOp)->getType();
279 else
281 }
282
283public:
285
286
288};
289
290
293
296
297public:
299
300
302};
303
304
305class SCEVUDivExpr : public SCEV {
307
308 std::array<const SCEV *, 2> Operands;
309
312 Operands[0] = lhs;
313 Operands[1] = rhs;
314 }
315
316public:
317 const SCEV *getLHS() const { return Operands[0]; }
318 const SCEV *getRHS() const { return Operands[1]; }
321 assert((i == 0 || i == 1) && "Operand index out of range!");
323 }
324
326
328
329
330
331
332
334 }
335
336
338};
339
340
341
342
343
344
345
346
347
350
351 const Loop *L;
352
354 const Loop *l)
356
357public:
361
362
363
364
365
373
374
375
381
382
383
384
386
387
388
389
395
396
397
400
401
402
406
407
408
409
410
411
412
415
416
417
419
420
424};
425
426
429
430 static bool isMinMaxType(enum SCEVTypes T) {
433 }
434
435protected:
436
438 const SCEV *const *O, size_t N)
441
443 }
444
445public:
447
449
451 switch (T) {
460 default:
462 }
463 }
464};
465
466
469
472
473public:
474
476};
477
478
481
484
485public:
486
488};
489
490
493
496
497public:
498
500};
501
502
505
508
509public:
510
512};
513
514
515
516
517
518
519
522
523 static bool isSequentialMinMaxType(enum SCEVTypes T) {
525 }
526
527
529
530protected:
531
533 const SCEV *const *O, size_t N)
535 assert(isSequentialMinMaxType(T));
536
538 }
539
540public:
542
544 assert(isSequentialMinMaxType(Ty));
545 switch (Ty) {
548 default:
550 }
551 }
552
556
558 return isSequentialMinMaxType(S->getSCEVType());
559 }
560};
561
562
565
567 size_t N)
569
570public:
571
575};
576
577
578
579
582
583
584
585
587
588
589
590 SCEVUnknown *Next;
591
593 SCEVUnknown *next)
595
596
597 void deleted() override;
598 void allUsesReplacedWith(Value *New) override;
599
600public:
602
604
605
607};
608
609
610
611template <typename SC, typename RetVal = void> struct SCEVVisitor {
615 return ((SC *)this)->visitConstant((const SCEVConstant *)S);
617 return ((SC *)this)->visitVScale((const SCEVVScale *)S);
619 return ((SC *)this)->visitPtrToIntExpr((const SCEVPtrToIntExpr *)S);
621 return ((SC *)this)->visitTruncateExpr((const SCEVTruncateExpr *)S);
623 return ((SC *)this)->visitZeroExtendExpr((const SCEVZeroExtendExpr *)S);
625 return ((SC *)this)->visitSignExtendExpr((const SCEVSignExtendExpr *)S);
627 return ((SC *)this)->visitAddExpr((const SCEVAddExpr *)S);
629 return ((SC *)this)->visitMulExpr((const SCEVMulExpr *)S);
631 return ((SC *)this)->visitUDivExpr((const SCEVUDivExpr *)S);
633 return ((SC *)this)->visitAddRecExpr((const SCEVAddRecExpr *)S);
635 return ((SC *)this)->visitSMaxExpr((const SCEVSMaxExpr *)S);
637 return ((SC *)this)->visitUMaxExpr((const SCEVUMaxExpr *)S);
639 return ((SC *)this)->visitSMinExpr((const SCEVSMinExpr *)S);
641 return ((SC *)this)->visitUMinExpr((const SCEVUMinExpr *)S);
643 return ((SC *)this)
646 return ((SC *)this)->visitUnknown((const SCEVUnknown *)S);
648 return ((SC *)this)->visitCouldNotCompute((const SCEVCouldNotCompute *)S);
649 }
651 }
652
656};
657
658
659
660
661
662
663
664
666 SV &Visitor;
669
670 void push(const SCEV *S) {
671 if (Visited.insert(S).second && Visitor.follow(S))
672 Worklist.push_back(S);
673 }
674
675public:
677
679 push(Root);
680 while (!Worklist.empty() && !Visitor.isDone()) {
681 const SCEV *S = Worklist.pop_back_val();
682
687 continue;
701 for (const auto *Op : S->operands()) {
702 push(Op);
703 if (Visitor.isDone())
704 break;
705 }
706 continue;
708 llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!");
709 }
711 }
712 }
713};
714
715
716template void visitAll(const SCEV *Root, SV &Visitor) {
718 T.visitAll(Root);
719}
720
721
722template
724 struct FindClosure {
725 bool Found = false;
726 PredTy Pred;
727
728 FindClosure(PredTy Pred) : Pred(Pred) {}
729
730 bool follow(const SCEV *S) {
731 if (!Pred(S))
732 return true;
733
734 Found = true;
735 return false;
736 }
737
738 bool isDone() const { return Found; }
739 };
740
741 FindClosure FC(Pred);
743 return FC.Found;
744}
745
746
747
748
749template
751protected:
753
754
755
756
757
759
760public:
762
766 return It->second;
768 auto Result = RewriteResults.try_emplace(S, Visited);
769 assert(Result.second && "Should insert a new entry");
770 return Result.first->second;
771 }
772
774
776
778 const SCEV *Operand = ((SC *)this)->visit(Expr->getOperand());
780 ? Expr
781 : SE.getPtrToIntExpr(Operand, Expr->getType());
782 }
783
785 const SCEV *Operand = ((SC *)this)->visit(Expr->getOperand());
787 ? Expr
788 : SE.getTruncateExpr(Operand, Expr->getType());
789 }
790
792 const SCEV *Operand = ((SC *)this)->visit(Expr->getOperand());
794 ? Expr
795 : SE.getZeroExtendExpr(Operand, Expr->getType());
796 }
797
799 const SCEV *Operand = ((SC *)this)->visit(Expr->getOperand());
801 ? Expr
802 : SE.getSignExtendExpr(Operand, Expr->getType());
803 }
804
808 for (const auto *Op : Expr->operands()) {
811 }
812 return ? Expr : SE.getAddExpr(Operands);
813 }
814
818 for (const auto *Op : Expr->operands()) {
821 }
822 return ? Expr : SE.getMulExpr(Operands);
823 }
824
826 auto *LHS = ((SC *)this)->visit(Expr->getLHS());
827 auto *RHS = ((SC *)this)->visit(Expr->getRHS());
830 }
831
835 for (const auto *Op : Expr->operands()) {
838 }
840 : SE.getAddRecExpr(Operands, Expr->getLoop(),
842 }
843
847 for (const auto *Op : Expr->operands()) {
850 }
851 return ? Expr : SE.getSMaxExpr(Operands);
852 }
853
857 for (const auto *Op : Expr->operands()) {
860 }
861 return ? Expr : SE.getUMaxExpr(Operands);
862 }
863
867 for (const auto *Op : Expr->operands()) {
870 }
871 return ? Expr : SE.getSMinExpr(Operands);
872 }
873
877 for (const auto *Op : Expr->operands()) {
880 }
881 return ? Expr : SE.getUMinExpr(Operands);
882 }
883
887 for (const auto *Op : Expr->operands()) {
890 }
891 return ? Expr : SE.getUMinExpr(Operands, true);
892 }
893
895
899};
900
903
904
905
907public:
911 return Rewriter.visit(Scev);
912 }
913
916
918 auto I = Map.find(Expr->getValue());
919 if (I == Map.end())
920 return Expr;
921 return I->second;
922 }
923
924private:
926};
927
929
930
931
934public:
937
941 return Rewriter.visit(Scev);
942 }
943
948
950 auto It = Map.find(L);
951 if (It == Map.end())
952 return SE.getAddRecExpr(Operands, L, Expr->getNoWrapFlags());
953
955 }
956
957private:
959};
960
961}
962
963#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file defines the DenseMap class.
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
Virtual Register Rewriter
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
CallbackVH(const CallbackVH &)=default
This is the shared class of boolean and integer constants.
const APInt & getValue() const
Return the constant as an APInt value reference.
This class represents a range of values.
This is an important base class in LLVM.
FoldingSetNodeIDRef - This class describes a reference to an interned FoldingSetNodeID,...
Represents a single loop in the control flow graph.
This node represents an addition of some number of SCEVs.
Definition ScalarEvolutionExpressions.h:267
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:268
Type * getType() const
Definition ScalarEvolutionExpressions.h:284
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:287
This node represents a polynomial recurrence on the trip count of the specified loop.
Definition ScalarEvolutionExpressions.h:348
Type * getType() const
Definition ScalarEvolutionExpressions.h:358
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:349
const SCEV * getStart() const
Definition ScalarEvolutionExpressions.h:359
LLVM_ABI const SCEV * evaluateAtIteration(const SCEV *It, ScalarEvolution &SE) const
Return the value of this chain of recurrences at the specified iteration number.
const SCEV * getStepRecurrence(ScalarEvolution &SE) const
Constructs and returns the recurrence indicating how much this expression steps by.
Definition ScalarEvolutionExpressions.h:366
void setNoWrapFlags(NoWrapFlags Flags)
Set flags for a recurrence without clearing any previously set flags.
Definition ScalarEvolutionExpressions.h:390
bool isAffine() const
Return true if this represents an expression A + B*x where A and B are loop invariant values.
Definition ScalarEvolutionExpressions.h:376
bool isQuadratic() const
Return true if this represents an expression A + B*x + C*x^2 where A, B and C are loop invariant valu...
Definition ScalarEvolutionExpressions.h:385
LLVM_ABI const SCEV * getNumIterationsInRange(const ConstantRange &Range, ScalarEvolution &SE) const
Return the number of iterations of this loop that produce values in the specified constant range.
LLVM_ABI const SCEVAddRecExpr * getPostIncExpr(ScalarEvolution &SE) const
Return an expression representing the value of this expression one iteration of the loop ahead.
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:421
const Loop * getLoop() const
Definition ScalarEvolutionExpressions.h:360
Type * Ty
Definition ScalarEvolutionExpressions.h:107
const SCEV * getOperand(unsigned i) const
Definition ScalarEvolutionExpressions.h:114
const SCEV * Op
Definition ScalarEvolutionExpressions.h:106
ArrayRef< const SCEV * > operands() const
Definition ScalarEvolutionExpressions.h:118
size_t getNumOperands() const
Definition ScalarEvolutionExpressions.h:119
const SCEV * getOperand() const
Definition ScalarEvolutionExpressions.h:113
LLVM_ABI SCEVCastExpr(const FoldingSetNodeIDRef ID, SCEVTypes SCEVTy, const SCEV *op, Type *ty)
Type * getType() const
Definition ScalarEvolutionExpressions.h:120
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:123
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:256
void setNoWrapFlags(NoWrapFlags Flags)
Set flags for a non-recurrence without clearing previously set flags.
Definition ScalarEvolutionExpressions.h:263
SCEVCommutativeExpr(const FoldingSetNodeIDRef ID, enum SCEVTypes T, const SCEV *const *O, size_t N)
Definition ScalarEvolutionExpressions.h:250
This class represents a constant integer value.
Definition ScalarEvolutionExpressions.h:61
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:62
Type * getType() const
Definition ScalarEvolutionExpressions.h:73
ConstantInt * getValue() const
Definition ScalarEvolutionExpressions.h:70
const APInt & getAPInt() const
Definition ScalarEvolutionExpressions.h:71
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:76
LLVM_ABI SCEVIntegralCastExpr(const FoldingSetNodeIDRef ID, SCEVTypes SCEVTy, const SCEV *op, Type *ty)
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:149
static const SCEV * rewrite(const SCEV *Scev, LoopToScevMapT &Map, ScalarEvolution &SE)
Definition ScalarEvolutionExpressions.h:938
const SCEV * visitAddRecExpr(const SCEVAddRecExpr *Expr)
Definition ScalarEvolutionExpressions.h:944
SCEVLoopAddRecRewriter(ScalarEvolution &SE, LoopToScevMapT &M)
Definition ScalarEvolutionExpressions.h:935
Type * getType() const
Definition ScalarEvolutionExpressions.h:446
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:428
static enum SCEVTypes negate(enum SCEVTypes T)
Definition ScalarEvolutionExpressions.h:450
SCEVMinMaxExpr(const FoldingSetNodeIDRef ID, enum SCEVTypes T, const SCEV *const *O, size_t N)
Note: Constructing subclasses via this constructor is allowed.
Definition ScalarEvolutionExpressions.h:437
static bool classof(const SCEV *S)
Definition ScalarEvolutionExpressions.h:448
This node represents multiplication of some number of SCEVs.
Definition ScalarEvolutionExpressions.h:291
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:292
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:301
Type * getType() const
Definition ScalarEvolutionExpressions.h:298
bool hasNoUnsignedWrap() const
Definition ScalarEvolutionExpressions.h:227
size_t NumOperands
Definition ScalarEvolutionExpressions.h:204
bool hasNoSelfWrap() const
Definition ScalarEvolutionExpressions.h:235
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:238
size_t getNumOperands() const
Definition ScalarEvolutionExpressions.h:212
bool hasNoSignedWrap() const
Definition ScalarEvolutionExpressions.h:231
NoWrapFlags getNoWrapFlags(NoWrapFlags Mask=NoWrapMask) const
Definition ScalarEvolutionExpressions.h:223
SCEVNAryExpr(const FoldingSetNodeIDRef ID, enum SCEVTypes T, const SCEV *const *O, size_t N)
Definition ScalarEvolutionExpressions.h:206
const SCEV * getOperand(unsigned i) const
Definition ScalarEvolutionExpressions.h:214
const SCEV *const * Operands
Definition ScalarEvolutionExpressions.h:203
ArrayRef< const SCEV * > operands() const
Definition ScalarEvolutionExpressions.h:219
const SCEV * visitUnknown(const SCEVUnknown *Expr)
Definition ScalarEvolutionExpressions.h:917
static const SCEV * rewrite(const SCEV *Scev, ScalarEvolution &SE, ValueToSCEVMapTy &Map)
Definition ScalarEvolutionExpressions.h:908
SCEVParameterRewriter(ScalarEvolution &SE, ValueToSCEVMapTy &M)
Definition ScalarEvolutionExpressions.h:914
This class represents a cast from a pointer to a pointer-sized integer value.
Definition ScalarEvolutionExpressions.h:131
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:132
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:138
const SCEV * visitSignExtendExpr(const SCEVSignExtendExpr *Expr)
Definition ScalarEvolutionExpressions.h:798
const SCEV * visitPtrToIntExpr(const SCEVPtrToIntExpr *Expr)
Definition ScalarEvolutionExpressions.h:777
ScalarEvolution & SE
Definition ScalarEvolutionExpressions.h:752
const SCEV * visit(const SCEV *S)
Definition ScalarEvolutionExpressions.h:763
const SCEV * visitZeroExtendExpr(const SCEVZeroExtendExpr *Expr)
Definition ScalarEvolutionExpressions.h:791
const SCEV * visitUnknown(const SCEVUnknown *Expr)
Definition ScalarEvolutionExpressions.h:894
const SCEV * visitSMinExpr(const SCEVSMinExpr *Expr)
Definition ScalarEvolutionExpressions.h:864
SCEVRewriteVisitor(ScalarEvolution &SE)
Definition ScalarEvolutionExpressions.h:761
const SCEV * visitSequentialUMinExpr(const SCEVSequentialUMinExpr *Expr)
Definition ScalarEvolutionExpressions.h:884
const SCEV * visitAddExpr(const SCEVAddExpr *Expr)
Definition ScalarEvolutionExpressions.h:805
const SCEV * visitUMinExpr(const SCEVUMinExpr *Expr)
Definition ScalarEvolutionExpressions.h:874
const SCEV * visitMulExpr(const SCEVMulExpr *Expr)
Definition ScalarEvolutionExpressions.h:815
SmallDenseMap< const SCEV *, const SCEV * > RewriteResults
Definition ScalarEvolutionExpressions.h:758
const SCEV * visitTruncateExpr(const SCEVTruncateExpr *Expr)
Definition ScalarEvolutionExpressions.h:784
const SCEV * visitUMaxExpr(const SCEVUMaxExpr *Expr)
Definition ScalarEvolutionExpressions.h:854
const SCEV * visitSMaxExpr(const SCEVSMaxExpr *Expr)
Definition ScalarEvolutionExpressions.h:844
const SCEV * visitUDivExpr(const SCEVUDivExpr *Expr)
Definition ScalarEvolutionExpressions.h:825
const SCEV * visitCouldNotCompute(const SCEVCouldNotCompute *Expr)
Definition ScalarEvolutionExpressions.h:896
const SCEV * visitVScale(const SCEVVScale *VScale)
Definition ScalarEvolutionExpressions.h:775
const SCEV * visitAddRecExpr(const SCEVAddRecExpr *Expr)
Definition ScalarEvolutionExpressions.h:832
const SCEV * visitConstant(const SCEVConstant *Constant)
Definition ScalarEvolutionExpressions.h:773
This class represents a signed maximum selection.
Definition ScalarEvolutionExpressions.h:467
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:475
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:468
This class represents a signed minimum selection.
Definition ScalarEvolutionExpressions.h:491
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:492
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:499
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:521
SCEVSequentialMinMaxExpr(const FoldingSetNodeIDRef ID, enum SCEVTypes T, const SCEV *const *O, size_t N)
Note: Constructing subclasses via this constructor is allowed.
Definition ScalarEvolutionExpressions.h:532
static bool classof(const SCEV *S)
Definition ScalarEvolutionExpressions.h:557
static SCEVTypes getEquivalentNonSequentialSCEVType(SCEVTypes Ty)
Definition ScalarEvolutionExpressions.h:543
Type * getType() const
Definition ScalarEvolutionExpressions.h:541
SCEVTypes getEquivalentNonSequentialSCEVType() const
Definition ScalarEvolutionExpressions.h:553
This class represents a sequential/in-order unsigned minimum selection.
Definition ScalarEvolutionExpressions.h:563
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:564
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:572
This class represents a sign extension of a small integer value to a larger integer value.
Definition ScalarEvolutionExpressions.h:183
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:184
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:190
Visit all nodes in the expression tree using worklist traversal.
Definition ScalarEvolutionExpressions.h:665
void visitAll(const SCEV *Root)
Definition ScalarEvolutionExpressions.h:678
SCEVTraversal(SV &V)
Definition ScalarEvolutionExpressions.h:676
This class represents a truncation of an integer value to a smaller integer value.
Definition ScalarEvolutionExpressions.h:157
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:164
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:158
This class represents a binary unsigned division operation.
Definition ScalarEvolutionExpressions.h:305
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:337
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:306
ArrayRef< const SCEV * > operands() const
Definition ScalarEvolutionExpressions.h:325
const SCEV * getOperand(unsigned i) const
Definition ScalarEvolutionExpressions.h:320
const SCEV * getLHS() const
Definition ScalarEvolutionExpressions.h:317
Type * getType() const
Definition ScalarEvolutionExpressions.h:327
size_t getNumOperands() const
Definition ScalarEvolutionExpressions.h:319
const SCEV * getRHS() const
Definition ScalarEvolutionExpressions.h:318
This class represents an unsigned maximum selection.
Definition ScalarEvolutionExpressions.h:479
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:480
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:487
This class represents an unsigned minimum selection.
Definition ScalarEvolutionExpressions.h:503
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:504
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:511
This means that we are dealing with an entirely unknown SCEV value, and only represent it as its LLVM...
Definition ScalarEvolutionExpressions.h:580
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:581
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:606
Type * getType() const
Definition ScalarEvolutionExpressions.h:603
Value * getValue() const
Definition ScalarEvolutionExpressions.h:601
This class represents the value of vscale, as used when defining the length of a scalable vector or r...
Definition ScalarEvolutionExpressions.h:81
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:82
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:93
Type * getType() const
Definition ScalarEvolutionExpressions.h:90
This class represents a zero extension of a small integer value to a larger integer value.
Definition ScalarEvolutionExpressions.h:169
static bool classof(const SCEV *S)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition ScalarEvolutionExpressions.h:176
friend class ScalarEvolution
Definition ScalarEvolutionExpressions.h:170
This class represents an analyzed expression in the program.
LLVM_ABI ArrayRef< const SCEV * > operands() const
Return operands of this SCEV expression.
SCEV(const FoldingSetNodeIDRef ID, SCEVTypes SCEVTy, unsigned short ExpressionSize)
SCEVTypes getSCEVType() const
unsigned short SubclassData
This field is initialized to zero and may be used in subclasses to store miscellaneous information.
LLVM_ABI Type * getType() const
Return the LLVM type of this SCEV expression.
NoWrapFlags
NoWrapFlags are bitfield indices into SubclassData.
The main scalar evolution driver.
LLVM_ABI const SCEV * getAddRecExpr(const SCEV *Start, const SCEV *Step, const Loop *L, SCEV::NoWrapFlags Flags)
Get an add recurrence expression for the specified loop.
static SCEV::NoWrapFlags setFlags(SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags OnFlags)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
Value * getValPtr() const
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
void visitAll(const SCEV *Root, SV &Visitor)
Use SCEVTraversal to visit all nodes in the given expression tree.
Definition ScalarEvolutionExpressions.h:716
DenseMap< const Value *, const SCEV * > ValueToSCEVMapTy
Definition ScalarEvolutionExpressions.h:902
DenseMap< const Loop *, const SCEV * > LoopToScevMapT
Definition ScalarEvolutionExpressions.h:928
unsigned short computeExpressionSize(ArrayRef< const SCEV * > Args)
Definition ScalarEvolutionExpressions.h:96
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
SCEVTypes
Definition ScalarEvolutionExpressions.h:38
@ scUMinExpr
Definition ScalarEvolutionExpressions.h:52
@ scAddRecExpr
Definition ScalarEvolutionExpressions.h:49
@ scSequentialUMinExpr
Definition ScalarEvolutionExpressions.h:54
@ scAddExpr
Definition ScalarEvolutionExpressions.h:46
@ scVScale
Definition ScalarEvolutionExpressions.h:42
@ scSMaxExpr
Definition ScalarEvolutionExpressions.h:51
@ scUnknown
Definition ScalarEvolutionExpressions.h:56
@ scSMinExpr
Definition ScalarEvolutionExpressions.h:53
@ scCouldNotCompute
Definition ScalarEvolutionExpressions.h:57
@ scConstant
Definition ScalarEvolutionExpressions.h:41
@ scSignExtend
Definition ScalarEvolutionExpressions.h:45
@ scTruncate
Definition ScalarEvolutionExpressions.h:43
@ scUMaxExpr
Definition ScalarEvolutionExpressions.h:50
@ scZeroExtend
Definition ScalarEvolutionExpressions.h:44
@ scPtrToInt
Definition ScalarEvolutionExpressions.h:55
@ scUDivExpr
Definition ScalarEvolutionExpressions.h:48
@ scMulExpr
Definition ScalarEvolutionExpressions.h:47
DenseMap< const Value *, Value * > ValueToValueMap
Definition ScalarEvolutionExpressions.h:901
bool SCEVExprContains(const SCEV *Root, PredTy Pred)
Return true if any node in Root satisfies the predicate Pred.
Definition ScalarEvolutionExpressions.h:723
An object of this class is returned by queries that could not be answered.
This class defines a simple visitor class that may be used for various SCEV analysis purposes.
Definition ScalarEvolutionExpressions.h:611
RetVal visit(const SCEV *S)
Definition ScalarEvolutionExpressions.h:612
RetVal visitCouldNotCompute(const SCEVCouldNotCompute *S)
Definition ScalarEvolutionExpressions.h:653