mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
SCEV: Cast switched values to make -Wswitch more useful.
llvm-svn: 201170
This commit is contained in:
parent
ef254433f4
commit
a4e8714113
@ -135,7 +135,7 @@ void SCEV::dump() const {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SCEV::print(raw_ostream &OS) const {
|
void SCEV::print(raw_ostream &OS) const {
|
||||||
switch (getSCEVType()) {
|
switch (static_cast<SCEVTypes>(getSCEVType())) {
|
||||||
case scConstant:
|
case scConstant:
|
||||||
cast<SCEVConstant>(this)->getValue()->printAsOperand(OS, false);
|
cast<SCEVConstant>(this)->getValue()->printAsOperand(OS, false);
|
||||||
return;
|
return;
|
||||||
@ -240,13 +240,12 @@ void SCEV::print(raw_ostream &OS) const {
|
|||||||
case scCouldNotCompute:
|
case scCouldNotCompute:
|
||||||
OS << "***COULDNOTCOMPUTE***";
|
OS << "***COULDNOTCOMPUTE***";
|
||||||
return;
|
return;
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
llvm_unreachable("Unknown SCEV kind!");
|
llvm_unreachable("Unknown SCEV kind!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Type *SCEV::getType() const {
|
Type *SCEV::getType() const {
|
||||||
switch (getSCEVType()) {
|
switch (static_cast<SCEVTypes>(getSCEVType())) {
|
||||||
case scConstant:
|
case scConstant:
|
||||||
return cast<SCEVConstant>(this)->getType();
|
return cast<SCEVConstant>(this)->getType();
|
||||||
case scTruncate:
|
case scTruncate:
|
||||||
@ -266,9 +265,8 @@ Type *SCEV::getType() const {
|
|||||||
return cast<SCEVUnknown>(this)->getType();
|
return cast<SCEVUnknown>(this)->getType();
|
||||||
case scCouldNotCompute:
|
case scCouldNotCompute:
|
||||||
llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!");
|
llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!");
|
||||||
default:
|
|
||||||
llvm_unreachable("Unknown SCEV kind!");
|
|
||||||
}
|
}
|
||||||
|
llvm_unreachable("Unknown SCEV kind!");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SCEV::isZero() const {
|
bool SCEV::isZero() const {
|
||||||
@ -481,7 +479,7 @@ namespace {
|
|||||||
// Aside from the getSCEVType() ordering, the particular ordering
|
// Aside from the getSCEVType() ordering, the particular ordering
|
||||||
// isn't very important except that it's beneficial to be consistent,
|
// isn't very important except that it's beneficial to be consistent,
|
||||||
// so that (a + b) and (b + a) don't end up as different expressions.
|
// so that (a + b) and (b + a) don't end up as different expressions.
|
||||||
switch (LType) {
|
switch (static_cast<SCEVTypes>(LType)) {
|
||||||
case scUnknown: {
|
case scUnknown: {
|
||||||
const SCEVUnknown *LU = cast<SCEVUnknown>(LHS);
|
const SCEVUnknown *LU = cast<SCEVUnknown>(LHS);
|
||||||
const SCEVUnknown *RU = cast<SCEVUnknown>(RHS);
|
const SCEVUnknown *RU = cast<SCEVUnknown>(RHS);
|
||||||
@ -618,9 +616,10 @@ namespace {
|
|||||||
return compare(LC->getOperand(), RC->getOperand());
|
return compare(LC->getOperand(), RC->getOperand());
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
case scCouldNotCompute:
|
||||||
llvm_unreachable("Unknown SCEV kind!");
|
llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!");
|
||||||
}
|
}
|
||||||
|
llvm_unreachable("Unknown SCEV kind!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2784,7 +2783,7 @@ namespace {
|
|||||||
bool FindOne;
|
bool FindOne;
|
||||||
FindInvalidSCEVUnknown() { FindOne = false; }
|
FindInvalidSCEVUnknown() { FindOne = false; }
|
||||||
bool follow(const SCEV *S) {
|
bool follow(const SCEV *S) {
|
||||||
switch (S->getSCEVType()) {
|
switch (static_cast<SCEVTypes>(S->getSCEVType())) {
|
||||||
case scConstant:
|
case scConstant:
|
||||||
return false;
|
return false;
|
||||||
case scUnknown:
|
case scUnknown:
|
||||||
@ -5209,8 +5208,7 @@ const SCEV *ScalarEvolution::getSCEVAtScope(const SCEV *V, const Loop *L) {
|
|||||||
/// SCEVConstant, because SCEVConstant is restricted to ConstantInt.
|
/// SCEVConstant, because SCEVConstant is restricted to ConstantInt.
|
||||||
/// Returns NULL if the SCEV isn't representable as a Constant.
|
/// Returns NULL if the SCEV isn't representable as a Constant.
|
||||||
static Constant *BuildConstantFromSCEV(const SCEV *V) {
|
static Constant *BuildConstantFromSCEV(const SCEV *V) {
|
||||||
switch (V->getSCEVType()) {
|
switch (static_cast<SCEVTypes>(V->getSCEVType())) {
|
||||||
default: // TODO: smax, umax.
|
|
||||||
case scCouldNotCompute:
|
case scCouldNotCompute:
|
||||||
case scAddRecExpr:
|
case scAddRecExpr:
|
||||||
break;
|
break;
|
||||||
@ -5297,6 +5295,9 @@ static Constant *BuildConstantFromSCEV(const SCEV *V) {
|
|||||||
return ConstantExpr::getUDiv(LHS, RHS);
|
return ConstantExpr::getUDiv(LHS, RHS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case scSMaxExpr:
|
||||||
|
case scUMaxExpr:
|
||||||
|
break; // TODO: smax, umax.
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -7534,7 +7535,7 @@ ScalarEvolution::getLoopDisposition(const SCEV *S, const Loop *L) {
|
|||||||
|
|
||||||
ScalarEvolution::LoopDisposition
|
ScalarEvolution::LoopDisposition
|
||||||
ScalarEvolution::computeLoopDisposition(const SCEV *S, const Loop *L) {
|
ScalarEvolution::computeLoopDisposition(const SCEV *S, const Loop *L) {
|
||||||
switch (S->getSCEVType()) {
|
switch (static_cast<SCEVTypes>(S->getSCEVType())) {
|
||||||
case scConstant:
|
case scConstant:
|
||||||
return LoopInvariant;
|
return LoopInvariant;
|
||||||
case scTruncate:
|
case scTruncate:
|
||||||
@ -7607,8 +7608,8 @@ ScalarEvolution::computeLoopDisposition(const SCEV *S, const Loop *L) {
|
|||||||
return LoopInvariant;
|
return LoopInvariant;
|
||||||
case scCouldNotCompute:
|
case scCouldNotCompute:
|
||||||
llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!");
|
llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!");
|
||||||
default: llvm_unreachable("Unknown SCEV kind!");
|
|
||||||
}
|
}
|
||||||
|
llvm_unreachable("Unknown SCEV kind!");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScalarEvolution::isLoopInvariant(const SCEV *S, const Loop *L) {
|
bool ScalarEvolution::isLoopInvariant(const SCEV *S, const Loop *L) {
|
||||||
@ -7640,7 +7641,7 @@ ScalarEvolution::getBlockDisposition(const SCEV *S, const BasicBlock *BB) {
|
|||||||
|
|
||||||
ScalarEvolution::BlockDisposition
|
ScalarEvolution::BlockDisposition
|
||||||
ScalarEvolution::computeBlockDisposition(const SCEV *S, const BasicBlock *BB) {
|
ScalarEvolution::computeBlockDisposition(const SCEV *S, const BasicBlock *BB) {
|
||||||
switch (S->getSCEVType()) {
|
switch (static_cast<SCEVTypes>(S->getSCEVType())) {
|
||||||
case scConstant:
|
case scConstant:
|
||||||
return ProperlyDominatesBlock;
|
return ProperlyDominatesBlock;
|
||||||
case scTruncate:
|
case scTruncate:
|
||||||
@ -7697,9 +7698,8 @@ ScalarEvolution::computeBlockDisposition(const SCEV *S, const BasicBlock *BB) {
|
|||||||
return ProperlyDominatesBlock;
|
return ProperlyDominatesBlock;
|
||||||
case scCouldNotCompute:
|
case scCouldNotCompute:
|
||||||
llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!");
|
llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!");
|
||||||
default:
|
|
||||||
llvm_unreachable("Unknown SCEV kind!");
|
|
||||||
}
|
}
|
||||||
|
llvm_unreachable("Unknown SCEV kind!");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScalarEvolution::dominates(const SCEV *S, const BasicBlock *BB) {
|
bool ScalarEvolution::dominates(const SCEV *S, const BasicBlock *BB) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user