Skip to content
Commit d940c521 authored by Alex Zinenko's avatar Alex Zinenko Committed by jpienaar
Browse files

Python bindings: make FunctionContext behave more like BlockContext

Provide a function `arg` that returns the function argument as a value handle,
similar to block arguments.  This makes function context managers in Python
similar to block context managers, which is more consistent given that the
function context manager sets the insertion point to the first block of the
function and that arguments of that block are those of the function.  This
prepares the removal of PythonMLIREmitter class and its bind_function_arguments
helper.

Additionally, provide a helper method in PythonMLIRModule to define a function
and immediately create a context for it.  Update the tests that are already
using context managers to use the function context manager instead of creating
the function manually.

PiperOrigin-RevId: 238421087
parent e1e455f7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment