pub struct IrModule {
pub name: String,
pub inputs: Vec<IrValue>,
pub outputs: Vec<IrValue>,
pub blocks: IndexMap<BlockId, BasicBlock>,
pub entry_block: BlockId,
pub values: IndexMap<IrValue, ValueDef>,
pub types: IndexMap<IrType, TypeDef>,
}Expand description
Intermediate Representation of a computation
Fields§
§name: StringModule name
inputs: Vec<IrValue>Input values
outputs: Vec<IrValue>Output values
blocks: IndexMap<BlockId, BasicBlock>Basic blocks containing instructions
entry_block: BlockIdEntry block
values: IndexMap<IrValue, ValueDef>Value definitions
types: IndexMap<IrType, TypeDef>Type definitions
Implementations§
Source§impl IrModule
impl IrModule
Sourcepub fn add_value_external(&mut self, def: ValueDef) -> IrValue
pub fn add_value_external(&mut self, def: ValueDef) -> IrValue
Add a value (for external access)
Sourcepub fn get_block(&self, id: BlockId) -> Option<&BasicBlock>
pub fn get_block(&self, id: BlockId) -> Option<&BasicBlock>
Get a block by ID
Sourcepub fn get_block_mut(&mut self, id: BlockId) -> Option<&mut BasicBlock>
pub fn get_block_mut(&mut self, id: BlockId) -> Option<&mut BasicBlock>
Get a mutable block by ID
Sourcepub fn get_function(&self, _name: &str) -> Option<&BasicBlock>
pub fn get_function(&self, _name: &str) -> Option<&BasicBlock>
Get a function-like interface for debugging compatibility For now, treat the entry block as the main “function”
Sourcepub fn inline_small_functions(&mut self) -> JitResult<()>
pub fn inline_small_functions(&mut self) -> JitResult<()>
Inline small functions (placeholder implementation)
Sourcepub fn functions_mut(&mut self) -> impl Iterator<Item = &mut BasicBlock>
pub fn functions_mut(&mut self) -> impl Iterator<Item = &mut BasicBlock>
Get all functions in the module (returns an iterator over blocks as functions)
Sourcepub fn instructions(&self) -> impl Iterator<Item = &Instruction>
pub fn instructions(&self) -> impl Iterator<Item = &Instruction>
Get all instructions in the module
Sourcepub fn instructions_mut(&mut self) -> impl Iterator<Item = &mut Instruction>
pub fn instructions_mut(&mut self) -> impl Iterator<Item = &mut Instruction>
Get all instructions in the module (mutable)
Sourcepub fn retain_instructions<F>(&mut self, predicate: F)
pub fn retain_instructions<F>(&mut self, predicate: F)
Retain instructions that satisfy the predicate
Sourcepub fn remove_unused_functions(&mut self) -> JitResult<()>
pub fn remove_unused_functions(&mut self) -> JitResult<()>
Remove unused functions (placeholder implementation)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IrModule
impl RefUnwindSafe for IrModule
impl Send for IrModule
impl Sync for IrModule
impl Unpin for IrModule
impl UnsafeUnpin for IrModule
impl UnwindSafe for IrModule
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more