Commit graph

111 commits

Author SHA1 Message Date
Leonardo de Moura
76a49ec256 chore(library/compiler): add ir::test 2019-05-02 14:40:04 -07:00
Leonardo de Moura
e52e787ad5 fix(library/init/lean/compiler/pushproj): bug and cleanup 2019-05-01 21:01:03 -07:00
Leonardo de Moura
ed5e461130 feat(library/init/lean/compiler/ir): add maxVar 2019-05-01 17:38:44 -07:00
Leonardo de Moura
0c9fa13763 feat(library/init/lean/compiler): convert LLNF into Lean IR 2019-04-30 17:55:43 -07:00
Leonardo de Moura
f222dc7cca feat(library/compiler): destructive updates for {x with ...} expressions 2019-04-22 13:35:11 -07:00
Leonardo de Moura
681f3ec81b fix(library/compiler/llnf): constructor reuse
We were not reusing constructor values for constructors that contained only
scalar values.
2019-03-26 11:10:51 -07:00
Leonardo de Moura
039e7fab48 refactor(library): add suffixes.h with commonly used suffixes such as brec_on 2019-03-21 15:06:43 -07:00
Leonardo de Moura
65441a79ca fix(library/compiler/llnf): neutral element 2019-03-14 16:01:42 -07:00
Leonardo de Moura
9fc813e601 fix(library/compiler/llnf): polymorphic projection resulting type 2019-03-07 11:24:08 -08:00
Leonardo de Moura
515556a718 feat(library/init/lean/compiler/ir): add new terminal: unreachable 2019-03-06 17:00:50 -08:00
Leonardo de Moura
110c727237 feat(library/compiler/llfn): rename to_llnf_fn => to_lambda_pure_fn, and make sure it produce valid terminal expressions
A terminal must be a variable, jump or cases.
This commit also makes sure `explicit_boxing_fn` preserve valid terminals.
2019-03-06 16:42:51 -08:00
Leonardo de Moura
6defbf82bd feat(library/init/lean/compiler/ir): add meta data, fix names and declarations
cc @kha
2019-03-06 06:56:16 -08:00
Leonardo de Moura
e067d82ab3 fix(library/compiler/llnf): nasty bug at explicit_rc_fn
@kha I found this nasty bug today after I tried a small modification
at lean.parser.token. It is crazy that it didn't manifest itself before.
2019-03-04 15:39:21 -08:00
Leonardo de Moura
f556423ae2 chore(library/compiler/llnf): add TODO 2019-02-25 17:43:21 -08:00
Leonardo de Moura
2ff3899d62 fix(library/compiler/llnf): missing case at push_proj_fn
We were not pushing projections over scalar projections.
2019-02-24 15:39:53 -08:00
Leonardo de Moura
d23216e3ee fix(library/compiler/llnf): bug at explicit_rc_fn 2019-02-22 16:01:52 -08:00
Leonardo de Moura
b1b75c7c2e feat(library/compiler): borrow inference procedure 2019-02-22 15:23:42 -08:00
Leonardo de Moura
ba43d355b7 feat(library/compiler): add borrowed annotation inference skeleton 2019-02-22 11:14:38 -08:00
Leonardo de Moura
01922794c5 fix(library/compiler/llnf): mk_boxed_version must take care of borrowed arguments and result 2019-02-22 10:18:17 -08:00
Leonardo de Moura
ac9e37ed86 feat(library/compiler/llnf): we postpone the simplification of 1-reachable and all-eq cases_on expressions
Reason: the `cases_on`-expressions are used to guide
`insert_reset_reuse_fn`. The new `simp_cases` simplifier applies the
1-reachable and all-eq cases_on expression simplifications after
`insert_reset_reuse_fn` is executed.
2019-02-20 17:00:50 -08:00
Leonardo de Moura
35adf5f540 feat(library/compiler/llnf): avoid unfruitful reuse instruction replacements 2019-02-20 16:34:46 -08:00
Leonardo de Moura
54a89dabb7 feat(library/compiler/llnf): new reset/reuse insertion procedure 2019-02-20 16:12:58 -08:00
Leonardo de Moura
937b947938 feat(library/compiler/llnf): decorate _cnstr instruction with inductive type name 2019-02-20 14:45:35 -08:00
Leonardo de Moura
b8cee758a5 feat(library/compiler/llnf): add push_proj_fn 2019-02-20 13:20:27 -08:00
Leonardo de Moura
2f218f7ec0 refactor(library/compiler/llnf): remove reset/reuse insertion from to_llnf_fn
`to_llnf_fn` now produces an IR similar to the \lambda_pure in our paper.
2019-02-20 11:16:29 -08:00
Leonardo de Moura
75ad042c66 feat(library/compiler/llnf): improve reuse/reset insertion
It is now closer to the procedure at reuse.txt
2019-02-19 22:14:29 -08:00
Leonardo de Moura
00aa78fffc feat(library/compiler/llnf): given y := _unbox.n x, mark x as an unboxed scalar if n < sizeof(void*) 2019-02-18 20:52:02 -08:00
Leonardo de Moura
feea8ecccd feat(library/compiler/llnf): avoid inc/dec operations on persistent objects
inc/dec operations are noop's for persistent objects.
2019-02-18 20:22:18 -08:00
Leonardo de Moura
243d7c08e3 feat(library/compiler/llnf): avoid inc and dec operations on (boxed) small nat literals 2019-02-17 07:31:14 -08:00
Leonardo de Moura
3c60af74ae feat(library/compiler/llnf): avoid inc and dec instructions on neutral elements 2019-02-17 07:17:54 -08:00
Leonardo de Moura
78440919e8 feat(library/compiler/llnf): avoid unnecessary inc x and dec x instructions
Example:
```
x = lean::box(0);
...
lean::inc(x);
...
lean::inc(x);
...
lean::dec(x);
...
```
In the example above, the `inc` and `dec` operations are unnecessary
since `x` is known to be a (boxed) scalar value. This commit fixes this.
2019-02-17 06:50:25 -08:00
Leonardo de Moura
221704900a feat(library/compiler/llnf): avoid inc x and dec x instructions in branches where x is known to be a scalar value 2019-02-17 06:25:00 -08:00
Leonardo de Moura
38c7ec133d fix(library/compiler/llnf): missing case 2019-02-15 17:51:08 -08:00
Leonardo de Moura
d4dce78b0e chore(library/compiler): delete compiler/builtin module
It has been replaced with `compiler/extern_attribute`
2019-02-12 18:23:09 -08:00
Leonardo de Moura
57411ed039 refactor(library/compiler/extern_attribute): new interface 2019-02-11 12:48:37 -08:00
Max Wagner
e663f75fb2 chore(library/compiler): move builtins into the environment 2019-02-08 09:56:03 -08:00
Leonardo de Moura
ba449aa9f4 chore(library/compiler/llnf): fix compilation warning 2019-02-07 15:02:26 -08:00
Leonardo de Moura
d103ff70fe feat(library/compiler): avoid cnstr_set_scalar when possible 2019-02-06 10:49:58 -08:00
Sebastian Ullrich
34110945f2 refactor(library/compiler/llnf): replace is_runtime_builtin_cnstr with just is_builtin_constant 2019-02-06 09:35:16 -08:00
Leonardo de Moura
3444a295e7 feat(library/compiler,runtime): builtin support for lean.name 2019-02-05 12:57:46 -08:00
Leonardo de Moura
4d66836255 fix(library/compiler/llnf): bug at process_cases
We should not decrement the RC of borrowed variables.
2019-02-04 12:51:51 -08:00
Leonardo de Moura
65e7e785ff fix(library/compiler/llnf): include closures at is_unboxed 2019-02-03 10:04:21 -08:00
Leonardo de Moura
90499abd94 fix(library/compiler/llnf): inc is only needed if variable has type _obj 2019-02-01 17:53:58 -08:00
Leonardo de Moura
d461833fcd fix(library/compiler/llnf): _sset and _uset were taking invalid LLNF arguments 2019-02-01 14:31:08 -08:00
Leonardo de Moura
3af0d91bbb fix(library/compiler/llnf): missing cases at explicit_boxing_fn 2019-01-31 18:16:36 -08:00
Leonardo de Moura
ddc5cf05c4 fix(library/compiler/llnf): user numeric literals to store enum type values in LLNF 2019-01-31 17:58:03 -08:00
Leonardo de Moura
7a322340cb fix(library/compiler/llnf): in LLNF, the _box.n argument must be a variable 2019-01-31 17:54:06 -08:00
Leonardo de Moura
39f45beec0 chore(library/compiler/llnf): fix typo 2019-01-31 17:52:59 -08:00
Leonardo de Moura
0f47787a06 fix(library/compiler/llnf): remove bad optimization
It may destroy boxed value information. Moreover, we want
terminals to be jmp, variable or cases.
2019-01-31 17:52:28 -08:00
Leonardo de Moura
4166851574 feat(library/compiler/emit_cpp): emit_box and emit_unbox 2019-01-31 16:16:30 -08:00