result_type operator()(const bind &b) { assert(detail::isinstance<name>(b.lhs())); const name& lhs = boost::get<const name&>(b.lhs()); if (m_declared.exists(lhs.id())) { m_modified.insert(lhs.id()); } else { m_declared.insert(lhs.id()); } return b.ptr(); }
prune::result_type prune::operator()(const bind& n) { shared_ptr<const expression> rhs = static_pointer_cast<const expression>( boost::apply_visitor(*this, n.rhs())); assert(detail::isinstance<name>(n.lhs())); const name& lhs = boost::get<const name&>(n.lhs()); if (m_used.exists(lhs.id()) || m_protected.exists(lhs.id())) { return n.ptr(); } else { return prune::result_type(); } }
thrust_rewriter::result_type thrust_rewriter::operator()(const bind& n) { const expression& rhs = n.rhs(); if (!detail::isinstance<apply>(rhs)) { return n.ptr(); } const apply& rhs_apply = boost::get<const apply&>(rhs); const name& fn_name = rhs_apply.fn(); const string& fn_id = fn_name.id(); if (fn_id.substr(0, 3) == "map") { return map_rewrite(n); } else if(fn_id.substr(0, 3) == "zip") { return zip_rewrite(n); } else if (fn_id == "indices") { return indices_rewrite(n); } else if (fn_id == "replicate") { return replicate_rewrite(n); } else if (fn_id == detail::snippet_make_tuple()) { return make_tuple_rewrite(n); } else { return n.ptr(); } }