Py type context
py_type_context
¶
TypeMap
¶
Bases: NamedTuple
Map a Python type to a C type and optional call-boundary conversions.
Missing converters pass values through unchanged.
Source code in xdsl/jit/py_type_context.py
python_type: type[Any]
instance-attribute
¶
Python type on the wrapped-function boundary.
c_type: str
instance-attribute
¶
C type used by the native function.
to_c: Callable[[Any], Any] | None = None
class-attribute
instance-attribute
¶
Convert a Python argument before the native call.
from_c: Callable[[Any], Any] | None = None
class-attribute
instance-attribute
¶
Convert the native result back to a Python value.
FuncTypeMap
¶
Bases: NamedTuple
Per-argument and result :class:TypeMap entries for a function signature.
Source code in xdsl/jit/py_type_context.py
PyTypeContext
¶
Registry of Python types to :class:TypeMap entries.
Configures native call signatures and optional value conversions when wrapping
a :class:RawJITFunc. Registrations must agree with the frontend type mapping and
with
:class:~xdsl.jit.c_type_context.CTypeContext for the same logical types.
Source code in xdsl/jit/py_type_context.py
register_type_map(type_map: TypeMap)
¶
type_map(python_type: type[Any]) -> TypeMap
¶
Return the :class:TypeMap for python_type.
func_type_map(signature: TypeForm[Callable[..., Any]]) -> FuncTypeMap
¶
Build a :class:FuncTypeMap from a Callable signature.