1/*
2Copyright (c) 2018 Microsoft Corporation. All rights reserved.
3Released under Apache 2.0 license as described in the file LICENSE.
4
5Author: Leonardo de Moura
6*/
7#pragma once
8#include "kernel/environment.h"
9namespace lean {
10struct csimp_cfg {
11 /* If `m_inline` == false, then we will not inline `c` even if it is marked with the attribute `[inline]`. */
12 bool m_inline;
13 /* We inline "cheap" functions. We say a function is cheap if `get_lcnf_size(val) < m_inline_threshold`,
14 and it is not marked as `[noinline]`. */
15 unsigned m_inline_threshold;
16 /* We only perform float cases_on from cases_on and other expression if the potential code blowup is smaller
17 than m_float_cases_threshold. */
18 unsigned m_float_cases_threshold;
19 /* We inline join-points that are smaller m_inline_threshold. */
20 unsigned m_inline_jp_threshold;
21public:
22 csimp_cfg(options const & opts);
23 csimp_cfg();
24};
25
26expr csimp_core(environment const & env, local_ctx const & lctx, expr const & e, bool before_erasure, csimp_cfg const & cfg);
27inline expr csimp(environment const & env, expr const & e, csimp_cfg const & cfg = csimp_cfg()) {
28 return csimp_core(env, local_ctx(), e, true, cfg);
29}
30inline expr cesimp(environment const & env, expr const & e, csimp_cfg const & cfg = csimp_cfg()) {
31 return csimp_core(env, local_ctx(), e, false, cfg);
32}
33}
34