Skip to content

Commit

Permalink
Write a fresh parser
Browse files Browse the repository at this point in the history
  • Loading branch information
artagnon committed Jun 23, 2024
1 parent 4455468 commit 581fad7
Show file tree
Hide file tree
Showing 9 changed files with 848 additions and 1,571 deletions.
3 changes: 3 additions & 0 deletions mlir/include/mlir/Analysis/Presburger/Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ class Matrix {
/// Set the specified row to `elems`.
void setRow(unsigned row, ArrayRef<T> elems);

/// Add the specified row to `elems`.
void addToRow(unsigned row, ArrayRef<T> elems);

/// Insert columns having positions pos, pos + 1, ... pos + count - 1.
/// Columns that were at positions 0 to pos - 1 will stay where they are;
/// columns that were at positions pos to nColumns - 1 will be pushed to the
Expand Down
8 changes: 8 additions & 0 deletions mlir/lib/Analysis/Presburger/Matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ void Matrix<T>::setRow(unsigned row, ArrayRef<T> elems) {
at(row, i) = elems[i];
}

template <typename T>
void Matrix<T>::addToRow(unsigned row, ArrayRef<T> elems) {
assert(elems.size() == getNumColumns() &&
"elems size must match row length!");
for (unsigned i = 0, e = getNumColumns(); i < e; ++i)
at(row, i) += elems[i];
}

template <typename T>
void Matrix<T>::insertColumn(unsigned pos) {
insertColumns(pos, 1);
Expand Down
Loading

0 comments on commit 581fad7

Please sign in to comment.