class llpython.phi_injector.PhiInjector

Transformer responsible for modifying a bytecode flow, removing LOAD_FAST and STORE_FAST opcodes, and replacing them with a static single assignment (SSA) representation.

In order to support SSA, PhiInjector adds the following synthetic opcodes to transformed flows:

  • REF_ARG: Specifically reference an incomming argument value.
  • BUILD_PHI: Build a phi node to disambiguate between several possible definitions at a control flow join.
  • DEFINITION: Unique value definition indexed by the “arg” field in the tuple.
  • REF_DEF: Reference a specific value definition.

Given a Python function, return a bytecode flow object that has been transformed by a fresh PhiInjector instance.

Previous topic


Next topic