mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-07 18:10:24 +00:00
[NFC] Make SCEVAffinator work without a statement
llvm-svn: 246290
This commit is contained in:
parent
4b682f6f24
commit
b409fdc0d7
@ -1181,11 +1181,11 @@ public:
|
||||
|
||||
/// @brief Compute the isl representation for the SCEV @p
|
||||
///
|
||||
///
|
||||
/// @param Stmt An (optional) statement for which the isl_pw_aff is
|
||||
/// computed. SCEVs known to not reference any loops in the
|
||||
/// scop can be passed without a statement.
|
||||
__isl_give isl_pw_aff *getPwAff(const SCEV *E, ScopStmt *Stmt = nullptr);
|
||||
/// @param Domain An (optional) domain in which the isl_pw_aff is computed.
|
||||
/// SCEVs known to not reference any loops in the SCoP can be
|
||||
/// passed without a @p Domain.
|
||||
__isl_give isl_pw_aff *getPwAff(const SCEV *E,
|
||||
__isl_keep isl_set *Domain = nullptr);
|
||||
|
||||
/// @brief Get a union set containing the iteration domains of all statements.
|
||||
__isl_give isl_union_set *getDomains() const;
|
||||
|
@ -49,17 +49,16 @@ public:
|
||||
|
||||
/// @brief Translate a SCEV to an isl_pw_aff.
|
||||
///
|
||||
/// @param E The expression that is translated.
|
||||
/// @param Stmt The SCoP statement surrounding @p E or nullptr, if no
|
||||
/// loop induction variables inside the scop are referenced.
|
||||
/// @param E The expression that is translated.
|
||||
/// @param Domain The domain in which @p E is executed.
|
||||
///
|
||||
/// @returns The isl representation of the SCEV @p E in @p Stmt.
|
||||
/// @returns The isl representation of the SCEV @p E in @p Domain.
|
||||
__isl_give isl_pw_aff *getPwAff(const llvm::SCEV *E,
|
||||
const ScopStmt *Stmt = nullptr);
|
||||
__isl_keep isl_set *Domain = nullptr);
|
||||
|
||||
private:
|
||||
/// @brief Key to identify cached expressions.
|
||||
using CacheKey = std::pair<const llvm::SCEV *, const ScopStmt *>;
|
||||
using CacheKey = std::pair<const llvm::SCEV *, isl_set *>;
|
||||
|
||||
/// @brief Map to remembered cached expressions.
|
||||
llvm::DenseMap<CacheKey, isl_pw_aff *> CachedExpressions;
|
||||
@ -69,7 +68,7 @@ private:
|
||||
unsigned NumIterators;
|
||||
const llvm::Region &R;
|
||||
llvm::ScalarEvolution &SE;
|
||||
const ScopStmt *Stmt;
|
||||
isl_set *Domain;
|
||||
|
||||
__isl_give isl_pw_aff *visit(const llvm::SCEV *E);
|
||||
__isl_give isl_pw_aff *visitConstant(const llvm::SCEVConstant *E);
|
||||
|
@ -697,7 +697,7 @@ isl_map *ScopStmt::getSchedule() const {
|
||||
}
|
||||
|
||||
__isl_give isl_pw_aff *ScopStmt::getPwAff(const SCEV *E) {
|
||||
return getParent()->getPwAff(E, this);
|
||||
return getParent()->getPwAff(E, Domain);
|
||||
}
|
||||
|
||||
void ScopStmt::restrictDomain(__isl_take isl_set *NewDomain) {
|
||||
@ -1843,8 +1843,8 @@ void Scop::dump() const { print(dbgs()); }
|
||||
|
||||
isl_ctx *Scop::getIslCtx() const { return IslCtx; }
|
||||
|
||||
__isl_give isl_pw_aff *Scop::getPwAff(const SCEV *E, ScopStmt *Stmt) {
|
||||
return Affinator.getPwAff(E, Stmt);
|
||||
__isl_give isl_pw_aff *Scop::getPwAff(const SCEV *E, isl_set *Domain) {
|
||||
return Affinator.getPwAff(E, Domain);
|
||||
}
|
||||
|
||||
__isl_give isl_union_set *Scop::getDomains() const {
|
||||
|
@ -35,11 +35,11 @@ SCEVAffinator::~SCEVAffinator() {
|
||||
}
|
||||
|
||||
__isl_give isl_pw_aff *SCEVAffinator::getPwAff(const SCEV *Expr,
|
||||
const ScopStmt *Stmt) {
|
||||
this->Stmt = Stmt;
|
||||
isl_set *Domain) {
|
||||
this->Domain = Domain;
|
||||
|
||||
if (Stmt)
|
||||
NumIterators = Stmt->getNumIterators();
|
||||
if (Domain)
|
||||
NumIterators = isl_set_n_dim(Domain);
|
||||
else
|
||||
NumIterators = 0;
|
||||
|
||||
@ -50,7 +50,7 @@ __isl_give isl_pw_aff *SCEVAffinator::getPwAff(const SCEV *Expr,
|
||||
|
||||
__isl_give isl_pw_aff *SCEVAffinator::visit(const SCEV *Expr) {
|
||||
|
||||
auto Key = std::make_pair(Expr, Stmt);
|
||||
auto Key = std::make_pair(Expr, Domain);
|
||||
isl_pw_aff *PWA = CachedExpressions[Key];
|
||||
|
||||
if (PWA)
|
||||
|
Loading…
x
Reference in New Issue
Block a user