Skip to content

Graph IR #28

@MDFL64

Description

@MDFL64

Began work on an IR today. It is locked behind a compiler flag (--useGraphIR) to facilitate easy testing + continued development alongside the main branch. It currently does not work at all.

  • Convert WASM control flow to graph IR.
  • Add all instructions to IR (No good dataflow yet, just for testing control flow).
  • Test basic control flow. (Just link blocks together with gotos for now)
  • Local dataflow: Each control block tracks which locals it uses, and the values locals are bound to when they terminate.
  • Better control flow code generation.
  • Proper bounding of variable lifetimes.
  • Handling for very large jumps.
  • Proper handling of setjmp/longjmp (setjmp should split control blocks).

Other thoughts:

  • Planning to deal with block results by creating an extra pseudo-local and throwing it in block outputs.
  • Track nesting to avoid the parser throwing a fit. Might be able to decompose expressions that are too large by creating a small scope with temp vars.
  • Track estimate of LJ opcodes to avoid large jumps.
  • Might be able to convert some loops into lua for loops.
  • Maybe convert some blocks to functions? I'm not sure how the JIT feels about lambdas, will need to test.

Metadata

Metadata

Assignees

Labels

featureNew feature or requestoptimisationImplement this to make things run faster

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions