llpython.phi_injector

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.
llpython.phi_injector.inject_phis(func)

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

Previous topic

llpython.opcode_util

Next topic

llpython.pyaddfunc

This Page