mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 18:32:15 +00:00
257 lines
54 KiB
HTML
257 lines
54 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Cursor` trait in crate `cranelift_codegen`."><meta name="keywords" content="rust, rustlang, rust-lang, Cursor"><title>cranelift_codegen::cursor::Cursor - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../cranelift_codegen/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Trait Cursor</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.layout">layout</a><a href="#tymethod.layout_mut">layout_mut</a><a href="#tymethod.position">position</a><a href="#tymethod.set_position">set_position</a><a href="#tymethod.set_srcloc">set_srcloc</a><a href="#tymethod.srcloc">srcloc</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.after_inst">after_inst</a><a href="#method.at_bottom">at_bottom</a><a href="#method.at_first_insertion_point">at_first_insertion_point</a><a href="#method.at_first_inst">at_first_inst</a><a href="#method.at_inst">at_inst</a><a href="#method.at_last_inst">at_last_inst</a><a href="#method.at_position">at_position</a><a href="#method.at_top">at_top</a><a href="#method.current_ebb">current_ebb</a><a href="#method.current_inst">current_inst</a><a href="#method.goto_after_inst">goto_after_inst</a><a href="#method.goto_bottom">goto_bottom</a><a href="#method.goto_first_insertion_point">goto_first_insertion_point</a><a href="#method.goto_first_inst">goto_first_inst</a><a href="#method.goto_inst">goto_inst</a><a href="#method.goto_last_inst">goto_last_inst</a><a href="#method.goto_top">goto_top</a><a href="#method.insert_ebb">insert_ebb</a><a href="#method.insert_inst">insert_inst</a><a href="#method.next_ebb">next_ebb</a><a href="#method.next_inst">next_inst</a><a href="#method.prev_ebb">prev_ebb</a><a href="#method.prev_inst">prev_inst</a><a href="#method.remove_inst">remove_inst</a><a href="#method.remove_inst_and_step_back">remove_inst_and_step_back</a><a href="#method.with_srcloc">with_srcloc</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>cranelift_codegen</a>::<wbr><a href='index.html'>cursor</a></p><script>window.sidebarCurrent = {name: 'Cursor', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#25-564' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>cranelift_codegen</a>::<wbr><a href='index.html'>cursor</a>::<wbr><a class="trait" href=''>Cursor</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait Cursor {
|
||
fn <a href='#tymethod.position' class='fnname'>position</a>(&self) -> <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.set_position' class='fnname'>set_position</a>(&mut self, pos: <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a>);
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.srcloc' class='fnname'>srcloc</a>(&self) -> <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.set_srcloc' class='fnname'>set_srcloc</a>(&mut self, srcloc: <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a>);
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.layout' class='fnname'>layout</a>(&self) -> &<a class="struct" href="../../cranelift_codegen/ir/layout/struct.Layout.html" title="struct cranelift_codegen::ir::layout::Layout">Layout</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.layout_mut' class='fnname'>layout_mut</a>(&mut self) -> &mut <a class="struct" href="../../cranelift_codegen/ir/layout/struct.Layout.html" title="struct cranelift_codegen::ir::layout::Layout">Layout</a>;
|
||
|
||
fn <a href='#method.with_srcloc' class='fnname'>with_srcloc</a>(self, srcloc: <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a>) -> Self<br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.at_position' class='fnname'>at_position</a>(self, pos: <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a>) -> Self<br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.at_inst' class='fnname'>at_inst</a>(self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>) -> Self<br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.at_first_insertion_point' class='fnname'>at_first_insertion_point</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self<br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.at_first_inst' class='fnname'>at_first_inst</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self<br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.at_last_inst' class='fnname'>at_last_inst</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self<br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.after_inst' class='fnname'>after_inst</a>(self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>) -> Self<br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.at_top' class='fnname'>at_top</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self<br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.at_bottom' class='fnname'>at_bottom</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self<br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.current_ebb' class='fnname'>current_ebb</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.current_inst' class='fnname'>current_inst</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.goto_after_inst' class='fnname'>goto_after_inst</a>(&mut self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>) { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.goto_inst' class='fnname'>goto_inst</a>(&mut self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>) { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.goto_first_insertion_point' class='fnname'>goto_first_insertion_point</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.goto_first_inst' class='fnname'>goto_first_inst</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.goto_last_inst' class='fnname'>goto_last_inst</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.goto_top' class='fnname'>goto_top</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.goto_bottom' class='fnname'>goto_bottom</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.next_ebb' class='fnname'>next_ebb</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.prev_ebb' class='fnname'>prev_ebb</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.next_inst' class='fnname'>next_inst</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.prev_inst' class='fnname'>prev_inst</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.insert_inst' class='fnname'>insert_inst</a>(&mut self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>) { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.remove_inst' class='fnname'>remove_inst</a>(&mut self) -> <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.remove_inst_and_step_back' class='fnname'>remove_inst_and_step_back</a>(&mut self) -> <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.insert_ebb' class='fnname'>insert_ebb</a>(&mut self, new_ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) { ... }
|
||
}</pre></div><div class='docblock'><p>All cursor types implement the <code>Cursor</code> which provides common navigation operations.</p>
|
||
</div>
|
||
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.position' class='method'><code id='position.v'>fn <a href='#tymethod.position' class='fnname'>position</a>(&self) -> <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a></code></h3><div class='docblock'><p>Get the current cursor position.</p>
|
||
</div><h3 id='tymethod.set_position' class='method'><code id='set_position.v'>fn <a href='#tymethod.set_position' class='fnname'>set_position</a>(&mut self, pos: <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a>)</code></h3><div class='docblock'><p>Set the current position.</p>
|
||
</div><h3 id='tymethod.srcloc' class='method'><code id='srcloc.v'>fn <a href='#tymethod.srcloc' class='fnname'>srcloc</a>(&self) -> <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a></code></h3><div class='docblock'><p>Get the source location that should be assigned to new instructions.</p>
|
||
</div><h3 id='tymethod.set_srcloc' class='method'><code id='set_srcloc.v'>fn <a href='#tymethod.set_srcloc' class='fnname'>set_srcloc</a>(&mut self, srcloc: <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a>)</code></h3><div class='docblock'><p>Set the source location that should be assigned to new instructions.</p>
|
||
</div><h3 id='tymethod.layout' class='method'><code id='layout.v'>fn <a href='#tymethod.layout' class='fnname'>layout</a>(&self) -> &<a class="struct" href="../../cranelift_codegen/ir/layout/struct.Layout.html" title="struct cranelift_codegen::ir::layout::Layout">Layout</a></code></h3><div class='docblock'><p>Borrow a reference to the function layout that this cursor is navigating.</p>
|
||
</div><h3 id='tymethod.layout_mut' class='method'><code id='layout_mut.v'>fn <a href='#tymethod.layout_mut' class='fnname'>layout_mut</a>(&mut self) -> &mut <a class="struct" href="../../cranelift_codegen/ir/layout/struct.Layout.html" title="struct cranelift_codegen::ir::layout::Layout">Layout</a></code></h3><div class='docblock'><p>Borrow a mutable reference to the function layout that this cursor is navigating.</p>
|
||
</div></div><span class='loading-content'>Loading content...</span>
|
||
<h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.with_srcloc' class='method'><code id='with_srcloc.v'>fn <a href='#method.with_srcloc' class='fnname'>with_srcloc</a>(self, srcloc: <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a>) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Exchange this cursor for one with a set source location.</p>
|
||
<p>This is intended to be used as a builder method:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">srcloc</span>: <span class="ident">SourceLoc</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">pos</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">with_srcloc</span>(<span class="ident">srcloc</span>);
|
||
|
||
<span class="comment">// Use `pos`...</span>
|
||
}</pre></div>
|
||
</div><h3 id='method.at_position' class='method'><code id='at_position.v'>fn <a href='#method.at_position' class='fnname'>at_position</a>(self, pos: <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a>) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Rebuild this cursor positioned at <code>pos</code>.</p>
|
||
</div><h3 id='method.at_inst' class='method'><code id='at_inst.v'>fn <a href='#method.at_inst' class='fnname'>at_inst</a>(self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Rebuild this cursor positioned at <code>inst</code>.</p>
|
||
<p>This is intended to be used as a builder method:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">inst</span>: <span class="ident">Inst</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">pos</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">at_inst</span>(<span class="ident">inst</span>);
|
||
|
||
<span class="comment">// Use `pos`...</span>
|
||
}</pre></div>
|
||
</div><h3 id='method.at_first_insertion_point' class='method'><code id='at_first_insertion_point.v'>fn <a href='#method.at_first_insertion_point' class='fnname'>at_first_insertion_point</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Rebuild this cursor positioned at the first insertion point for <code>ebb</code>.
|
||
This differs from <code>at_first_inst</code> in that it doesn't assume that any
|
||
instructions have been inserted into <code>ebb</code> yet.</p>
|
||
<p>This is intended to be used as a builder method:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">ebb</span>: <span class="ident">Ebb</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">pos</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">at_first_insertion_point</span>(<span class="ident">ebb</span>);
|
||
|
||
<span class="comment">// Use `pos`...</span>
|
||
}</pre></div>
|
||
</div><h3 id='method.at_first_inst' class='method'><code id='at_first_inst.v'>fn <a href='#method.at_first_inst' class='fnname'>at_first_inst</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Rebuild this cursor positioned at the first instruction in <code>ebb</code>.</p>
|
||
<p>This is intended to be used as a builder method:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">ebb</span>: <span class="ident">Ebb</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">pos</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">at_first_inst</span>(<span class="ident">ebb</span>);
|
||
|
||
<span class="comment">// Use `pos`...</span>
|
||
}</pre></div>
|
||
</div><h3 id='method.at_last_inst' class='method'><code id='at_last_inst.v'>fn <a href='#method.at_last_inst' class='fnname'>at_last_inst</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Rebuild this cursor positioned at the last instruction in <code>ebb</code>.</p>
|
||
<p>This is intended to be used as a builder method:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">ebb</span>: <span class="ident">Ebb</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">pos</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">at_last_inst</span>(<span class="ident">ebb</span>);
|
||
|
||
<span class="comment">// Use `pos`...</span>
|
||
}</pre></div>
|
||
</div><h3 id='method.after_inst' class='method'><code id='after_inst.v'>fn <a href='#method.after_inst' class='fnname'>after_inst</a>(self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Rebuild this cursor positioned after <code>inst</code>.</p>
|
||
<p>This is intended to be used as a builder method:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">inst</span>: <span class="ident">Inst</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">pos</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">after_inst</span>(<span class="ident">inst</span>);
|
||
|
||
<span class="comment">// Use `pos`...</span>
|
||
}</pre></div>
|
||
</div><h3 id='method.at_top' class='method'><code id='at_top.v'>fn <a href='#method.at_top' class='fnname'>at_top</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Rebuild this cursor positioned at the top of <code>ebb</code>.</p>
|
||
<p>This is intended to be used as a builder method:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">ebb</span>: <span class="ident">Ebb</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">pos</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">at_top</span>(<span class="ident">ebb</span>);
|
||
|
||
<span class="comment">// Use `pos`...</span>
|
||
}</pre></div>
|
||
</div><h3 id='method.at_bottom' class='method'><code id='at_bottom.v'>fn <a href='#method.at_bottom' class='fnname'>at_bottom</a>(self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>) -> Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></h3><div class='docblock'><p>Rebuild this cursor positioned at the bottom of <code>ebb</code>.</p>
|
||
<p>This is intended to be used as a builder method:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">ebb</span>: <span class="ident">Ebb</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">pos</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">at_bottom</span>(<span class="ident">ebb</span>);
|
||
|
||
<span class="comment">// Use `pos`...</span>
|
||
}</pre></div>
|
||
</div><h3 id='method.current_ebb' class='method'><code id='current_ebb.v'>fn <a href='#method.current_ebb' class='fnname'>current_ebb</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>></code></h3><div class='docblock'><p>Get the EBB corresponding to the current position.</p>
|
||
</div><h3 id='method.current_inst' class='method'><code id='current_inst.v'>fn <a href='#method.current_inst' class='fnname'>current_inst</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>></code></h3><div class='docblock'><p>Get the instruction corresponding to the current position, if any.</p>
|
||
</div><h3 id='method.goto_after_inst' class='method'><code id='goto_after_inst.v'>fn <a href='#method.goto_after_inst' class='fnname'>goto_after_inst</a>(&mut self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>)</code></h3><div class='docblock'><p>Go to the position after a specific instruction, which must be inserted
|
||
in the layout. New instructions will be inserted after <code>inst</code>.</p>
|
||
</div><h3 id='method.goto_inst' class='method'><code id='goto_inst.v'>fn <a href='#method.goto_inst' class='fnname'>goto_inst</a>(&mut self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>)</code></h3><div class='docblock'><p>Go to a specific instruction which must be inserted in the layout.
|
||
New instructions will be inserted before <code>inst</code>.</p>
|
||
</div><h3 id='method.goto_first_insertion_point' class='method'><code id='goto_first_insertion_point.v'>fn <a href='#method.goto_first_insertion_point' class='fnname'>goto_first_insertion_point</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>)</code></h3><div class='docblock'><p>Go to the position for inserting instructions at the beginning of <code>ebb</code>,
|
||
which unlike <code>goto_first_inst</code> doesn't assume that any instructions have
|
||
been inserted into <code>ebb</code> yet.</p>
|
||
</div><h3 id='method.goto_first_inst' class='method'><code id='goto_first_inst.v'>fn <a href='#method.goto_first_inst' class='fnname'>goto_first_inst</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>)</code></h3><div class='docblock'><p>Go to the first instruction in <code>ebb</code>.</p>
|
||
</div><h3 id='method.goto_last_inst' class='method'><code id='goto_last_inst.v'>fn <a href='#method.goto_last_inst' class='fnname'>goto_last_inst</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>)</code></h3><div class='docblock'><p>Go to the last instruction in <code>ebb</code>.</p>
|
||
</div><h3 id='method.goto_top' class='method'><code id='goto_top.v'>fn <a href='#method.goto_top' class='fnname'>goto_top</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>)</code></h3><div class='docblock'><p>Go to the top of <code>ebb</code> which must be inserted into the layout.
|
||
At this position, instructions cannot be inserted, but <code>next_inst()</code> will move to the first
|
||
instruction in <code>ebb</code>.</p>
|
||
</div><h3 id='method.goto_bottom' class='method'><code id='goto_bottom.v'>fn <a href='#method.goto_bottom' class='fnname'>goto_bottom</a>(&mut self, ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>)</code></h3><div class='docblock'><p>Go to the bottom of <code>ebb</code> which must be inserted into the layout.
|
||
At this position, inserted instructions will be appended to <code>ebb</code>.</p>
|
||
</div><h3 id='method.next_ebb' class='method'><code id='next_ebb.v'>fn <a href='#method.next_ebb' class='fnname'>next_ebb</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>></code></h3><div class='docblock'><p>Go to the top of the next EBB in layout order and return it.</p>
|
||
<ul>
|
||
<li>If the cursor wasn't pointing at anything, go to the top of the first EBB in the
|
||
function.</li>
|
||
<li>If there are no more EBBs, leave the cursor pointing at nothing and return <code>None</code>.</li>
|
||
</ul>
|
||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||
<p>The <code>next_ebb()</code> method is intended for iterating over the EBBs in layout order:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cursor</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>);
|
||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">ebb</span>) <span class="op">=</span> <span class="ident">cursor</span>.<span class="ident">next_ebb</span>() {
|
||
<span class="comment">// Edit ebb.</span>
|
||
}
|
||
}</pre></div>
|
||
</div><h3 id='method.prev_ebb' class='method'><code id='prev_ebb.v'>fn <a href='#method.prev_ebb' class='fnname'>prev_ebb</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>></code></h3><div class='docblock'><p>Go to the bottom of the previous EBB in layout order and return it.</p>
|
||
<ul>
|
||
<li>If the cursor wasn't pointing at anything, go to the bottom of the last EBB in the
|
||
function.</li>
|
||
<li>If there are no more EBBs, leave the cursor pointing at nothing and return <code>None</code>.</li>
|
||
</ul>
|
||
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
|
||
<p>The <code>prev_ebb()</code> method is intended for iterating over the EBBs in backwards layout order:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cursor</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>);
|
||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">ebb</span>) <span class="op">=</span> <span class="ident">cursor</span>.<span class="ident">prev_ebb</span>() {
|
||
<span class="comment">// Edit ebb.</span>
|
||
}
|
||
}</pre></div>
|
||
</div><h3 id='method.next_inst' class='method'><code id='next_inst.v'>fn <a href='#method.next_inst' class='fnname'>next_inst</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>></code></h3><div class='docblock'><p>Move to the next instruction in the same EBB and return it.</p>
|
||
<ul>
|
||
<li>If the cursor was positioned before an EBB, go to the first instruction in that EBB.</li>
|
||
<li>If there are no more instructions in the EBB, go to the <code>After(ebb)</code> position and return
|
||
<code>None</code>.</li>
|
||
<li>If the cursor wasn't pointing anywhere, keep doing that.</li>
|
||
</ul>
|
||
<p>This method will never move the cursor to a different EBB.</p>
|
||
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
|
||
<p>The <code>next_inst()</code> method is intended for iterating over the instructions in an EBB like
|
||
this:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_ebb</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">ebb</span>: <span class="ident">Ebb</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cursor</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">at_top</span>(<span class="ident">ebb</span>);
|
||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">inst</span>) <span class="op">=</span> <span class="ident">cursor</span>.<span class="ident">next_inst</span>() {
|
||
<span class="comment">// Edit instructions...</span>
|
||
}
|
||
}</pre></div>
|
||
<p>The loop body can insert and remove instructions via the cursor.</p>
|
||
<p>Iterating over all the instructions in a function looks like this:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_func</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cursor</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>);
|
||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">ebb</span>) <span class="op">=</span> <span class="ident">cursor</span>.<span class="ident">next_ebb</span>() {
|
||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">inst</span>) <span class="op">=</span> <span class="ident">cursor</span>.<span class="ident">next_inst</span>() {
|
||
<span class="comment">// Edit instructions...</span>
|
||
}
|
||
}
|
||
}</pre></div>
|
||
</div><h3 id='method.prev_inst' class='method'><code id='prev_inst.v'>fn <a href='#method.prev_inst' class='fnname'>prev_inst</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>></code></h3><div class='docblock'><p>Move to the previous instruction in the same EBB and return it.</p>
|
||
<ul>
|
||
<li>If the cursor was positioned after an EBB, go to the last instruction in that EBB.</li>
|
||
<li>If there are no more instructions in the EBB, go to the <code>Before(ebb)</code> position and return
|
||
<code>None</code>.</li>
|
||
<li>If the cursor wasn't pointing anywhere, keep doing that.</li>
|
||
</ul>
|
||
<p>This method will never move the cursor to a different EBB.</p>
|
||
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
|
||
<p>The <code>prev_inst()</code> method is intended for iterating backwards over the instructions in an
|
||
EBB like this:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">edit_ebb</span>(<span class="ident">func</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Function</span>, <span class="ident">ebb</span>: <span class="ident">Ebb</span>) {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cursor</span> <span class="op">=</span> <span class="ident">FuncCursor</span>::<span class="ident">new</span>(<span class="ident">func</span>).<span class="ident">at_bottom</span>(<span class="ident">ebb</span>);
|
||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">inst</span>) <span class="op">=</span> <span class="ident">cursor</span>.<span class="ident">prev_inst</span>() {
|
||
<span class="comment">// Edit instructions...</span>
|
||
}
|
||
}</pre></div>
|
||
</div><h3 id='method.insert_inst' class='method'><code id='insert_inst.v'>fn <a href='#method.insert_inst' class='fnname'>insert_inst</a>(&mut self, inst: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>)</code></h3><div class='docblock'><p>Insert an instruction at the current position.</p>
|
||
<ul>
|
||
<li>If pointing at an instruction, the new instruction is inserted before the current
|
||
instruction.</li>
|
||
<li>If pointing at the bottom of an EBB, the new instruction is appended to the EBB.</li>
|
||
<li>Otherwise panic.</li>
|
||
</ul>
|
||
<p>In either case, the cursor is not moved, such that repeated calls to <code>insert_inst()</code> causes
|
||
instructions to appear in insertion order in the EBB.</p>
|
||
</div><h3 id='method.remove_inst' class='method'><code id='remove_inst.v'>fn <a href='#method.remove_inst' class='fnname'>remove_inst</a>(&mut self) -> <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a></code></h3><div class='docblock'><p>Remove the instruction under the cursor.</p>
|
||
<p>The cursor is left pointing at the position following the current instruction.</p>
|
||
<p>Return the instruction that was removed.</p>
|
||
</div><h3 id='method.remove_inst_and_step_back' class='method'><code id='remove_inst_and_step_back.v'>fn <a href='#method.remove_inst_and_step_back' class='fnname'>remove_inst_and_step_back</a>(&mut self) -> <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a></code></h3><div class='docblock'><p>Remove the instruction under the cursor.</p>
|
||
<p>The cursor is left pointing at the position preceding the current instruction.</p>
|
||
<p>Return the instruction that was removed.</p>
|
||
</div><h3 id='method.insert_ebb' class='method'><code id='insert_ebb.v'>fn <a href='#method.insert_ebb' class='fnname'>insert_ebb</a>(&mut self, new_ebb: <a class="struct" href="../../cranelift_codegen/ir/entities/struct.Ebb.html" title="struct cranelift_codegen::ir::entities::Ebb">Ebb</a>)</code></h3><div class='docblock'><p>Insert an EBB at the current position and switch to it.</p>
|
||
<p>As far as possible, this method behaves as if the EBB header were an instruction inserted
|
||
at the current position.</p>
|
||
<ul>
|
||
<li>If the cursor is pointing at an existing instruction, <em>the current EBB is split in two</em>
|
||
and the current instruction becomes the first instruction in the inserted EBB.</li>
|
||
<li>If the cursor points at the bottom of an EBB, the new EBB is inserted after the current
|
||
one, and moved to the bottom of the new EBB where instructions can be appended.</li>
|
||
<li>If the cursor points to the top of an EBB, the new EBB is inserted above the current one.</li>
|
||
<li>If the cursor is not pointing at anything, the new EBB is placed last in the layout.</li>
|
||
</ul>
|
||
<p>This means that it is always valid to call this method, and it always leaves the cursor in
|
||
a state that will insert instructions into the new EBB.</p>
|
||
</div></div><span class='loading-content'>Loading content...</span>
|
||
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-Cursor' class='impl'><code class='in-band'>impl<'f> Cursor for <a class="struct" href="../../cranelift_codegen/cursor/struct.EncCursor.html" title="struct cranelift_codegen::cursor::EncCursor">EncCursor</a><'f></code><a href='#impl-Cursor' class='anchor'></a><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#705-729' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.position' class="method hidden"><code id='position.v-1'>fn <a href='#method.position' class='fnname'>position</a>(&self) -> <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a></code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#706-708' title='goto source code'>[src]</a></h4><h4 id='method.set_position' class="method hidden"><code id='set_position.v-1'>fn <a href='#method.set_position' class='fnname'>set_position</a>(&mut self, pos: <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a>)</code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#710-712' title='goto source code'>[src]</a></h4><h4 id='method.srcloc' class="method hidden"><code id='srcloc.v-1'>fn <a href='#method.srcloc' class='fnname'>srcloc</a>(&self) -> <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a></code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#714-716' title='goto source code'>[src]</a></h4><h4 id='method.set_srcloc' class="method hidden"><code id='set_srcloc.v-1'>fn <a href='#method.set_srcloc' class='fnname'>set_srcloc</a>(&mut self, srcloc: <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a>)</code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#718-720' title='goto source code'>[src]</a></h4><h4 id='method.layout' class="method hidden"><code id='layout.v-1'>fn <a href='#method.layout' class='fnname'>layout</a>(&self) -> &<a class="struct" href="../../cranelift_codegen/ir/layout/struct.Layout.html" title="struct cranelift_codegen::ir::layout::Layout">Layout</a></code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#722-724' title='goto source code'>[src]</a></h4><h4 id='method.layout_mut' class="method hidden"><code id='layout_mut.v-1'>fn <a href='#method.layout_mut' class='fnname'>layout_mut</a>(&mut self) -> &mut <a class="struct" href="../../cranelift_codegen/ir/layout/struct.Layout.html" title="struct cranelift_codegen::ir::layout::Layout">Layout</a></code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#726-728' title='goto source code'>[src]</a></h4></div><h3 id='impl-Cursor-1' class='impl'><code class='in-band'>impl<'f> Cursor for <a class="struct" href="../../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a><'f></code><a href='#impl-Cursor-1' class='anchor'></a><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#602-626' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.position-1' class="method hidden"><code id='position.v-2'>fn <a href='#method.position-1' class='fnname'>position</a>(&self) -> <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a></code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#603-605' title='goto source code'>[src]</a></h4><h4 id='method.set_position-1' class="method hidden"><code id='set_position.v-2'>fn <a href='#method.set_position-1' class='fnname'>set_position</a>(&mut self, pos: <a class="enum" href="../../cranelift_codegen/cursor/enum.CursorPosition.html" title="enum cranelift_codegen::cursor::CursorPosition">CursorPosition</a>)</code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#607-609' title='goto source code'>[src]</a></h4><h4 id='method.srcloc-1' class="method hidden"><code id='srcloc.v-2'>fn <a href='#method.srcloc-1' class='fnname'>srcloc</a>(&self) -> <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a></code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#611-613' title='goto source code'>[src]</a></h4><h4 id='method.set_srcloc-1' class="method hidden"><code id='set_srcloc.v-2'>fn <a href='#method.set_srcloc-1' class='fnname'>set_srcloc</a>(&mut self, srcloc: <a class="struct" href="../../cranelift_codegen/ir/struct.SourceLoc.html" title="struct cranelift_codegen::ir::SourceLoc">SourceLoc</a>)</code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#615-617' title='goto source code'>[src]</a></h4><h4 id='method.layout-1' class="method hidden"><code id='layout.v-2'>fn <a href='#method.layout-1' class='fnname'>layout</a>(&self) -> &<a class="struct" href="../../cranelift_codegen/ir/layout/struct.Layout.html" title="struct cranelift_codegen::ir::layout::Layout">Layout</a></code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#619-621' title='goto source code'>[src]</a></h4><h4 id='method.layout_mut-1' class="method hidden"><code id='layout_mut.v-2'>fn <a href='#method.layout_mut-1' class='fnname'>layout_mut</a>(&mut self) -> &mut <a class="struct" href="../../cranelift_codegen/ir/layout/struct.Layout.html" title="struct cranelift_codegen::ir::layout::Layout">Layout</a></code><a class='srclink' href='../../src/cranelift_codegen/cursor.rs.html#623-625' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
|
||
src="../../implementors/cranelift_codegen/cursor/trait.Cursor.js">
|
||
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "cranelift_codegen";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html> |