Cranelift: extend docs on Inst to discuss call instructions (#4630)

* Cranelift: extend docs on Inst to discuss `call` instructions

the docs on `Inst` note that the type is returned by non-resultful
instructions built from `InstBuilder`, but did _not_ note that it is
also returned by `call` and `call_indirect`. if you're trying to learn
and use Cranelift by following the docs, this means you'd follow a doc
link to `Inst` that implies that `call` does not return a value - this
is actively misleading, since you'd want to use the returned `Inst` to
find exactly those returned values!

so, this adds a few sentences talking about the case of call `Inst`s.
This commit is contained in:
iximeow
2022-08-22 08:57:10 -07:00
committed by GitHub
parent d620705a32
commit a41cc668af

View File

@@ -88,7 +88,10 @@ impl Value {
/// ///
/// Most usage of `Inst` is internal. `Inst`ructions are returned by /// Most usage of `Inst` is internal. `Inst`ructions are returned by
/// [`InstBuilder`](super::InstBuilder) instructions that do not return a /// [`InstBuilder`](super::InstBuilder) instructions that do not return a
/// [`Value`], such as control flow and trap instructions. /// [`Value`], such as control flow and trap instructions, as well as instructions that return a
/// variable (potentially zero!) number of values, like call or call-indirect instructions. To get
/// the `Value` of such instructions, use [`inst_results`](super::DataFlowGraph::inst_results) or
/// its analogue in `cranelift_frontend::FuncBuilder`.
/// ///
/// If you look around the API, you can find many inventive uses for `Inst`, /// If you look around the API, you can find many inventive uses for `Inst`,
/// such as [annotating specific instructions with a comment][inst_comment] /// such as [annotating specific instructions with a comment][inst_comment]