# `Beaver.MLIR.Value`

This module handles MLIR values, which represent SSA (Static Single Assignment) values in the IR.

Values can be either block arguments or operation results. That's why this module provides
functions to check if a value is an argument or a result (`argument?/1`, `result?/1`), or to get the owner of a result (`owner/1`).

Conditional use replacement runs its native traversal on an MLIR worker
thread and dispatches each use to the calling BEAM process through
`Kinda.CallbackRuntime`.

# `t`

```elixir
@type t() :: %Beaver.MLIR.Value{ref: term()}
```

# `argument?`

# `make`

# `owner`

Return the defining op of this value if this value is a result

# `owner!`

Return the defining op of this value. Raises if this value is not a result

# `replace_uses_with_if`

```elixir
@spec replace_uses_with_if(t(), t(), (Beaver.MLIR.OpOperand.t() -&gt; boolean())) :: :ok
```

Replaces uses of `value` for which `predicate` returns `true`.

The predicate receives an `Beaver.MLIR.OpOperand` and executes in the
calling BEAM process. Native traversal runs outside the scheduler and waits
through Kinda's resource-backed callback runtime. The source and replacement
values must belong to the same multithreaded MLIR context.

Predicate exceptions are re-raised with their original stacktrace after the
native traversal stops. This operation is not transactional: replacements
accepted before an exception remain applied.

# `result?`

Returns true if the value is a result of an operation.

# `type`

Return the type of this value

