Available Expressions analysis + Statement Numbering #240
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 inmap(dict), it might be a problem to generalize it. work on it as wellImplement
join:iterate over
current_stateset and check if current expression is available inother_state, if yes, add it to theresult_stateImplement 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!