Skip to content

A better API to evaluate or precompute an expression #2699

Closed
@dcodeIO

Description

@dcodeIO

We are currently utilizing precompute to find out whether conditions to branches are constant by

  • creating a temporary function
  • using the expression of interest as its body
  • running the precompute pass on that function
  • evaluating the new body
  • removing the temporary function again.

This has downsides in regards to overhead and that we have to replace the expression instead of keeping it intact, leading to not-so-untouched output, and doesn't work if the expression has side-effects.

So I've been thinking about adding an API like BinaryenExpressionEvaluate to aid here, but since precompute is a pass with no header that isn't meant to be used this way, it seems to require substantial code changes that I'm unsure about. Any suggestions how to tackle this? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions