summaryrefslogtreecommitdiff
path: root/Notes/todo.txt
blob: 693dd164d9bf49a7a828a111e28e2fd187f9a94b (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
TODO:
- Get all run-pass and run-fail tests passing resolve
 - Lots of fixes to do here
- Audit TODOs in codebase
- Clean up AST
 - Almost done, just a few little niggles left
- Optimise typecheck.
  - Mostly done with trait resolve cleanup


## Big change TODOs
- Support MIR-only RLibs
  - Defer C codegen until final binary generation?
- Fix Span annotations
  - Spans are missing on HIR items, sub-par reporting in typecheck and later
  - Spans can be off by a line or two
  - Convert spans so they're 1 pointer inline (to save space)
- Refactor parse to use a consume model lexer
  - Will _probably_ improve speed and simplicity, but will need checking
- Optimise optimise (and typecheck)
  - Partially down with trait resolution optimisation. Needs further profiling
- Complete structed C codegen
  - Upside: It'll look cool
  - Unknown: Will it be faster?
- RTL/register-based SSA IR backend (LIR?)
  - Convert MIR into a form that can be handed over to LLVM or Cranelift (or GIMPLE)
  - Use alloca-s for non-pointer/integer/borrowed locals
- Restructure HIR node type annotations into a type table (de-duplicated types)
  - This will save memory (both inline, and by de-duplicating)
  - This can share the ivar table
  - Compact/dedup the table once done?
  - Store a `shared_ptr` and index on each node (3 pointers instead of huge TypeRef instance)
- Add a test framework for MIR optimistations
  - Have an input MIR function, and check that the output is as expected
  - Can ensure that mis-optimisations don't happen
  - ?Standalone application that parses serialised MIR and types
- Deferred constant evaluation (for generic array sizes)

## Smaller changes
- Cache specialisation tree
  - TODO: Profile to determine if this is a slow point.
- Delete HIR after MIR generation
  - Problem: HIR is sometimes touched again after MIR gen
  - May just be able to do the delete in the main MIR gen phase
- Split types and patterns in HIR function arguments
  - Upsides:
    - Simpler logic post MIR generation
    - Reduced use of .first/.second
    - Memory usage reduction for external functions
  - Downsides:
    - Lots of code touched
    - Extra complexity in typecheck and MIR lowering?
    - Need to check/assume that the lists are the same length

## Optimisations
- Argument propagation: replace assignments from `Argument(_)` if target is only
  written once
- Dead assignment removal (Delete `<val> = Use(<val>)`
- Tuple destructure removal
 - Spot `#1 = (...,)`, `#2 = (#1).n` where #1 is Write-once, borrow-none
- Remove useless borrows (remove write-once &T lvalues if they're never used by
  value - only used via deref)


<!-- vim: ft=markdown
-->