1 | /* |
2 | Copyright (c) 2018 Microsoft Corporation. All rights reserved. |
3 | Released under Apache 2.0 license as described in the file LICENSE. |
4 | |
5 | Author: Leonardo de Moura |
6 | */ |
7 | #pragma once |
8 | #include "kernel/environment.h" |
9 | namespace lean { |
10 | struct 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; |
21 | public: |
22 | csimp_cfg(options const & opts); |
23 | csimp_cfg(); |
24 | }; |
25 | |
26 | expr csimp_core(environment const & env, local_ctx const & lctx, expr const & e, bool before_erasure, csimp_cfg const & cfg); |
27 | inline 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 | } |
30 | inline 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 | |