qat.purr.backends.qblox.transform_passes 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 RepeatSanitisation(model=None)

Bases: TransformPass

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

Fixes repeat instructions if any with default values from the HW model Adds a repeat instructions if none is found

class ReturnSanitisation

Bases: TransformPass

run(ir, res_mgr, *args, **kwargs)
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)
class ScopeSanitisation

Bases: TransformPass

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

Bubbles up all sweeps and repeats to the beginning of the list. Adds delimiter instructions to the repeats and sweeps signifying the end of their scopes.

Intended for legacy existing builders and the relative order of instructions guarantees backwards compatibility.