Revision 799236949867b6a2be0d492137b36a0b67011622 authored by Andrew Adams on 07 December 2021, 16:16:50 UTC, committed by GitHub on 07 December 2021, 16:16:50 UTC
* Add a version of fast_integer_divide that rounds towards zero * clang-format * Fix test condition * Clean up debugging code * Add explanatory comment to performance test * Pacify clang tidy
1 parent fb305fd
Qualify.cpp
#include "Qualify.h"
#include "IRMutator.h"
namespace Halide {
namespace Internal {
using std::string;
namespace {
// Prefix all names in an expression with some string.
class QualifyExpr : public IRMutator {
using IRMutator::visit;
const string &prefix;
Expr visit(const Variable *v) override {
if (v->param.defined()) {
return v;
} else {
return Variable::make(v->type, prefix + v->name, v->reduction_domain);
}
}
Expr visit(const Let *op) override {
Expr value = mutate(op->value);
Expr body = mutate(op->body);
return Let::make(prefix + op->name, value, body);
}
public:
QualifyExpr(const string &p)
: prefix(p) {
}
};
} // namespace
Expr qualify(const string &prefix, const Expr &value) {
QualifyExpr q(prefix);
return q.mutate(value);
}
} // namespace Internal
} // namespace Halide
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...