Commit graph

49 commits

Author SHA1 Message Date
Cameron Zwarich
71b5bf3ef6
fix: include ._closed decls in trace.Compiler.result output (#9336)
This PR changes the implementation of `trace.Compiler.result` to use the
decls as they are provided rather than looking them up in the LCNF mono
environment extension, which was seemingly done to save the trouble of
re-normalizing fvar IDs before printing the decl. This means that the
`._closed` decls created by the `extractClosed` pass will now be
included in the output, which was definitely confusing before if you
didn't know what was happening.
2025-07-13 02:24:00 +00:00
Cameron Zwarich
9ee8e0c896
chore: remove outdated comment (#9294) 2025-07-10 03:29:22 +00:00
Cameron Zwarich
7845154a3d
refactor: base the IR phase of the compiler on CoreM (#9291) 2025-07-10 01:39:27 +00:00
Cameron Zwarich
6ad12525ad
chore: make compileDecls and friends take an Array rather than a List (#9257) 2025-07-08 16:18:44 +00:00
Cameron Zwarich
173629ebd5
chore: remove compiler.enableNew option (#9252) 2025-07-08 14:17:05 +00:00
Cameron Zwarich
beeeead99f
chore: remove mentions of the compiler being new from trace messages (#9253) 2025-07-08 14:15:15 +00:00
Cameron Zwarich
d6fdbe2b23
fix: implement main type validity check in the new compiler (#9003)
This PR implements the validity check for the type of `main` in the new
compiler. There were no tests for this, so it slipped under the radar.
2025-06-25 23:59:27 +00:00
Cameron Zwarich
f247f2bdd0
fix: run LCNF checks less often by default (#8764)
This PR changes the LCNF pass pipeline so checks are no longer run by
default after every pass, only after `init`, `saveBase`, `toMono` and
`saveMono`. This is a compile time improvement, and the utility of these
checks is decreased a bit after the decision to no longer attempt to
preserve types throughout compilation. They have not been a significant
way to discover issues during development of the new compiler.
2025-06-13 05:39:21 +00:00
Cameron Zwarich
632d078a70
fix: use kernel environment to find definitions in the new compiler (#8502)
This PR changes the new compiler to use the kernel environment to find
definitions, which causes compilation to be skipped when the decl had a
kernel error (e.g. due to an unresolved metavariable). This matches the
behavior of the old compiler.

This will need to be revisited in the future when we want to make
compilation more asynchronous.
2025-05-27 16:56:00 +00:00
Cameron Zwarich
afab374305
feat: LCNF -> IR translation (#8211)
This PR adds support for generating IR from the LCNF representation of
the new compiler.
2025-05-03 05:34:37 +00:00
Cameron Zwarich
e3771e3ad6
fix: don't generate code for decls with an implemented_by attribute (#6680)
This PR makes the new code generator skip generating code for decls with
an implemented_by decl, just like the old code generator.
2025-01-21 02:06:41 +00:00
Cameron Zwarich
bf1d253764
feat: add support for extern LCNF decls (#6429)
This PR adds support for extern LCNF decls, which is required for parity
with the existing code generator.
2024-12-20 21:20:56 +00:00
Leonardo de Moura
f790b1999f
fix: new code generator must generate code for opaque declarations that are not @[extern] (#6383)
This PR ensures the new code generator produces code for `opaque`
definitions that are not tagged as `@[extern]`.
Remark: This is the behavior of the old code generator.
2024-12-14 20:26:14 +00:00
Joachim Breitner
1a12f63f74
refactor: move Synax.hasIdent, shake dependencies (#4766)
I noticed that a change to `Lean.PrettyPrinter.Delaborator.Builtins`
rebuilt more modules than I expected, so I moved a definition and
reduced some dependcies.

More reduction would be possible to move const-delaboration out of the
big `Lean.PrettyPrinter`, and import from `Lean.PrettyPrinter`
selectively.
2024-07-16 21:19:26 +00:00
Henrik Böving
23e49eb519 perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Henrik Böving
36f0acfc51 feat: add timing profiling to the new compiler 2023-04-18 12:20:27 +02:00
Leonardo de Moura
2e8150e50d chore: port Check.lean 2022-11-07 16:18:36 -08:00
Leonardo de Moura
01791b0c19 chore: port ToLCNF 2022-11-07 16:18:36 -08:00
Mario Carneiro
dd5948d641 chore: snake-case attributes (part 1) 2022-10-19 09:28:08 -07:00
Leonardo de Moura
31f2acd97a chore: cleanup trace messages 2022-10-13 18:56:17 -07:00
Leonardo de Moura
9feb4d8ab7 fix: do not generate code for [extern] functions 2022-10-09 15:35:29 -07:00
Leonardo de Moura
9996686690 feat: display mono phase code 2022-10-06 07:48:59 -07:00
Leonardo de Moura
a0894dedbb feat: add phaseOut field to Pass
We need it for passes that move the code from one phase to another.

See `toMono` pass.

cc @hargoniX
2022-10-06 03:29:21 -07:00
Sebastian Ullrich
8ed831101e chore: benchmark new compiler 2022-10-04 05:03:54 -07:00
Leonardo de Moura
f0be5439e6 feat: JpCases for join points with multiple parameters 2022-10-03 18:35:16 -07:00
Leonardo de Moura
bb1e94de82 feat: normalize free variable ids before saving LCNF code in the environment 2022-09-29 12:48:21 -07:00
Leonardo de Moura
fd5f3a5bad feat: track recursively inlining
closes #1657
see #1646

https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/inline.20codegen.20crash/near/301099703
2022-09-27 16:26:49 -07:00
Leonardo de Moura
236885e72e chore: remove Stage1 2022-09-25 13:17:50 -07:00
Leonardo de Moura
c858aa3088 feat: replace getStage1Decl? with new getDecl? 2022-09-24 15:00:19 -07:00
Leonardo de Moura
2be8cb93ac feat: store phase at CompilerM context 2022-09-23 16:30:51 -07:00
Leonardo de Moura
e4f0f4b794 fix: shouldGenerateCode fix for axiom 2022-09-23 14:25:48 -07:00
Leonardo de Moura
8cf225e9ce fix: PassInstaller staging issue
The builtin pass installer cannot be installed using `[cpass]` because
it will not be activated until we process `Passes.lean`
2022-09-23 08:17:58 -07:00
Leonardo de Moura
917f87fee4 fix: forward declaration type 2022-09-21 18:40:38 -07:00
Leonardo de Moura
05f0a6c423 fix: skip declarations that do not have a value 2022-09-21 18:40:20 -07:00
Leonardo de Moura
a5abe864f3 chore: prepare to activate new code generator 2022-09-21 18:09:19 -07:00
Leonardo de Moura
c52203ff57 feat: add baseExt environment extension for storing code generator results 2022-09-21 18:09:19 -07:00
Leonardo de Moura
a5ac950b54 chore: increase max recursion depth for compiler 2022-09-20 16:58:45 -07:00
Henrik Böving
c6db1099d0 feat: add occurences and phases to PassManager 2022-09-10 14:58:49 -07:00
Leonardo de Moura
ea3235c551 fix: skip casesOn recursors at code generation 2022-09-07 18:46:48 -07:00
Leonardo de Moura
fde8d35bbb refactor: declare passes when declaring transformations 2022-09-05 06:58:32 -07:00
Henrik Böving
32157f0e42 feat: Basic compiler testing framework 2022-09-03 19:55:53 -07:00
Leonardo de Moura
29eddad325 chore: only check if compiler.check is set to true 2022-09-01 07:18:47 -07:00
Leonardo de Moura
c201133d4d feat: LCNF local context dead variable checker
This commit also fixes a few local declaration leaks.
2022-08-31 21:07:21 -07:00
Henrik Böving
c1949e05e0 feat: migrate to new pass manager 2022-08-31 16:28:07 -07:00
Henrik Böving
fe63bd2e8e feat: basic pass manager 2022-08-31 16:28:07 -07:00
Leonardo de Moura
14944aeb3c chore: print decl size at trace message 2022-08-25 18:11:49 -07:00
Leonardo de Moura
4c9c2d2bf7 feat: new CSE.lean 2022-08-25 18:08:22 -07:00
Leonardo de Moura
98575b4250 feat: new PullLetDecls.lean 2022-08-25 13:39:15 -07:00
Leonardo de Moura
3a2758a59b refactor: new LCNF frontend 2022-08-24 11:40:37 -07:00