pub struct FunctionMIR {
pub id: FunctionId,
pub name: Symbol,
pub params: Vec<Local>,
pub return_ty: Ty,
pub locals: Vec<LocalDecl>,
pub basic_blocks: Vec<BasicBlock>,
pub attributes: FunctionAttributes,
pub span: Span,
}Expand description
Complete MIR for a function
Fields§
§id: FunctionIdFunction identifier
name: SymbolFunction name
params: Vec<Local>Parameter locals (indices into locals array)
return_ty: TyReturn type
locals: Vec<LocalDecl>All local variables (including params and temporaries)
basic_blocks: Vec<BasicBlock>Basic blocks (indexed by BasicBlockId)
attributes: FunctionAttributesFunction attributes for code generation decisions
span: SpanSource span
Implementations§
Source§impl FunctionMIR
impl FunctionMIR
Sourcepub fn new(id: FunctionId, name: Symbol, return_ty: Ty, span: Span) -> Self
pub fn new(id: FunctionId, name: Symbol, return_ty: Ty, span: Span) -> Self
Create a new function MIR
Sourcepub fn with_attributes(
id: FunctionId,
name: Symbol,
return_ty: Ty,
attributes: FunctionAttributes,
span: Span,
) -> Self
pub fn with_attributes( id: FunctionId, name: Symbol, return_ty: Ty, attributes: FunctionAttributes, span: Span, ) -> Self
Create a new function MIR with attributes
Sourcepub fn is_gpu_kernel(&self) -> bool
pub fn is_gpu_kernel(&self) -> bool
Check if this function is a GPU kernel
Sourcepub fn add_block(&mut self, block: BasicBlock) -> BasicBlockId
pub fn add_block(&mut self, block: BasicBlock) -> BasicBlockId
Add a new basic block
Sourcepub fn block(&self, id: BasicBlockId) -> &BasicBlock
pub fn block(&self, id: BasicBlockId) -> &BasicBlock
Get a basic block by ID
Sourcepub fn block_mut(&mut self, id: BasicBlockId) -> &mut BasicBlock
pub fn block_mut(&mut self, id: BasicBlockId) -> &mut BasicBlock
Get a mutable basic block by ID
Trait Implementations§
Source§impl Clone for FunctionMIR
impl Clone for FunctionMIR
Source§fn clone(&self) -> FunctionMIR
fn clone(&self) -> FunctionMIR
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 moreAuto Trait Implementations§
impl Freeze for FunctionMIR
impl RefUnwindSafe for FunctionMIR
impl Send for FunctionMIR
impl Sync for FunctionMIR
impl Unpin for FunctionMIR
impl UnwindSafe for FunctionMIR
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