Loading...
Searching...
No Matches
Simplify.h
Go to the documentation of this file.
#ifndef HALIDE_SIMPLIFY_H
#define HALIDE_SIMPLIFY_H
/** \file
* Methods for simplifying halide statements and expressions
*/
#include "Expr.h"
#include "Interval.h"
#include "ModulusRemainder.h"
#include "Scope.h"
namespace Halide {
namespace Internal {
/** Perform a wide range of simplifications to expressions and statements,
* including constant folding, substituting in trivial values, arithmetic
* rearranging, etc. Simplifies across let statements, so must not be called on
* stmts with dangling or repeated variable names. Can optionally be passed
* known bounds of any variables, known alignment properties, and any other
* Exprs that should be assumed to be true.
*/
// @{
Stmt simplify(const Stmt &,
bool remove_dead_code = true,
const Scope<Interval> &bounds = Scope<Interval>::empty_scope(),
const Scope<ModulusRemainder> &alignment = Scope<ModulusRemainder>::empty_scope(),
const std::vector<Expr> &assumptions = std::vector<Expr>());
Expr simplify(const Expr &,
bool remove_dead_code = true,
const Scope<Interval> &bounds = Scope<Interval>::empty_scope(),
const Scope<ModulusRemainder> &alignment = Scope<ModulusRemainder>::empty_scope(),
const std::vector<Expr> &assumptions = std::vector<Expr>());
// @}
/** Attempt to statically prove an expression is true using the simplifier. */
bool can_prove(Expr e, const Scope<Interval> &bounds = Scope<Interval>::empty_scope());
/** Simplify expressions found in a statement, but don't simplify
* across different statements. This is safe to perform at an earlier
* stage in lowering than full simplification of a stmt. */
Stmt simplify_exprs(const Stmt &);
} // namespace Internal
} // namespace Halide
#endif
Expr.h
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt).
Interval.h
Defines the Interval class.
ModulusRemainder.h
Routines for statically determining what expressions are divisible by.
Scope.h
Defines the Scope class, which is used for keeping track of names in a scope while traversing IR.
Halide::Internal::Scope
A common pattern when traversing Halide IR is that you need to keep track of stuff when you find a Le...
Definition Scope.h:94
Halide::Internal::Scope::empty_scope
static const Scope< T > & empty_scope()
A const ref to an empty scope.
Definition Scope.h:120
Halide::Internal
Definition AbstractGenerator.h:24
Halide::Internal::simplify_exprs
Stmt simplify_exprs(const Stmt &)
Simplify expressions found in a statement, but don't simplify across different statements.
Halide::Internal::can_prove
bool can_prove(Expr e, const Scope< Interval > &bounds=Scope< Interval >::empty_scope())
Attempt to statically prove an expression is true using the simplifier.
Halide::Internal::simplify
Stmt simplify(const Stmt &, bool remove_dead_code=true, const Scope< Interval > &bounds=Scope< Interval >::empty_scope(), const Scope< ModulusRemainder > &alignment=Scope< ModulusRemainder >::empty_scope(), const std::vector< Expr > &assumptions=std::vector< Expr >())
Perform a wide range of simplifications to expressions and statements, including constant folding,...
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition AbstractGenerator.h:19
Halide::Expr
A fragment of Halide syntax.
Definition Expr.h:258
Halide::Internal::Stmt
A reference-counted handle to a statement node.
Definition Expr.h:427