@@ -48,10 +48,8 @@ class Unwrap(ir.Statement):
4848 result : ir .ResultValue = info .result (WireType )
4949
5050
51- # In Quake, you put a wire in and get a wire out when you "apply" an operator
52- # In this case though we just need to indicate that an operator is applied to list[wires]
53- @statement (dialect = dialect )
54- class Apply (ir .Statement ): # apply(op, w1, w2, ...)
51+ @statement
52+ class MultiWireStatement (ir .Statement ):
5553 traits = frozenset ({lowering .FromPythonCall (), ir .Pure ()})
5654 operator : ir .SSAValue = info .argument (OpType )
5755 inputs : tuple [ir .SSAValue , ...] = info .argument (WireType )
@@ -68,6 +66,20 @@ def __init__(self, operator: ir.SSAValue, *args: ir.SSAValue):
6866 ) # custom lowering required for wrapper to work here
6967
7068
69+ # In Quake, you put a wire in and get a wire out when you "apply" an operator
70+ # In this case though we just need to indicate that an operator is applied to list[wires]
71+ @statement (dialect = dialect )
72+ class Apply (MultiWireStatement ): # apply(op, w1, w2, ...)
73+ def __init__ (self , operator : ir .SSAValue , * args : ir .SSAValue ):
74+ super ().__init__ (operator , * args )
75+
76+
77+ @statement (dialect = dialect )
78+ class Broadcast (MultiWireStatement ):
79+ def __init__ (self , operator : ir .SSAValue , * args : ir .SSAValue ):
80+ super ().__init__ (operator , * args )
81+
82+
7183# NOTE: measurement cannot be pure because they will collapse the state
7284# of the qubit. The state is a hidden state that is not visible to
7385# the user in the wire dialect.
0 commit comments