pub struct Optimizer {
pub ret: NodeIndex,
/* private fields */
}Expand description
An optimizer that applies various analyses and optimization passes to the IR.
Fields§
§ret: NodeIndexThe single return block
Implementations§
Source§impl Optimizer
impl Optimizer
Sourcepub fn visit_operation(
&mut self,
op: &mut Operation,
visit_read: impl FnMut(&mut Self, &mut Variable),
visit_write: impl FnMut(&mut Self, &mut Variable),
)
pub fn visit_operation( &mut self, op: &mut Operation, visit_read: impl FnMut(&mut Self, &mut Variable), visit_write: impl FnMut(&mut Self, &mut Variable), )
Visit an operation with a set of read and write visitors. Each visitor will be called with each read or written to variable.
Sourcepub fn visit_operator(
&mut self,
op: &mut Operator,
visit_read: impl FnMut(&mut Self, &mut Variable),
visit_write: impl FnMut(&mut Self, &mut Variable),
)
pub fn visit_operator( &mut self, op: &mut Operator, visit_read: impl FnMut(&mut Self, &mut Variable), visit_write: impl FnMut(&mut Self, &mut Variable), )
Visit an operator with a set of read and write visitors. Each visitor will be called with each read or written to variable.
pub fn write_var(&mut self, var: &mut Variable)
pub fn find_writes_select(&mut self, select: &mut Select)
Source§impl Optimizer
impl Optimizer
Sourcepub fn analyze_liveness(&mut self)
pub fn analyze_liveness(&mut self)
Do a conservative block level liveness analysis
Source§impl Optimizer
impl Optimizer
Sourcepub fn new(expand: Scope, cube_dim: CubeDim, mode: ExecutionMode) -> Self
pub fn new(expand: Scope, cube_dim: CubeDim, mode: ExecutionMode) -> Self
Create a new optimizer with the scope, CubeDim and execution mode passed into the compiler.
Parses the scope and runs several optimization and analysis loops.
pub fn post_order(&self) -> Vec<NodeIndex>
pub fn reverse_post_order(&self) -> Vec<NodeIndex>
Sourcepub fn predecessors(&self, block: NodeIndex) -> Vec<NodeIndex>
pub fn predecessors(&self, block: NodeIndex) -> Vec<NodeIndex>
List of predecessor IDs of the block
Sourcepub fn successors(&self, block: NodeIndex) -> Vec<NodeIndex>
pub fn successors(&self, block: NodeIndex) -> Vec<NodeIndex>
List of successor IDs of the block
Sourcepub fn block(&self, block: NodeIndex) -> &BasicBlock
pub fn block(&self, block: NodeIndex) -> &BasicBlock
Reference to the BasicBlock with ID block
Sourcepub fn block_mut(&mut self, block: NodeIndex) -> &mut BasicBlock
pub fn block_mut(&mut self, block: NodeIndex) -> &mut BasicBlock
Reference to the BasicBlock with ID block
Sourcepub fn parse_scope(&mut self, scope: Scope) -> bool
pub fn parse_scope(&mut self, scope: Scope) -> bool
Recursively parse a scope into the graph
Sourcepub fn local_variable_id(&mut self, variable: &Variable) -> Option<(u16, u8)>
pub fn local_variable_id(&mut self, variable: &Variable) -> Option<(u16, u8)>
Gets the id and depth of the variable if it’s a Local and not atomic, None otherwise.
Sourcepub fn create_temporary(&self, item: Item) -> Variable
pub fn create_temporary(&self, item: Item) -> Variable
Create a temporary variable for use in the compiler. Counts backwards from u16::MAX to avoid Collisions with existing locals, since binding counter is no longer available.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Optimizer
impl !RefUnwindSafe for Optimizer
impl !Send for Optimizer
impl !Sync for Optimizer
impl Unpin for Optimizer
impl !UnwindSafe for Optimizer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)