qat.purr.backends.qblox.transform_passes module

class DesugaringPass

Bases: TransformPass

Transforms syntactic sugars and implicit effects. Not that it applies here, but a classical example of a sugar syntax is the ternary expression “cond ? val1 : val2” which is nothing more than an if else in disguise.

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.

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