blob: bb857d76ec7eccbcf9c01b728ec25bfa6aa921b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
% MRustC structure overview
Overview
========
AST
---
Load
- "Parse" - Parsing and Lexing
- "LoadCrates" - Extern crate loading
- "Expand" - Attribute and macro expansion
Resolve
- "Resolve Use" - Fix up `use` statement paths
- "Resolve Index" - Build up an index of avaliable names in modules
- "Resolve Absolute" - Name resolution to items, variables, or type parameters.
HIR
---
- "HIR Lower" - Convert AST into HIR
Resolve
- "Resolve Type Aliases" - Replace references to `type` aliases with the referenced type
- "Resolve Bind" - Set binding pointers in paths
- "Resolve UFCS paths" - Determine if unknown UFCS paths point to trait methods or type methods
- "Constant Evaluate" - Constant evaluation (using a simple duck-typing system)
Typecheck
- "Typecheck Outer" - Checks types outside of expressions (where inferrence isn't needed)
- "Typecheck Expressions" - Performs type inferrence and checking within expressions.
Expand
- "Expand HIR Annotate" - Annotates how values are used for later passes
- "Expand HIR Closures" - Converts closure nodes into structs and trait impls
- "Expand HIR Calls" - Converts operator overloads into function calls.
- "Expand HIR Reborrows" - Inserts `&mut *` reborrows wherever a `&mut` would be moved.
- "Typecheck Expressions (validate)" - Runs typechecking again, this time without inferrence.
MIR
---
- "Lower MIR" - Converts HIR expression trees into MIR "functions"
- "MIR Validate" - Checks the sanity of the generated MIR
AST
===
The AST contains a direct translation of the source code into data structures, maintaining ordering and support for unexpanded macros and relative paths.
HIR
===
The HIR contains a far simpler module tree, only supports absolute paths, and doesn't contain higher-level syntatic constructs like `for` loops.
MIR
===
The MIR is just used for function bodies, and provides a pre-monomorphisation "assembly" to both simplify codegen and allow higher level optimisations.
|