qat.backend.passes.purr.transform module

class DesugaringPass

Bases: TransformPass

Transforms syntactic sugars and implicit effects.

The goal of this pass is to desugar any syntactic and semantic sugars. One of these sugars is iteration constructs such as Sweep and Repeat.

1- Adds an iterator variable for sweep loops. We state that sweep loops implicitly

declare an iterator variable to control progress of the sweep. See BindingPass

run(ir, res_mgr, *args, **kwargs)
Parameters:

ir (InstructionBuilder) – The list of instructions stored in an InstructionBuilder.

class ScopePeeling

Bases: TransformPass

A transform pass to discard scopes assuming they’ve been identified.

This pass is particularly useful for the code generator as it helps peel away any unwanted scopes. In fact, some sweeps are not lowerable and the user may choose to annotate certain sweeps and opt for static injection of variables with a switerator-like emitter. These sweep loops will be handled by the emitter statically while allowing it to lower nested constructs efficiently.

run(ir, res_mgr, met_mgr, *args, **kwargs)