<commit_before>#ifndef HALIDE_INTERNAL_AUTO_SCHEDULE_UTILS_H
#define HALIDE_INTERNAL_AUTO_SCHEDULE_UTILS_H

/** \file
 *
 * Defines util functions that used by auto scheduler.
 */

#include <set>
#include <limits>

#include "Bounds.h"
#include "Interval.h"
#include "IRVisitor.h"
#include "IRMutator.h"

namespace Halide {
namespace Internal {

typedef std::map<std::string, Interval> DimBounds;

const int64_t unknown = std::numeric_limits<int64_t>::min();

/** Visitor for keeping track of functions that are directly called and the
 * arguments with which they are called. */
class FindAllCalls : public IRVisitor {
    using IRVisitor::visit;

    void visit(const Call *call) {
        if (call->call_type == Call::Halide || call->call_type == Call::Image) {
            funcs_called.insert(call->name);
            call_args.push_back(std::make_pair(call->name, call->args));
        }
        for (size_t i = 0; i < call->args.size(); i++) {
            call->args[i].accept(this);
        }
    }
public:
    std::set<std::string> funcs_called;
    std::vector<std::pair<std::string, std::vector<Expr>>> call_args;
};

/** Return a map of estimates on some variables. */
class GetVarEstimates : public IRVisitor {
    using IRVisitor::visit;

    void visit(const Variable *var) {
        if (var->param.defined() && !var->param.is_buffer() &&
            var->param.get_estimate().defined()) {
            var_estimates[var->param.name()] = var->param.get_estimate();
        }
    }
public:
    std::map<std::string, Expr> var_estimates;
};


/** Substitute every variable with its estimate if specified. */
class SubstituteVarEstimates: public IRMutator {
    using IRMutator::visit;

    void visit(const Variable *var) {
        if (var->param.defined() && !var->param.is_buffer() &&
            var->param.get_estimate().defined()) {
            expr = var->param.get_estimate();
        } else {
            expr = var;
        }<commit_msg>Remove unused helper class<commit_after>#ifndef HALIDE_INTERNAL_AUTO_SCHEDULE_UTILS_H
#define HALIDE_INTERNAL_AUTO_SCHEDULE_UTILS_H

/** \file
 *
 * Defines util functions that used by auto scheduler.
 */

#include <set>
#include <limits>

#include "Bounds.h"
#include "Interval.h"
#include "IRVisitor.h"
#include "IRMutator.h"

namespace Halide {
namespace Internal {

typedef std::map<std::string, Interval> DimBounds;

const int64_t unknown = std::numeric_limits<int64_t>::min();

/** Visitor for keeping track of functions that are directly called and the
 * arguments with which they are called. */
class FindAllCalls : public IRVisitor {
    using IRVisitor::visit;

    void visit(const Call *call) {
        if (call->call_type == Call::Halide || call->call_type == Call::Image) {
            funcs_called.insert(call->name);
            call_args.push_back(std::make_pair(call->name, call->args));
        }
        for (size_t i = 0; i < call->args.size(); i++) {
            call->args[i].accept(this);
        }
    }
public:
    std::set<std::string> funcs_called;
    std::vector<std::pair<std::string, std::vector<Expr>>> call_args;
};


/** Substitute every variable with its estimate if specified. */
class SubstituteVarEstimates: public IRMutator {
    using IRMutator::visit;

    void visit(const Variable *var) {
        if (var->param.defined() && !var->param.is_buffer() &&
            var->param.get_estimate().defined()) {
            expr = var->param.get_estimate();
        } else {
            expr = var;
        }
{'fraction_non_alphanumeric': 0.14057142857142857, 'fraction_numerical': 0.002857142857142857, 'mean_word_length': 3.2487864077669903, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4376041', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1105, 'n_words': 259}