Bases: InterpreterFunctions
Source code in xdsl/interpreters/func.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 | @register_impls
class FuncFunctions(InterpreterFunctions):
@impl_terminator(func.ReturnOp)
def run_return(
self, interpreter: Interpreter, op: func.ReturnOp, args: tuple[Any, ...]
) -> tuple[TerminatorValue, PythonValues]:
return ReturnedValues(args), ()
@impl(func.CallOp)
def run_call(
self, interpreter: Interpreter, op: func.CallOp, args: tuple[Any, ...]
) -> tuple[Any, ...]:
return interpreter.call_op(op.callee, args)
@impl_callable(func.FuncOp)
def call_func(
self, interpreter: Interpreter, op: func.FuncOp, args: tuple[Any, ...]
):
if (first_block := op.body.blocks.first) is None or not first_block.ops:
return interpreter.call_external(op.sym_name.data, op, args)
else:
return interpreter.run_ssacfg_region(op.body, args, op.sym_name.data)
|
run_return(interpreter: Interpreter, op: func.ReturnOp, args: tuple[Any, ...]) -> tuple[TerminatorValue, PythonValues]
Source code in xdsl/interpreters/func.py
| @impl_terminator(func.ReturnOp)
def run_return(
self, interpreter: Interpreter, op: func.ReturnOp, args: tuple[Any, ...]
) -> tuple[TerminatorValue, PythonValues]:
return ReturnedValues(args), ()
|
run_call(interpreter: Interpreter, op: func.CallOp, args: tuple[Any, ...]) -> tuple[Any, ...]
Source code in xdsl/interpreters/func.py
| @impl(func.CallOp)
def run_call(
self, interpreter: Interpreter, op: func.CallOp, args: tuple[Any, ...]
) -> tuple[Any, ...]:
return interpreter.call_op(op.callee, args)
|
call_func(interpreter: Interpreter, op: func.FuncOp, args: tuple[Any, ...])
Source code in xdsl/interpreters/func.py
| @impl_callable(func.FuncOp)
def call_func(
self, interpreter: Interpreter, op: func.FuncOp, args: tuple[Any, ...]
):
if (first_block := op.body.blocks.first) is None or not first_block.ops:
return interpreter.call_external(op.sym_name.data, op, args)
else:
return interpreter.run_ssacfg_region(op.body, args, op.sym_name.data)
|