IR Builder
Defines an ABC for implementing IR builders.
This module defines the interface to be used by Qadence 2 IR front-ends to compile to IR. A front-
end must implement an IRBuilder for the front-end specific input type, so that
ir_compiler_factory, defined in qadence2-ir.factory can generate a compiler function specific
to the front-end.
IRBuilder
Bases: ABC, Generic[InputType]
Defines the interface of Qadence 2 IR builders for building IR code from front-end input.
An IRBuilder implementation can be used by the ir_compiler_factory function, defined in
qadence2-ir.factory to build a compiler function that generates IR code from a specific
input type as created by a Qadence 2 front-end.
When subclassing this class, specify the InputType that is expected for the implementation,
i.e. the object type that the specific front-end generates.
This class is responsible for extracting information about the register, directives, other
settings and the AST from front-end generated input.
parse_sequence(input_obj)
abstractmethod
staticmethod
Returns an AST definition that represents the operations in input object.
| PARAMETER | DESCRIPTION |
|---|---|
input_obj
|
Input for the compilation to IR native to a specific front-end.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AST
|
An AST definition that represents the operations defined in an |
Source code in qadence2_ir/irbuilder.py
set_directives(input_obj)
abstractmethod
staticmethod
Returns directives based on an input object.
| PARAMETER | DESCRIPTION |
|---|---|
input_obj
|
Input for the compilation to IR native to a specific front-end.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Attributes
|
A specification of all directives that could be extracted from |
Source code in qadence2_ir/irbuilder.py
set_register(input_obj)
abstractmethod
staticmethod
Returns a register definition based on an input object.
| PARAMETER | DESCRIPTION |
|---|---|
input_obj
|
Input for the compilation to IR native to a specific front-end.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AllocQubits
|
A register definition that is extracted or inferred from |
Source code in qadence2_ir/irbuilder.py
settings(input_obj)
abstractmethod
staticmethod
Returns settings based on an input object.
| PARAMETER | DESCRIPTION |
|---|---|
input_obj
|
Input for the compilation to IR native to a specific front-end.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Attributes
|
A specification of all settings that could be extracted from |