mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44319 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -235,6 +235,8 @@ namespace llvm {
|
||||
std::vector<SCEVHandle> NewOp(Operands);
|
||||
return getAddRecExpr(NewOp, L);
|
||||
}
|
||||
SCEVHandle getSMaxExpr(const SCEVHandle &LHS, const SCEVHandle &RHS);
|
||||
SCEVHandle getSMaxExpr(std::vector<SCEVHandle> Operands);
|
||||
SCEVHandle getUnknown(Value *V);
|
||||
|
||||
/// getNegativeSCEV - Return the SCEV object corresponding to -V.
|
||||
|
@@ -134,6 +134,8 @@ namespace llvm {
|
||||
|
||||
Value *visitAddRecExpr(SCEVAddRecExpr *S);
|
||||
|
||||
Value *visitSMaxExpr(SCEVSMaxExpr *S);
|
||||
|
||||
Value *visitUnknown(SCEVUnknown *S) {
|
||||
return S->getValue();
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ namespace llvm {
|
||||
// These should be ordered in terms of increasing complexity to make the
|
||||
// folders simpler.
|
||||
scConstant, scTruncate, scZeroExtend, scSignExtend, scAddExpr, scMulExpr,
|
||||
scSDivExpr, scAddRecExpr, scUnknown, scCouldNotCompute
|
||||
scSDivExpr, scAddRecExpr, scSMaxExpr, scUnknown, scCouldNotCompute
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
@@ -274,7 +274,8 @@ namespace llvm {
|
||||
static inline bool classof(const SCEVCommutativeExpr *S) { return true; }
|
||||
static inline bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scAddExpr ||
|
||||
S->getSCEVType() == scMulExpr;
|
||||
S->getSCEVType() == scMulExpr ||
|
||||
S->getSCEVType() == scSMaxExpr;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -459,6 +460,28 @@ namespace llvm {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// SCEVSMaxExpr - This class represents a signed maximum selection.
|
||||
///
|
||||
class SCEVSMaxExpr : public SCEVCommutativeExpr {
|
||||
friend class ScalarEvolution;
|
||||
|
||||
explicit SCEVSMaxExpr(const std::vector<SCEVHandle> &ops)
|
||||
: SCEVCommutativeExpr(scSMaxExpr, ops) {
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const char *getOperationStr() const { return " smax "; }
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEVSMaxExpr *S) { return true; }
|
||||
static inline bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scSMaxExpr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// SCEVUnknown - This means that we are dealing with an entirely unknown SCEV
|
||||
/// value, and only represent it as it's LLVM Value. This is the "bottom"
|
||||
@@ -521,6 +544,8 @@ namespace llvm {
|
||||
return ((SC*)this)->visitSDivExpr((SCEVSDivExpr*)S);
|
||||
case scAddRecExpr:
|
||||
return ((SC*)this)->visitAddRecExpr((SCEVAddRecExpr*)S);
|
||||
case scSMaxExpr:
|
||||
return ((SC*)this)->visitSMaxExpr((SCEVSMaxExpr*)S);
|
||||
case scUnknown:
|
||||
return ((SC*)this)->visitUnknown((SCEVUnknown*)S);
|
||||
case scCouldNotCompute:
|
||||
|
Reference in New Issue
Block a user