pub struct BasicBlock {
pub label: Option<String>,
pub instructions: Vec<Instruction>,
}Expand description
A basic block of PTX instructions.
Each block optionally begins with a label and contains a linear sequence
of instructions. Control flow between blocks is expressed through
Instruction::Branch and Instruction::Label instructions.
§Examples
use oxicuda_ptx::ir::{BasicBlock, Instruction};
let block = BasicBlock {
label: Some("loop_body".to_string()),
instructions: vec![
Instruction::Comment("loop iteration".to_string()),
],
};
assert_eq!(block.label.as_deref(), Some("loop_body"));Fields§
§label: Option<String>Optional label for this block (used as a branch target).
instructions: Vec<Instruction>The sequence of instructions in this block.
Implementations§
Source§impl BasicBlock
impl BasicBlock
Sourcepub fn with_label(label: impl Into<String>) -> Self
pub fn with_label(label: impl Into<String>) -> Self
Creates a new empty basic block with the given label.
Sourcepub fn push(&mut self, inst: Instruction)
pub fn push(&mut self, inst: Instruction)
Appends an instruction to this block.
Trait Implementations§
Source§impl Clone for BasicBlock
impl Clone for BasicBlock
Source§fn clone(&self) -> BasicBlock
fn clone(&self) -> BasicBlock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BasicBlock
impl Debug for BasicBlock
Auto Trait Implementations§
impl Freeze for BasicBlock
impl RefUnwindSafe for BasicBlock
impl Send for BasicBlock
impl Sync for BasicBlock
impl Unpin for BasicBlock
impl UnsafeUnpin for BasicBlock
impl UnwindSafe for BasicBlock
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