void GlobalsCollector::visit(ast::CallExp & e) { for (auto arg : e.getArgs()) { arg->accept(*this); } e.getName().accept(*this); }
void SLintVisitor::visit(const ast::CallExp & e) { auto range = preCheck(e); e.getName().accept(*this); ast::exps_t args = e.getArgs(); for (auto arg : args) { arg->accept(*this); } postCheck(e, range); }
bool AnalysisVisitor::analyzeIndices(TIType & type, ast::CallExp & ce) { const ast::exps_t args = ce.getArgs(); const unsigned int size = args.size(); if (size >= 3) { // Not handle yet... // TODO return false; } if (size == 0) { Result & res = ce.getDecorator().setResult(type); setResult(res); return true; } SymbolicDimension first, second; bool safe, ret; argIndices.emplace(static_cast<ast::SimpleVar &>(ce.getName()), size, 1); if (size == 1) { // when there is one argument, a(?) is equivalent to A(?,1) // where A = matrix(a, r_a * c_a, 1) SymbolicDimension rows(type.rows); second = SymbolicDimension(getGVN(), 1); if (type.cols != 1) { rows *= type.cols; } ret = getDimension(rows, *args.front(), safe, first); } else { bool _safe; ret = getDimension(type.rows, *args.front(), _safe, first); if (ret) { argIndices.top().getIndex() = 2; ret = getDimension(type.cols, *args.back(), safe, second); safe = safe && _safe; } else { safe = _safe; } } argIndices.pop(); if (ret) { TIType typ(getGVN(), type.type, first, second); Result & _res = ce.getDecorator().setResult(typ); setResult(_res); ce.getDecorator().safe = safe; } return ret; }