pub struct Function {
pub explicit_params: Vec<Value>,
pub implicit_params: Vec<Value>,
pub memories: HashMap<Id, MemoryBlock>,
pub graph: StableDiGraph<BasicBlock, u32>,
pub root: NodeIndex,
pub ret: NodeIndex,
pub return_value: Option<Value>,
/* private fields */
}Fields§
§explicit_params: Vec<Value>Explicit parameters passed to the function, i.e. the inputs to a closure
implicit_params: Vec<Value>Implicit parameters passed to the function, i.e. kernel args, closure captures
memories: HashMap<Id, MemoryBlock>§graph: StableDiGraph<BasicBlock, u32>§root: NodeIndex§ret: NodeIndexThe single return block
return_value: Option<Value>The return value, if any
Implementations§
Source§impl Function
impl Function
Sourcepub fn analysis<A: Analysis + Any>(&mut self, state: &GlobalState) -> Rc<A>
pub fn analysis<A: Analysis + Any>(&mut self, state: &GlobalState) -> Rc<A>
Fetch an analysis if cached, or run it if not.
Sourcepub fn invalidate_analysis<A: Analysis + Any>(&self)
pub fn invalidate_analysis<A: Analysis + Any>(&self)
Invalidate an analysis by removing it from the cache. The analysis is rerun when requested again.
Sourcepub fn invalidate_structure(&self)
pub fn invalidate_structure(&self)
Invalidate all analyses that rely on the structure of the control flow graph.
Source§impl Function
impl Function
Sourcepub fn local_variable_id(&self, value: &Value) -> Option<Id>
pub fn local_variable_id(&self, value: &Value) -> Option<Id>
Gets the id of the variable if it’s a destructurable Local and not atomic, None
otherwise.
Sourcepub fn local_memory_id(&self, value: &Value) -> Option<Id>
pub fn local_memory_id(&self, value: &Value) -> Option<Id>
Gets the id of the variable if it’s a Local memory and not atomic, None otherwise.
Unlike Function::local_variable_id, this includes non-destructurable locals such as
arrays, so it can be used by backends that allocate and free those memories.
Source§impl Function
impl Function
pub fn visit_out( &mut self, val: &mut Option<Value>, visit_write: impl FnMut(&mut Self, &mut Value), )
Sourcepub fn visit_instruction_memory_writes(
&mut self,
state: &GlobalState,
inst: &Instruction,
visit_write: impl FnMut(&mut Self, &MemoryBlock),
)
pub fn visit_instruction_memory_writes( &mut self, state: &GlobalState, inst: &Instruction, visit_write: impl FnMut(&mut Self, &MemoryBlock), )
Visit an instruction with only a write visitor. Visits both out and any pointer writes.
pub fn visit_instruction_memory_reads( &mut self, state: &GlobalState, inst: &Instruction, visit_read: impl FnMut(&mut Self, &MemoryBlock), )
Sourcepub fn visit_instruction(
&mut self,
state: &GlobalState,
inst: &mut Instruction,
visit_read: impl FnMut(&mut Self, &mut Value),
visit_write: impl FnMut(&mut Self, &mut Value),
)
pub fn visit_instruction( &mut self, state: &GlobalState, inst: &mut Instruction, visit_read: impl FnMut(&mut Self, &mut Value), visit_write: impl FnMut(&mut Self, &mut Value), )
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_operation(
&mut self,
state: &GlobalState,
op: &mut Operation,
visit_read: impl FnMut(&mut Self, &mut Value),
)
pub fn visit_operation( &mut self, state: &GlobalState, op: &mut Operation, visit_read: impl FnMut(&mut Self, &mut Value), )
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_control_flow(
&mut self,
op: &mut ControlFlow,
visit_read: impl FnMut(&mut Self, &mut Value),
)
pub fn visit_control_flow( &mut self, op: &mut ControlFlow, visit_read: impl FnMut(&mut Self, &mut Value), )
Visit a control flow finisher with a set of read and write visitors. Each visitor will be called with each read or written to variable.
Source§impl Function
impl Function
Sourcepub fn place_phi_nodes(&mut self, state: &GlobalState)
pub fn place_phi_nodes(&mut self, state: &GlobalState)
Places a phi node for each live variable at each frontier
Sourcepub fn insert_phi(&mut self, block: NodeIndex, id: Id, item: Type)
pub fn insert_phi(&mut self, block: NodeIndex, id: Id, item: Type)
Insert a phi node for variable id at block
Sourcepub fn destructurable_local_memories(&self) -> HashMap<Id, MemoryBlock>
pub fn destructurable_local_memories(&self) -> HashMap<Id, MemoryBlock>
Returns all pointers to local stack space that are destructurable
Source§impl Function
impl Function
Sourcepub fn parse_scope(&mut self, state: &GlobalState, scope: Scope) -> bool
pub fn parse_scope(&mut self, state: &GlobalState, scope: Scope) -> bool
Recursively parse a scope into the graph
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 breadth_first_dominators(&self) -> Vec<NodeIndex>
pub fn breadth_first_dominators(&self) -> Vec<NodeIndex>
Return the breadth-first list of nodes along the dominator tree. This is useful for generating the blocks in a human-readable-ish order that follows the Vulkan spec (dominators before dominated).
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
pub fn is_unreachable(&self, block: NodeIndex) -> bool
pub fn all_params(&self) -> impl Iterator<Item = Value>
pub fn create_local_mut(&mut self, state: &GlobalState, value_ty: Type) -> Value
Trait Implementations§
Source§impl Deref for Function
impl Deref for Function
Source§type Target = StableGraph<BasicBlock, u32>
type Target = StableGraph<BasicBlock, u32>
Auto Trait Implementations§
impl !RefUnwindSafe for Function
impl !Send for Function
impl !Sync for Function
impl !UnwindSafe for Function
impl Freeze for Function
impl Unpin for Function
impl UnsafeUnpin for Function
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
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>
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>
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