ScalarEvolutionExpressions.h revision ef0bedaba7c1466af4275e720a73f3421b9b5631
1//===- llvm/Analysis/ScalarEvolutionExpressions.h - SCEV Exprs --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines the classes used to represent and build scalar expressions. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef LLVM_ANALYSIS_SCALAREVOLUTION_EXPRESSIONS_H 15#define LLVM_ANALYSIS_SCALAREVOLUTION_EXPRESSIONS_H 16 17#include "llvm/Analysis/ScalarEvolution.h" 18#include "llvm/Support/ErrorHandling.h" 19 20namespace llvm { 21 class ConstantInt; 22 class ConstantRange; 23 class DominatorTree; 24 25 enum SCEVTypes { 26 // These should be ordered in terms of increasing complexity to make the 27 // folders simpler. 28 scConstant, scTruncate, scZeroExtend, scSignExtend, scAddExpr, scMulExpr, 29 scUDivExpr, scAddRecExpr, scUMaxExpr, scSMaxExpr, 30 scUnknown, scCouldNotCompute 31 }; 32 33 //===--------------------------------------------------------------------===// 34 /// SCEVConstant - This class represents a constant integer value. 35 /// 36 class SCEVConstant : public SCEV { 37 friend class ScalarEvolution; 38 39 ConstantInt *V; 40 SCEVConstant(const FoldingSetNodeIDRef ID, ConstantInt *v) : 41 SCEV(ID, scConstant), V(v) {} 42 public: 43 ConstantInt *getValue() const { return V; } 44 45 virtual bool isLoopInvariant(const Loop *L) const { 46 return true; 47 } 48 49 virtual bool hasComputableLoopEvolution(const Loop *L) const { 50 return false; // Not loop variant 51 } 52 53 virtual const Type *getType() const; 54 55 virtual bool hasOperand(const SCEV *) const { 56 return false; 57 } 58 59 bool dominates(BasicBlock *BB, DominatorTree *DT) const { 60 return true; 61 } 62 63 bool properlyDominates(BasicBlock *BB, DominatorTree *DT) const { 64 return true; 65 } 66 67 virtual void print(raw_ostream &OS) const; 68 69 /// Methods for support type inquiry through isa, cast, and dyn_cast: 70 static inline bool classof(const SCEVConstant *S) { return true; } 71 static inline bool classof(const SCEV *S) { 72 return S->getSCEVType() == scConstant; 73 } 74 }; 75 76 //===--------------------------------------------------------------------===// 77 /// SCEVCastExpr - This is the base class for unary cast operator classes. 78 /// 79 class SCEVCastExpr : public SCEV { 80 protected: 81 const SCEV *Op; 82 const Type *Ty; 83 84 SCEVCastExpr(const FoldingSetNodeIDRef ID, 85 unsigned SCEVTy, const SCEV *op, const Type *ty); 86 87 public: 88 const SCEV *getOperand() const { return Op; } 89 virtual const Type *getType() const { return Ty; } 90 91 virtual bool isLoopInvariant(const Loop *L) const { 92 return Op->isLoopInvariant(L); 93 } 94 95 virtual bool hasComputableLoopEvolution(const Loop *L) const { 96 return Op->hasComputableLoopEvolution(L); 97 } 98 99 virtual bool hasOperand(const SCEV *O) const { 100 return Op == O || Op->hasOperand(O); 101 } 102 103 virtual bool dominates(BasicBlock *BB, DominatorTree *DT) const; 104 105 virtual bool properlyDominates(BasicBlock *BB, DominatorTree *DT) const; 106 107 /// Methods for support type inquiry through isa, cast, and dyn_cast: 108 static inline bool classof(const SCEVCastExpr *S) { return true; } 109 static inline bool classof(const SCEV *S) { 110 return S->getSCEVType() == scTruncate || 111 S->getSCEVType() == scZeroExtend || 112 S->getSCEVType() == scSignExtend; 113 } 114 }; 115 116 //===--------------------------------------------------------------------===// 117 /// SCEVTruncateExpr - This class represents a truncation of an integer value 118 /// to a smaller integer value. 119 /// 120 class SCEVTruncateExpr : public SCEVCastExpr { 121 friend class ScalarEvolution; 122 123 SCEVTruncateExpr(const FoldingSetNodeIDRef ID, 124 const SCEV *op, const Type *ty); 125 126 public: 127 virtual void print(raw_ostream &OS) const; 128 129 virtual bool hasComputableLoopEvolution(const Loop *QL) const { 130 // Not computable. A truncate of an addrec is always folded into 131 // the addrec. 132 return false; 133 } 134 135 /// Methods for support type inquiry through isa, cast, and dyn_cast: 136 static inline bool classof(const SCEVTruncateExpr *S) { return true; } 137 static inline bool classof(const SCEV *S) { 138 return S->getSCEVType() == scTruncate; 139 } 140 }; 141 142 //===--------------------------------------------------------------------===// 143 /// SCEVZeroExtendExpr - This class represents a zero extension of a small 144 /// integer value to a larger integer value. 145 /// 146 class SCEVZeroExtendExpr : public SCEVCastExpr { 147 friend class ScalarEvolution; 148 149 SCEVZeroExtendExpr(const FoldingSetNodeIDRef ID, 150 const SCEV *op, const Type *ty); 151 152 public: 153 virtual void print(raw_ostream &OS) const; 154 155 /// Methods for support type inquiry through isa, cast, and dyn_cast: 156 static inline bool classof(const SCEVZeroExtendExpr *S) { return true; } 157 static inline bool classof(const SCEV *S) { 158 return S->getSCEVType() == scZeroExtend; 159 } 160 }; 161 162 //===--------------------------------------------------------------------===// 163 /// SCEVSignExtendExpr - This class represents a sign extension of a small 164 /// integer value to a larger integer value. 165 /// 166 class SCEVSignExtendExpr : public SCEVCastExpr { 167 friend class ScalarEvolution; 168 169 SCEVSignExtendExpr(const FoldingSetNodeIDRef ID, 170 const SCEV *op, const Type *ty); 171 172 public: 173 virtual void print(raw_ostream &OS) const; 174 175 /// Methods for support type inquiry through isa, cast, and dyn_cast: 176 static inline bool classof(const SCEVSignExtendExpr *S) { return true; } 177 static inline bool classof(const SCEV *S) { 178 return S->getSCEVType() == scSignExtend; 179 } 180 }; 181 182 183 //===--------------------------------------------------------------------===// 184 /// SCEVNAryExpr - This node is a base class providing common 185 /// functionality for n'ary operators. 186 /// 187 class SCEVNAryExpr : public SCEV { 188 protected: 189 // Since SCEVs are immutable, ScalarEvolution allocates operand 190 // arrays with its SCEVAllocator, so this class just needs a simple 191 // pointer rather than a more elaborate vector-like data structure. 192 // This also avoids the need for a non-trivial destructor. 193 const SCEV *const *Operands; 194 size_t NumOperands; 195 196 SCEVNAryExpr(const FoldingSetNodeIDRef ID, 197 enum SCEVTypes T, const SCEV *const *O, size_t N) 198 : SCEV(ID, T), Operands(O), NumOperands(N) {} 199 200 public: 201 size_t getNumOperands() const { return NumOperands; } 202 const SCEV *getOperand(unsigned i) const { 203 assert(i < NumOperands && "Operand index out of range!"); 204 return Operands[i]; 205 } 206 207 typedef const SCEV *const *op_iterator; 208 op_iterator op_begin() const { return Operands; } 209 op_iterator op_end() const { return Operands + NumOperands; } 210 211 virtual bool isLoopInvariant(const Loop *L) const { 212 for (unsigned i = 0, e = getNumOperands(); i != e; ++i) 213 if (!getOperand(i)->isLoopInvariant(L)) return false; 214 return true; 215 } 216 217 // hasComputableLoopEvolution - N-ary expressions have computable loop 218 // evolutions iff they have at least one operand that varies with the loop, 219 // but that all varying operands are computable. 220 virtual bool hasComputableLoopEvolution(const Loop *L) const { 221 bool HasVarying = false; 222 for (unsigned i = 0, e = getNumOperands(); i != e; ++i) 223 if (!getOperand(i)->isLoopInvariant(L)) { 224 if (getOperand(i)->hasComputableLoopEvolution(L)) 225 HasVarying = true; 226 else 227 return false; 228 } 229 return HasVarying; 230 } 231 232 virtual bool hasOperand(const SCEV *O) const { 233 for (unsigned i = 0, e = getNumOperands(); i != e; ++i) 234 if (O == getOperand(i) || getOperand(i)->hasOperand(O)) 235 return true; 236 return false; 237 } 238 239 bool dominates(BasicBlock *BB, DominatorTree *DT) const; 240 241 bool properlyDominates(BasicBlock *BB, DominatorTree *DT) const; 242 243 virtual const Type *getType() const { return getOperand(0)->getType(); } 244 245 bool hasNoUnsignedWrap() const { return SubclassData & (1 << 0); } 246 void setHasNoUnsignedWrap(bool B) { 247 SubclassData = (SubclassData & ~(1 << 0)) | (B << 0); 248 } 249 bool hasNoSignedWrap() const { return SubclassData & (1 << 1); } 250 void setHasNoSignedWrap(bool B) { 251 SubclassData = (SubclassData & ~(1 << 1)) | (B << 1); 252 } 253 254 /// Methods for support type inquiry through isa, cast, and dyn_cast: 255 static inline bool classof(const SCEVNAryExpr *S) { return true; } 256 static inline bool classof(const SCEV *S) { 257 return S->getSCEVType() == scAddExpr || 258 S->getSCEVType() == scMulExpr || 259 S->getSCEVType() == scSMaxExpr || 260 S->getSCEVType() == scUMaxExpr || 261 S->getSCEVType() == scAddRecExpr; 262 } 263 }; 264 265 //===--------------------------------------------------------------------===// 266 /// SCEVCommutativeExpr - This node is the base class for n'ary commutative 267 /// operators. 268 /// 269 class SCEVCommutativeExpr : public SCEVNAryExpr { 270 protected: 271 SCEVCommutativeExpr(const FoldingSetNodeIDRef ID, 272 enum SCEVTypes T, const SCEV *const *O, size_t N) 273 : SCEVNAryExpr(ID, T, O, N) {} 274 275 public: 276 virtual const char *getOperationStr() const = 0; 277 278 virtual void print(raw_ostream &OS) const; 279 280 /// Methods for support type inquiry through isa, cast, and dyn_cast: 281 static inline bool classof(const SCEVCommutativeExpr *S) { return true; } 282 static inline bool classof(const SCEV *S) { 283 return S->getSCEVType() == scAddExpr || 284 S->getSCEVType() == scMulExpr || 285 S->getSCEVType() == scSMaxExpr || 286 S->getSCEVType() == scUMaxExpr; 287 } 288 }; 289 290 291 //===--------------------------------------------------------------------===// 292 /// SCEVAddExpr - This node represents an addition of some number of SCEVs. 293 /// 294 class SCEVAddExpr : public SCEVCommutativeExpr { 295 friend class ScalarEvolution; 296 297 SCEVAddExpr(const FoldingSetNodeIDRef ID, 298 const SCEV *const *O, size_t N) 299 : SCEVCommutativeExpr(ID, scAddExpr, O, N) { 300 } 301 302 public: 303 virtual bool hasComputableLoopEvolution(const Loop *QL) const { 304 // Not computable. An add of an addrec is always folded into the addrec 305 // if the other operands are loop-variant or loop-computable. 306 return false; 307 } 308 309 virtual const char *getOperationStr() const { return " + "; } 310 311 virtual const Type *getType() const { 312 // Use the type of the last operand, which is likely to be a pointer 313 // type, if there is one. This doesn't usually matter, but it can help 314 // reduce casts when the expressions are expanded. 315 return getOperand(getNumOperands() - 1)->getType(); 316 } 317 318 /// Methods for support type inquiry through isa, cast, and dyn_cast: 319 static inline bool classof(const SCEVAddExpr *S) { return true; } 320 static inline bool classof(const SCEV *S) { 321 return S->getSCEVType() == scAddExpr; 322 } 323 }; 324 325 //===--------------------------------------------------------------------===// 326 /// SCEVMulExpr - This node represents multiplication of some number of SCEVs. 327 /// 328 class SCEVMulExpr : public SCEVCommutativeExpr { 329 friend class ScalarEvolution; 330 331 SCEVMulExpr(const FoldingSetNodeIDRef ID, 332 const SCEV *const *O, size_t N) 333 : SCEVCommutativeExpr(ID, scMulExpr, O, N) { 334 } 335 336 public: 337 virtual bool hasComputableLoopEvolution(const Loop *QL) const { 338 // Not computable. A mul of an addrec is always folded into the addrec 339 // if the other operands are loop-variant or loop-computable. 340 return false; 341 } 342 343 virtual const char *getOperationStr() const { return " * "; } 344 345 /// Methods for support type inquiry through isa, cast, and dyn_cast: 346 static inline bool classof(const SCEVMulExpr *S) { return true; } 347 static inline bool classof(const SCEV *S) { 348 return S->getSCEVType() == scMulExpr; 349 } 350 }; 351 352 353 //===--------------------------------------------------------------------===// 354 /// SCEVUDivExpr - This class represents a binary unsigned division operation. 355 /// 356 class SCEVUDivExpr : public SCEV { 357 friend class ScalarEvolution; 358 359 const SCEV *LHS; 360 const SCEV *RHS; 361 SCEVUDivExpr(const FoldingSetNodeIDRef ID, const SCEV *lhs, const SCEV *rhs) 362 : SCEV(ID, scUDivExpr), LHS(lhs), RHS(rhs) {} 363 364 public: 365 const SCEV *getLHS() const { return LHS; } 366 const SCEV *getRHS() const { return RHS; } 367 368 virtual bool isLoopInvariant(const Loop *L) const { 369 return LHS->isLoopInvariant(L) && RHS->isLoopInvariant(L); 370 } 371 372 virtual bool hasComputableLoopEvolution(const Loop *L) const { 373 return LHS->hasComputableLoopEvolution(L) && 374 RHS->hasComputableLoopEvolution(L); 375 } 376 377 virtual bool hasOperand(const SCEV *O) const { 378 return O == LHS || O == RHS || LHS->hasOperand(O) || RHS->hasOperand(O); 379 } 380 381 bool dominates(BasicBlock *BB, DominatorTree *DT) const; 382 383 bool properlyDominates(BasicBlock *BB, DominatorTree *DT) const; 384 385 virtual const Type *getType() const; 386 387 void print(raw_ostream &OS) const; 388 389 /// Methods for support type inquiry through isa, cast, and dyn_cast: 390 static inline bool classof(const SCEVUDivExpr *S) { return true; } 391 static inline bool classof(const SCEV *S) { 392 return S->getSCEVType() == scUDivExpr; 393 } 394 }; 395 396 397 //===--------------------------------------------------------------------===// 398 /// SCEVAddRecExpr - This node represents a polynomial recurrence on the trip 399 /// count of the specified loop. This is the primary focus of the 400 /// ScalarEvolution framework; all the other SCEV subclasses are mostly just 401 /// supporting infrastructure to allow SCEVAddRecExpr expressions to be 402 /// created and analyzed. 403 /// 404 /// All operands of an AddRec are required to be loop invariant. 405 /// 406 class SCEVAddRecExpr : public SCEVNAryExpr { 407 friend class ScalarEvolution; 408 409 const Loop *L; 410 411 SCEVAddRecExpr(const FoldingSetNodeIDRef ID, 412 const SCEV *const *O, size_t N, const Loop *l) 413 : SCEVNAryExpr(ID, scAddRecExpr, O, N), L(l) { 414 for (size_t i = 0, e = NumOperands; i != e; ++i) 415 assert(Operands[i]->isLoopInvariant(l) && 416 "Operands of AddRec must be loop-invariant!"); 417 } 418 419 public: 420 const SCEV *getStart() const { return Operands[0]; } 421 const Loop *getLoop() const { return L; } 422 423 /// getStepRecurrence - This method constructs and returns the recurrence 424 /// indicating how much this expression steps by. If this is a polynomial 425 /// of degree N, it returns a chrec of degree N-1. 426 const SCEV *getStepRecurrence(ScalarEvolution &SE) const { 427 if (isAffine()) return getOperand(1); 428 return SE.getAddRecExpr(SmallVector<const SCEV *, 3>(op_begin()+1, 429 op_end()), 430 getLoop()); 431 } 432 433 virtual bool hasComputableLoopEvolution(const Loop *QL) const { 434 return L == QL; 435 } 436 437 virtual bool isLoopInvariant(const Loop *QueryLoop) const; 438 439 bool dominates(BasicBlock *BB, DominatorTree *DT) const; 440 441 bool properlyDominates(BasicBlock *BB, DominatorTree *DT) const; 442 443 /// isAffine - Return true if this is an affine AddRec (i.e., it represents 444 /// an expressions A+B*x where A and B are loop invariant values. 445 bool isAffine() const { 446 // We know that the start value is invariant. This expression is thus 447 // affine iff the step is also invariant. 448 return getNumOperands() == 2; 449 } 450 451 /// isQuadratic - Return true if this is an quadratic AddRec (i.e., it 452 /// represents an expressions A+B*x+C*x^2 where A, B and C are loop 453 /// invariant values. This corresponds to an addrec of the form {L,+,M,+,N} 454 bool isQuadratic() const { 455 return getNumOperands() == 3; 456 } 457 458 /// evaluateAtIteration - Return the value of this chain of recurrences at 459 /// the specified iteration number. 460 const SCEV *evaluateAtIteration(const SCEV *It, ScalarEvolution &SE) const; 461 462 /// getNumIterationsInRange - Return the number of iterations of this loop 463 /// that produce values in the specified constant range. Another way of 464 /// looking at this is that it returns the first iteration number where the 465 /// value is not in the condition, thus computing the exit count. If the 466 /// iteration count can't be computed, an instance of SCEVCouldNotCompute is 467 /// returned. 468 const SCEV *getNumIterationsInRange(ConstantRange Range, 469 ScalarEvolution &SE) const; 470 471 /// getPostIncExpr - Return an expression representing the value of 472 /// this expression one iteration of the loop ahead. 473 const SCEVAddRecExpr *getPostIncExpr(ScalarEvolution &SE) const { 474 return cast<SCEVAddRecExpr>(SE.getAddExpr(this, getStepRecurrence(SE))); 475 } 476 477 virtual void print(raw_ostream &OS) const; 478 479 /// Methods for support type inquiry through isa, cast, and dyn_cast: 480 static inline bool classof(const SCEVAddRecExpr *S) { return true; } 481 static inline bool classof(const SCEV *S) { 482 return S->getSCEVType() == scAddRecExpr; 483 } 484 }; 485 486 487 //===--------------------------------------------------------------------===// 488 /// SCEVSMaxExpr - This class represents a signed maximum selection. 489 /// 490 class SCEVSMaxExpr : public SCEVCommutativeExpr { 491 friend class ScalarEvolution; 492 493 SCEVSMaxExpr(const FoldingSetNodeIDRef ID, 494 const SCEV *const *O, size_t N) 495 : SCEVCommutativeExpr(ID, scSMaxExpr, O, N) { 496 // Max never overflows. 497 setHasNoUnsignedWrap(true); 498 setHasNoSignedWrap(true); 499 } 500 501 public: 502 virtual const char *getOperationStr() const { return " smax "; } 503 504 /// Methods for support type inquiry through isa, cast, and dyn_cast: 505 static inline bool classof(const SCEVSMaxExpr *S) { return true; } 506 static inline bool classof(const SCEV *S) { 507 return S->getSCEVType() == scSMaxExpr; 508 } 509 }; 510 511 512 //===--------------------------------------------------------------------===// 513 /// SCEVUMaxExpr - This class represents an unsigned maximum selection. 514 /// 515 class SCEVUMaxExpr : public SCEVCommutativeExpr { 516 friend class ScalarEvolution; 517 518 SCEVUMaxExpr(const FoldingSetNodeIDRef ID, 519 const SCEV *const *O, size_t N) 520 : SCEVCommutativeExpr(ID, scUMaxExpr, O, N) { 521 // Max never overflows. 522 setHasNoUnsignedWrap(true); 523 setHasNoSignedWrap(true); 524 } 525 526 public: 527 virtual const char *getOperationStr() const { return " umax "; } 528 529 /// Methods for support type inquiry through isa, cast, and dyn_cast: 530 static inline bool classof(const SCEVUMaxExpr *S) { return true; } 531 static inline bool classof(const SCEV *S) { 532 return S->getSCEVType() == scUMaxExpr; 533 } 534 }; 535 536 //===--------------------------------------------------------------------===// 537 /// SCEVUnknown - This means that we are dealing with an entirely unknown SCEV 538 /// value, and only represent it as its LLVM Value. This is the "bottom" 539 /// value for the analysis. 540 /// 541 class SCEVUnknown : public SCEV, private CallbackVH { 542 friend class ScalarEvolution; 543 544 // Implement CallbackVH. 545 virtual void deleted(); 546 virtual void allUsesReplacedWith(Value *New); 547 548 /// SE - The parent ScalarEvolution value. This is used to update 549 /// the parent's maps when the value associated with a SCEVUnknown 550 /// is deleted or RAUW'd. 551 ScalarEvolution *SE; 552 553 /// Next - The next pointer in the linked list of all 554 /// SCEVUnknown instances owned by a ScalarEvolution. 555 SCEVUnknown *Next; 556 557 SCEVUnknown(const FoldingSetNodeIDRef ID, Value *V, 558 ScalarEvolution *se, SCEVUnknown *next) : 559 SCEV(ID, scUnknown), CallbackVH(V), SE(se), Next(next) {} 560 561 public: 562 Value *getValue() const { return getValPtr(); } 563 564 /// isSizeOf, isAlignOf, isOffsetOf - Test whether this is a special 565 /// constant representing a type size, alignment, or field offset in 566 /// a target-independent manner, and hasn't happened to have been 567 /// folded with other operations into something unrecognizable. This 568 /// is mainly only useful for pretty-printing and other situations 569 /// where it isn't absolutely required for these to succeed. 570 bool isSizeOf(const Type *&AllocTy) const; 571 bool isAlignOf(const Type *&AllocTy) const; 572 bool isOffsetOf(const Type *&STy, Constant *&FieldNo) const; 573 574 virtual bool isLoopInvariant(const Loop *L) const; 575 virtual bool hasComputableLoopEvolution(const Loop *QL) const { 576 return false; // not computable 577 } 578 579 virtual bool hasOperand(const SCEV *) const { 580 return false; 581 } 582 583 bool dominates(BasicBlock *BB, DominatorTree *DT) const; 584 585 bool properlyDominates(BasicBlock *BB, DominatorTree *DT) const; 586 587 virtual const Type *getType() const; 588 589 virtual void print(raw_ostream &OS) const; 590 591 /// Methods for support type inquiry through isa, cast, and dyn_cast: 592 static inline bool classof(const SCEVUnknown *S) { return true; } 593 static inline bool classof(const SCEV *S) { 594 return S->getSCEVType() == scUnknown; 595 } 596 }; 597 598 /// SCEVVisitor - This class defines a simple visitor class that may be used 599 /// for various SCEV analysis purposes. 600 template<typename SC, typename RetVal=void> 601 struct SCEVVisitor { 602 RetVal visit(const SCEV *S) { 603 switch (S->getSCEVType()) { 604 case scConstant: 605 return ((SC*)this)->visitConstant((const SCEVConstant*)S); 606 case scTruncate: 607 return ((SC*)this)->visitTruncateExpr((const SCEVTruncateExpr*)S); 608 case scZeroExtend: 609 return ((SC*)this)->visitZeroExtendExpr((const SCEVZeroExtendExpr*)S); 610 case scSignExtend: 611 return ((SC*)this)->visitSignExtendExpr((const SCEVSignExtendExpr*)S); 612 case scAddExpr: 613 return ((SC*)this)->visitAddExpr((const SCEVAddExpr*)S); 614 case scMulExpr: 615 return ((SC*)this)->visitMulExpr((const SCEVMulExpr*)S); 616 case scUDivExpr: 617 return ((SC*)this)->visitUDivExpr((const SCEVUDivExpr*)S); 618 case scAddRecExpr: 619 return ((SC*)this)->visitAddRecExpr((const SCEVAddRecExpr*)S); 620 case scSMaxExpr: 621 return ((SC*)this)->visitSMaxExpr((const SCEVSMaxExpr*)S); 622 case scUMaxExpr: 623 return ((SC*)this)->visitUMaxExpr((const SCEVUMaxExpr*)S); 624 case scUnknown: 625 return ((SC*)this)->visitUnknown((const SCEVUnknown*)S); 626 case scCouldNotCompute: 627 return ((SC*)this)->visitCouldNotCompute((const SCEVCouldNotCompute*)S); 628 default: 629 llvm_unreachable("Unknown SCEV type!"); 630 } 631 } 632 633 RetVal visitCouldNotCompute(const SCEVCouldNotCompute *S) { 634 llvm_unreachable("Invalid use of SCEVCouldNotCompute!"); 635 return RetVal(); 636 } 637 }; 638} 639 640#endif 641