Analysis_and_optimization.Mir_utilsval var_declarations : ('a, 'b) Middle.Stmt.t -> string Core.Set.Poly.tval num_expr_value : Middle.Expr.Typed.t -> (float * string) optionval trans_bounds_values :
Middle.Expr.Typed.t Middle.Transformation.t ->
bound_valuesval top_var_declarations : Middle.Stmt.Located.t -> string Core.Set.Poly.tval data_set :
?exclude_transformed:bool ->
?exclude_ints:bool ->
Middle.Program.Typed.t ->
string Core.Set.Poly.tval parameter_set :
?include_transformed:bool ->
Middle.Program.Typed.t ->
(string
* Middle.Expr.Typed.t Middle.Transformation.t
* Middle.Location_span.t)
Core.Set.Poly.tval parameter_names_set :
?include_transformed:bool ->
Middle.Program.Typed.t ->
string Core.Set.Poly.tval fold_expr :
take_expr:('c -> Middle.Expr.Typed.t -> 'c) ->
init:'c ->
Middle.Expr.Typed.t ->
'cval fold_stmts :
take_expr:('c -> Middle.Expr.Typed.t -> 'c) ->
take_stmt:('c -> Middle.Stmt.Located.t -> 'c) ->
init:'c ->
Middle.Stmt.Located.t Core.List.t ->
'cval map_rec_expr :
(Middle.Expr.Typed.t Middle.Expr.Pattern.t ->
Middle.Expr.Typed.t Middle.Expr.Pattern.t) ->
Middle.Expr.Typed.t ->
Middle.Expr.Typed.tval map_rec_expr_state :
('s ->
Middle.Expr.Typed.t Middle.Expr.Pattern.t ->
Middle.Expr.Typed.t Middle.Expr.Pattern.t * 's) ->
's ->
Middle.Expr.Typed.t ->
Middle.Expr.Typed.t * 'sval map_rec_stmt_loc :
((Middle.Expr.Typed.t, Middle.Stmt.Located.t) Middle.Stmt.Pattern.t ->
(Middle.Expr.Typed.t, Middle.Stmt.Located.t) Middle.Stmt.Pattern.t) ->
Middle.Stmt.Located.t ->
Middle.Stmt.Located.tval top_down_map_rec_stmt_loc :
((Middle.Expr.Typed.t, Middle.Stmt.Located.t) Middle.Stmt.Pattern.t ->
(Middle.Expr.Typed.t, Middle.Stmt.Located.t) Middle.Stmt.Pattern.t) ->
Middle.Stmt.Located.t ->
Middle.Stmt.Located.tval map_rec_state_stmt_loc :
('s ->
(Middle.Expr.Typed.t, Middle.Stmt.Located.t) Middle.Stmt.Pattern.t ->
(Middle.Expr.Typed.t, Middle.Stmt.Located.t) Middle.Stmt.Pattern.t * 's) ->
's ->
Middle.Stmt.Located.t ->
Middle.Stmt.Located.t * 'sval map_rec_stmt_loc_num :
(int, Middle.Stmt.Located.Non_recursive.t) Core.Map.Poly.t ->
(int ->
(Middle.Expr.Typed.t, Middle.Stmt.Located.t) Middle.Stmt.Pattern.t ->
(Middle.Expr.Typed.t, Middle.Stmt.Located.t) Middle.Stmt.Pattern.t) ->
Middle.Stmt.Located.Non_recursive.t ->
Middle.Stmt.Located.tval stmt_loc_of_stmt_loc_num :
(int, Middle.Stmt.Located.Non_recursive.t) Core.Map.Poly.t ->
Middle.Stmt.Located.Non_recursive.t ->
Middle.Stmt.Located.tval statement_stmt_loc_of_statement_stmt_loc_num :
(int, Middle.Stmt.Located.Non_recursive.t) Core.Map.Poly.t ->
(Middle.Expr.Typed.t, int) Middle.Stmt.Pattern.t ->
(Middle.Expr.Typed.t, Middle.Stmt.Located.t) Middle.Stmt.Pattern.tval unnumbered_prog_of_numbered_prog :
(int, Middle.Stmt.Located.Non_recursive.t) Core.Map.Poly.t ->
('a -> 'b) ->
(Middle.Stmt.Located.Non_recursive.t, 'a, 'c) Middle.Program.t ->
(Middle.Stmt.Located.t, 'b, 'c) Middle.Program.tval fwd_traverse_statement :
('e, 'a) Middle.Stmt.Pattern.t ->
init:'f ->
f:('f -> 'a -> 'f * 'c) ->
'f * ('e, 'c) Middle.Stmt.Pattern.tA traversal that simultaneously accumulates a state (type 'f) and replaces the substatement values from ('a to 'c). Traversal is done in-order but ignores branching, e.g., and if's then block is followed by the else block rather than branching.
val vexpr_of_expr_exn : Middle.Expr.Typed.t -> Dataflow_types.vexprTake a LHS expression from a general expression, throwing an exception if it can't be a LHS expression.
val expr_var_set :
Middle.Expr.Typed.t ->
(Dataflow_types.vexpr * Middle.Expr.Typed.Meta.t) Core.Set.Poly.tThe set of variables in an expression, including inside an index. For use in RHS sets, not LHS assignment sets, except in a target term.
val index_var_set :
Middle.Expr.Typed.t Middle.Index.t ->
(Dataflow_types.vexpr * Middle.Expr.Typed.Meta.t) Core.Set.Poly.tThe set of variables in an index. For use in RHS sets, not LHS assignment sets, except in a target term
val expr_var_names_set : Middle.Expr.Typed.t -> string Core.Set.Poly.tReturn the names of the variables in an expression.
val stmt_rhs :
(Middle.Expr.Typed.t, 's) Middle.Stmt.Pattern.t ->
Middle.Expr.Typed.t Core.Set.Poly.tThe set of variables that can affect the value or behavior of the expression, i.e. rhs. Using Set.Poly instead of ExprSet so that 'e can be polymorphic, it usually doesn't matter if there's duplication.
This is a helper function equivalent to List.concat_map but for Sets
val stmt_rhs_var_set :
(Middle.Expr.Typed.t, 's) Middle.Stmt.Pattern.t ->
(Dataflow_types.vexpr * Middle.Expr.Typed.Meta.t) Core.Set.Poly.tThe set of variables in an expression, including inside an index. For use in RHS sets, not LHS assignment sets, except in a target term.
val expr_assigned_var : Middle.Expr.Typed.t -> Dataflow_types.vexprThe variable being assigned to when the expression is the LHS
val summation_terms : Middle.Expr.Typed.t -> Middle.Expr.Typed.t listThe list of terms in expression separated by a +
val subst_expr :
(string, Middle.Expr.Typed.t) Core.Map.Poly.t ->
Middle.Expr.Typed.t ->
Middle.Expr.Typed.tSubstitute variables in an expression according to the provided Map.
val subst_stmt_base :
(string, Middle.Expr.Typed.t) Core.Map.Poly.t ->
(Middle.Expr.Typed.t, 'a) Middle.Stmt.Pattern.t ->
(Middle.Expr.Typed.t, 'a) Middle.Stmt.Pattern.tSubstitute variables occurring at the top level in statements according to the provided Map.
val subst_stmt :
(string, Middle.Expr.Typed.t) Core.Map.Poly.t ->
Middle.Stmt.Located.t ->
Middle.Stmt.Located.tSubstitute variables occurring anywhere in a statement according to the provided Map.
val name_subst_stmt :
(string, string) Core.Map.Poly.t ->
Middle.Stmt.Located.t ->
Middle.Stmt.Located.tSubstitute subexpressions occurring anywhere in a statement according to the provided Map.
val expr_subst_expr :
Middle.Expr.Typed.t Middle.Expr.Typed.Map.t ->
Middle.Expr.Typed.t ->
Middle.Expr.Typed.tSubstitute subexpressions in an expression according to the provided Map, trying to match on larger subexpressions before smaller ones.
val expr_subst_stmt_base :
Middle.Expr.Typed.t Middle.Expr.Typed.Map.t ->
(Middle.Expr.Typed.t, 'a) Middle.Stmt.Pattern.t ->
(Middle.Expr.Typed.t, 'a) Middle.Stmt.Pattern.tSubstitute subexpressions occurring at the top level in statements according to the provided Map.
val expr_depth : Middle.Expr.Typed.t -> intCalculate how deeply nested an expression is.
val update_expr_ad_levels :
string Core.Set.Poly.t ->
Middle.Expr.Typed.t ->
Middle.Expr.Typed.tRecompute all AD-levels in the metadata of an expression from the bottom up, making the variables in the first argument autodiffable
val cleanup_empty_stmts :
('e, 's) Middle.Stmt.t list ->
('e, 's) Middle.Stmt.t listval unsafe_unsized_to_sized_type :
Middle.Expr.Typed.t Middle.Type.t ->
Middle.Expr.Typed.t Middle.Type.t