Lines Matching defs:cst
99 static LogicalResult getDivRepr(const IntegerRelation &cst, unsigned pos,
104 assert(pos <= cst.getNumVars() && "Invalid variable position");
105 assert(ubIneq <= cst.getNumInequalities() &&
107 assert(lbIneq <= cst.getNumInequalities() &&
109 assert(expr.size() == cst.getNumCols() && "Invalid expression size");
110 assert(cst.atIneq(lbIneq, pos) > 0 && "lbIneq is not a lower bound!");
111 assert(cst.atIneq(ubIneq, pos) < 0 && "ubIneq is not an upper bound!");
114 divisor = cst.atIneq(lbIneq, pos);
119 for (i = 0, e = cst.getNumVars(); i < e; ++i)
120 if (cst.atIneq(ubIneq, i) != -cst.atIneq(lbIneq, i))
129 DynamicAPInt constantSum = cst.atIneq(lbIneq, cst.getNumCols() - 1) +
130 cst.atIneq(ubIneq, cst.getNumCols() - 1);
141 for (i = 0, e = cst.getNumVars(); i < e; ++i)
143 expr[i] = cst.atIneq(ubIneq, i);
148 expr.back() = cst.atIneq(ubIneq, cst.getNumCols() - 1) + c;
165 static LogicalResult getDivRepr(const IntegerRelation &cst, unsigned pos,
170 assert(pos <= cst.getNumVars() && "Invalid variable position");
171 assert(eqInd <= cst.getNumEqualities() && "Invalid equality position");
172 assert(expr.size() == cst.getNumCols() && "Invalid expression size");
177 DynamicAPInt tempDiv = cst.atEq(eqInd, pos);
185 for (unsigned i = 0, e = cst.getNumVars(); i < e; ++i)
187 expr[i] = -signDiv * cst.atEq(eqInd, i);
189 expr.back() = -signDiv * cst.atEq(eqInd, cst.getNumCols() - 1);
197 static bool checkExplicitRepresentation(const IntegerRelation &cst,
202 for (unsigned c = 0, e = cst.getNumVars(); c < e; ++c) {
229 const IntegerRelation &cst, ArrayRef<bool> foundRepr, unsigned pos,
231 assert(pos < cst.getNumVars() && "invalid position");
232 assert(foundRepr.size() == cst.getNumVars() &&
234 assert(dividend.size() == cst.getNumCols() && "Invalid dividend size");
237 cst.getLowerAndUpperBoundIndices(pos, &lbIndices, &ubIndices, &eqIndices);
243 if (getDivRepr(cst, pos, ubPos, lbPos, dividend, divisor).failed())
246 if (!checkExplicitRepresentation(cst, foundRepr, dividend, pos))
256 if (getDivRepr(cst, pos, eqPos, dividend, divisor).failed())
259 if (!checkExplicitRepresentation(cst, foundRepr, dividend, pos))
270 const IntegerRelation &cst, ArrayRef<bool> foundRepr, unsigned pos,
272 SmallVector<DynamicAPInt, 8> dividendDynamicAPInt(cst.getNumCols());
275 cst, foundRepr, pos, dividendDynamicAPInt, divisorDynamicAPInt);