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 ` = Use()` - 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)