summaryrefslogtreecommitdiffstats
path: root/polly/lib/Support/SCEVValidator.cpp
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-11-17 12:56:17 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-11-17 12:56:17 +0000
commitb1f07c5c0bb711c985bb053d94af9bbefacc6fab (patch)
tree9e041f415b5047da2049a582bfe94d0bcde3e637 /polly/lib/Support/SCEVValidator.cpp
parentbcc0a0d56059a366c0c0d964fd760ee4bc83809e (diff)
downloadbcm5719-llvm-b1f07c5c0bb711c985bb053d94af9bbefacc6fab.tar.gz
bcm5719-llvm-b1f07c5c0bb711c985bb053d94af9bbefacc6fab.zip
SCEVValidator: Document SCEVType and ValidatorResult
Suggested by Sebastian Pop. llvm-svn: 144905
Diffstat (limited to 'polly/lib/Support/SCEVValidator.cpp')
-rw-r--r--polly/lib/Support/SCEVValidator.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp
index d77e130481e..648c51c361d 100644
--- a/polly/lib/Support/SCEVValidator.cpp
+++ b/polly/lib/Support/SCEVValidator.cpp
@@ -10,43 +10,77 @@
using namespace llvm;
namespace SCEVType {
- enum TYPE {INT, PARAM, IV, INVALID};
+ /// @brief The type of a SCEV
+ ///
+ /// To check for the validity of a SCEV we assign to each SCEV a type. The
+ /// possible types are INT, PARAM, IV and INVALID. The order of the types is
+ /// important. The subexpressions of SCEV with a type X can only have a type
+ /// that is smaller or equal than X.
+ enum TYPE {
+ // An integer value.
+ INT,
+
+ // An expression that is constant during the execution of the Scop,
+ // but that may depend on parameters unknown at compile time.
+ PARAM,
+
+ // An expression that may change during the execution of the SCoP.
+ IV,
+
+ // An invalid expression.
+ INVALID
+ };
}
+/// @brief The result the validator returns for a SCEV expression.
struct ValidatorResult {
+ /// @brief The type of the expression
SCEVType::TYPE type;
+
+ /// @brief The set of Parameters in the expression.
std::vector<const SCEV*> Parameters;
+ /// @brief Create an invalid result.
ValidatorResult() : type(SCEVType::INVALID) {};
+ /// @brief The copy constructor
ValidatorResult(const ValidatorResult &vres) {
type = vres.type;
Parameters = vres.Parameters;
};
+ /// @brief Construct a result with a certain type and no parameters.
ValidatorResult(SCEVType::TYPE type) : type(type) {};
+
+ /// @brief Construct a result with a certain type and a single parameter.
ValidatorResult(SCEVType::TYPE type, const SCEV *Expr) : type(type) {
Parameters.push_back(Expr);
};
+ /// @brief Is the analyzed SCEV constant during the execution of the SCoP.
bool isConstant() {
return type == SCEVType::INT || type == SCEVType::PARAM;
}
+ /// @brief Is the analyzed SCEV valid.
bool isValid() {
return type != SCEVType::INVALID;
}
+ /// @brief Is the analyzed SCEV of type IV.
bool isIV() {
return type == SCEVType::IV;
}
+ /// @brief Is the analyzed SCEV of type INT.
bool isINT() {
return type == SCEVType::INT;
}
+ /// @brief Add the parameters of Source to this result.
void addParamsFrom(struct ValidatorResult &Source) {
- Parameters.insert(Parameters.end(), Source.Parameters.begin(),
+ Parameters.insert(Parameters.end(),
+ Source.Parameters.begin(),
Source.Parameters.end());
}
};
OpenPOWER on IntegriCloud