[Mlir-commits] [mlir] mlir/Presburger: contribute a free-standing parser (PR #94916)
Ramkumar Ramachandra
llvmlistbot at llvm.org
Mon Jul 8 01:19:41 PDT 2024
================
@@ -182,18 +183,43 @@ class PresburgerSpace {
/// Get the space without local variables.
PresburgerSpace getSpaceWithoutLocals() const;
- unsigned getNumDomainVars() const { return numDomain; }
- unsigned getNumRangeVars() const { return numRange; }
- unsigned getNumSetDimVars() const { return numRange; }
- unsigned getNumSymbolVars() const { return numSymbols; }
- unsigned getNumLocalVars() const { return numLocals; }
+ constexpr unsigned getNumDomainVars() const { return numDomain; }
+ constexpr unsigned &numDomainVars() { return numDomain; }
+ constexpr unsigned getNumRangeVars() const { return numRange; }
+ constexpr unsigned &numRangeVars() { return numRange; }
+ constexpr unsigned getNumSetDimVars() const { return numRange; }
+ constexpr unsigned &numSetDimVars() { return numRange; }
+ constexpr unsigned getNumSymbolVars() const { return numSymbols; }
+ constexpr unsigned &numSymbolVars() { return numSymbols; }
+ constexpr unsigned getNumLocalVars() const { return numLocals; }
+ constexpr unsigned &numLocalVars() { return numLocals; }
+ constexpr unsigned getNumDimVars() const { return numDomain + numRange; }
+ constexpr unsigned getNumDimAndSymbolVars() const {
+ return getNumDimVars() + getNumSymbolVars();
+ }
+ constexpr unsigned getNumVars() const {
+ return getNumDimAndSymbolVars() + getNumLocalVars();
+ }
+ constexpr unsigned getNumCols() const { return getNumVars() + 1; }
+
+ constexpr unsigned getSetDimStartIdx() const { return 0; }
+ constexpr unsigned getSymbolStartIdx() const { return getNumDimVars(); }
+ constexpr unsigned getLocalVarStartIdx() const {
+ return getNumDimAndSymbolVars();
+ }
+ constexpr unsigned getConstantIdx() const { return getNumCols() - 1; }
- unsigned getNumDimVars() const { return numDomain + numRange; }
- unsigned getNumDimAndSymbolVars() const {
- return numDomain + numRange + numSymbols;
+ constexpr bool isSetDimIdx(unsigned i) const {
+ return i < getSymbolStartIdx();
+ }
+ constexpr bool isSymbolIdx(unsigned i) const {
+ return i >= getSymbolStartIdx() && i < getLocalVarStartIdx();
+ }
+ constexpr bool isLocalVarIdx(unsigned i) const {
+ return i >= getLocalVarStartIdx() && i < getConstantIdx();
}
- unsigned getNumVars() const {
- return numDomain + numRange + numSymbols + numLocals;
+ constexpr bool isConstantIdx(unsigned i) const {
+ return i == getConstantIdx();
}
----------------
artagnon wrote:
Well, this "implementation detail" is used by CoefficientVector. Either I've got to have my own ParseInfo, or expose these methods in PresburgerSpace.
https://github.com/llvm/llvm-project/pull/94916
More information about the Mlir-commits
mailing list