Struct cranelift_frontend::Switch
source · pub struct Switch { /* private fields */ }
Expand description
Unlike with br_table
, Switch
cases may be sparse or non-0-based.
They emit efficient code using branches, jump tables, or a combination of both.
Example
let block0 = builder.create_block();
let block1 = builder.create_block();
let block2 = builder.create_block();
let fallback = builder.create_block();
let val = builder.ins().iconst(I32, 1);
let mut switch = Switch::new();
switch.set_entry(0, block0);
switch.set_entry(1, block1);
switch.set_entry(7, block2);
switch.emit(&mut builder, val, fallback);
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Switch
impl Send for Switch
impl Sync for Switch
impl Unpin for Switch
impl UnwindSafe for Switch
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more