qbraid_qir.qasm3.QasmQIRVisitor

class QasmQIRVisitor(profile_name='Base', initialize_runtime=True, record_output=True, external_gates=None, emit_barrier_calls=True)[source]

A profile-aware visitor for converting OpenQASM 3 programs to QIR.

This class is designed to traverse and interact with statements in an OpenQASM program.

It uses Profile objects to handle different QIR profile requirements.

Parameters:
  • profile_name (str) – Name of the QIR profile to use. Defaults to “Base”.

  • initialize_runtime (bool) – If True, quantum runtime will be initialized. Defaults to True.

  • record_output (bool) – If True, output of the circuit will be recorded. Defaults to True.

  • external_gates (list[str]) – List of custom gates that should not be unrolled.

  • emit_barrier_calls (bool) – If True, barrier calls will be emitted. Defaults to True.

__init__(profile_name='Base', initialize_runtime=True, record_output=True, external_gates=None, emit_barrier_calls=True)[source]

Methods

__init__([profile_name, initialize_runtime, ...])

bitcode()

finalize()

ir()

record_output(module)

Record output using profile-specific method.

visit_qasm3_module(module)

Visit a Qasm3 module.

visit_statement(statement)

Visit a statement element.

Attributes

entry_point

profile

Get the current profile.