From a41cc668af372bc6df83bf6ae988a8ba6e0bd92c Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 22 Aug 2022 08:57:10 -0700 Subject: [PATCH] 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. --- cranelift/codegen/src/ir/entities.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cranelift/codegen/src/ir/entities.rs b/cranelift/codegen/src/ir/entities.rs index ea113397ad..7418b84460 100644 --- a/cranelift/codegen/src/ir/entities.rs +++ b/cranelift/codegen/src/ir/entities.rs @@ -88,7 +88,10 @@ impl Value { /// /// Most usage of `Inst` is internal. `Inst`ructions are returned by /// [`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`, /// such as [annotating specific instructions with a comment][inst_comment]