Skip to content

Conversation

@idkwhttsay
Copy link
Collaborator

@idkwhttsay idkwhttsay commented Nov 20, 2025

closes #238

Plan:

  • Implement Assembly expression numbering:
    TaggedAssemblyExpression:
    expr: AssemblyExpression
    id: int

  • Implement transfer:
    store expressions in a set (hash set)
    when transferring, add expressions to the set without unrolling/simplifying them
    a little problem: because we store expressions in a set, but for Copy Propagation we store state in map (dict), it might be a problem to generalize it. work on it as well

  • Implement join:
    iterate over current_state set and check if current expression is available in other_state, if yes, add it to the result_state

  • Implement pretty printing (stmt_str, print_lattice_value)
    (?) probably rewrite AbstractAssemblyDataflow methods, not clear for now

Notes

when building blocks, for while, if, ifelse (blocks that change control flow in general), introduce a statement that copies its condition before the while loop starts, and at the end of the body of the while loop.

number statements instead of variables and expressions.

look at scala's dataflow analysis implementation (also try to find other small compilers with custom ASTs to look at theirs dataflow)

Feature description:

TODO!

@idkwhttsay idkwhttsay self-assigned this Nov 20, 2025
@idkwhttsay idkwhttsay added the enhancement New feature or request label Nov 20, 2025
@idkwhttsay idkwhttsay changed the title Available Expressions analysis + Expression Numbering Available Expressions analysis + Statement Numbering Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement Available Expressions analysis and tests for it (including printer)

1 participant