pub struct SwitchOp { /* private fields */ }Expand description
§Attribute(s):
Note: Only attributes defined directly as part of this operation are listed here. There may be others, not listed here, defined by interface implementations.
| Name | Static Name Identifier | Type |
|---|---|---|
scf_switch_cases | ATTR_KEY_SCF_SWITCH_CASES | IntegerVecAttr |
Implementations§
Source§impl SwitchOp
impl SwitchOp
Sourcepub fn get_attr_scf_switch_cases<'a>(
&self,
ctx: &'a Context,
) -> Option<Ref<'a, IntegerVecAttr>>
pub fn get_attr_scf_switch_cases<'a>( &self, ctx: &'a Context, ) -> Option<Ref<'a, IntegerVecAttr>>
Get a Ref to the value of the attribute named scf_switch_cases.
The Ref is a borrow of the containing Operation object.
Sourcepub fn set_attr_scf_switch_cases(&self, ctx: &Context, value: IntegerVecAttr)
pub fn set_attr_scf_switch_cases(&self, ctx: &Context, value: IntegerVecAttr)
Set the value of the attribute named scf_switch_cases.
Source§impl SwitchOp
impl SwitchOp
pub fn new(ctx: &mut Context, results: Vec<TypeHandle>, value: Value) -> Self
pub fn value(&self, ctx: &Context) -> Value
pub fn default_region(&self, ctx: &Context) -> Ptr<Region>
pub fn default_block(&self, ctx: &Context) -> Ptr<BasicBlock>
pub fn case_regions(&self, ctx: &Context) -> Vec<Ptr<Region>>
pub fn case_blocks(&self, ctx: &Context) -> Vec<Ptr<BasicBlock>>
pub fn append_case_block(&self, ctx: &mut Context) -> Ptr<BasicBlock>
pub fn cases(&self, ctx: &Context) -> Vec<(IntegerAttr, Ptr<BasicBlock>)>
pub fn cases_regions(&self, ctx: &Context) -> Vec<(IntegerAttr, Ptr<Region>)>
pub fn cases_values(&self, ctx: &Context) -> Vec<IntegerAttr>
pub fn get_case_destinations(&self, ctx: &Context) -> Vec<Ptr<BasicBlock>>
pub fn set_attr_cases( &self, ctx: &Context, cases: impl IntoIterator<Item = IntegerAttr>, )
pub fn results(&self, ctx: &Context) -> Vec<Value>
pub fn result_types(&self, ctx: &Context) -> Vec<TypeHandle>
Trait Implementations§
Source§impl CanonicalizeInterface for SwitchOp
impl CanonicalizeInterface for SwitchOp
Source§impl ConditionallySpeculatable for SwitchOp
impl ConditionallySpeculatable for SwitchOp
impl Copy for SwitchOp
impl Eq for SwitchOp
Source§impl MemoryEffectsOp for SwitchOp
impl MemoryEffectsOp for SwitchOp
Source§impl MemorySSARegionOpInterface for SwitchOp
impl MemorySSARegionOpInterface for SwitchOp
Source§fn setup_memory_ssa(
&self,
ctx: &Context,
_state: &mut MemorySSAContext,
reaching_def: MemoryValue,
_has_memory_defs: bool,
regions_to_process: &mut SmallMap<Ptr<Region>, MemoryValue, 2>,
)
fn setup_memory_ssa( &self, ctx: &Context, _state: &mut MemorySSAContext, reaching_def: MemoryValue, _has_memory_defs: bool, regions_to_process: &mut SmallMap<Ptr<Region>, MemoryValue, 2>, )
Called before descending into nested regions.
reaching_def is the state of the memory on entry to this op.
Populate regions_to_process with the reaching def each region starts with.Source§fn finalize_memory_ssa(
&self,
ctx: &Context,
_state: &mut MemorySSAContext,
entry_reaching_def: MemoryValue,
has_memory_defs: bool,
_reaching_at_region_entry: &HMap<Ptr<Region>, MemoryValue>,
reaching_at_block_end: &HMap<Ptr<BasicBlock>, MemoryValue>,
_region_phis: &mut SmallMap<Ptr<Region>, RegionMemoryPhiInputs, 2>,
) -> RegionMemoryValue
fn finalize_memory_ssa( &self, ctx: &Context, _state: &mut MemorySSAContext, entry_reaching_def: MemoryValue, has_memory_defs: bool, _reaching_at_region_entry: &HMap<Ptr<Region>, MemoryValue>, reaching_at_block_end: &HMap<Ptr<BasicBlock>, MemoryValue>, _region_phis: &mut SmallMap<Ptr<Region>, RegionMemoryPhiInputs, 2>, ) -> RegionMemoryValue
Called after reaching defs are computed for all regions.
Returns the new reaching def at the op’s exit.
If values need to be merged at the start of a nested region, the input values must be added
to
region_phis. This will insert a memory phi at the beginning of the region’s entry block,
with the result value being the one added to regions_to_process in setup_memory_ssa.fn verify(_op: &dyn Op, _ctx: &Context) -> Result<()>where
Self: Sized,
Source§impl NOpdsInterface<1> for SwitchOp
impl NOpdsInterface<1> for SwitchOp
Source§fn operand_type_i(&self, ctx: &Context, i: LessThanN<N>) -> TypeHandle
fn operand_type_i(&self, ctx: &Context, i: LessThanN<N>) -> TypeHandle
Get the type of the
i’th operand.Source§impl Op for SwitchOp
impl Op for SwitchOp
Source§fn get_operation(&self) -> Ptr<Operation>
fn get_operation(&self) -> Ptr<Operation>
Get the underlying IR Operation
Source§fn get_opid_static() -> OpId
fn get_opid_static() -> OpId
Get this Op’s OpId, without self reference.
Source§fn get_concrete_op_info() -> (fn(Ptr<Operation>) -> OpBox, TypeId)where
Self: Sized,
fn get_concrete_op_info() -> (fn(Ptr<Operation>) -> OpBox, TypeId)where
Self: Sized,
Get details about the concrete Op type.
Source§impl Parsable for SwitchOp
impl Parsable for SwitchOp
Source§type Arg = Vec<(Identifier, Location)>
type Arg = Vec<(Identifier, Location)>
Type of the argument that must be passed to the parser.
Source§fn parse<'__pliron_parse>(
state_stream: &mut StateStream<'__pliron_parse>,
arg: Self::Arg,
) -> ParseResult<'__pliron_parse, Self::Parsed>
fn parse<'__pliron_parse>( state_stream: &mut StateStream<'__pliron_parse>, arg: Self::Arg, ) -> ParseResult<'__pliron_parse, Self::Parsed>
Define a parser using existing combinators and call
into on Parser::parse_stream to get the final ParseResult.
Use state_stream.state as necessary.Source§fn parser<'a>(
arg: Self::Arg,
) -> Box<dyn Parser<Stream<Stream<Stream<Stream<IteratorStream<CharIterator<'a>>, SourcePosition>>>, State<'a>>, PartialState = (), Output = Self::Parsed> + 'a>where
Self::Parsed: 'a,
fn parser<'a>(
arg: Self::Arg,
) -> Box<dyn Parser<Stream<Stream<Stream<Stream<IteratorStream<CharIterator<'a>>, SourcePosition>>>, State<'a>>, PartialState = (), Output = Self::Parsed> + 'a>where
Self::Parsed: 'a,
Get a parser combinator that can work on StateStream as its input.
Source§impl Printable for SwitchOp
impl Printable for SwitchOp
Source§impl PromotableRegionOpInterface for SwitchOp
impl PromotableRegionOpInterface for SwitchOp
Source§fn is_region_promotable(
&self,
_: &Context,
_: &AllocInfo,
_: Ptr<Region>,
_: bool,
) -> bool
fn is_region_promotable( &self, _: &Context, _: &AllocInfo, _: Ptr<Region>, _: bool, ) -> bool
Returns true if
region (a child of this op) can be analysed for
promotion with respect to alloc.
has_value_stores is a hint: true when the region contains stores to alloc.Source§fn setup_promotion(
&self,
ctx: &mut Context,
_: &AllocInfo,
reaching_def: Value,
_: bool,
regions_to_process: &mut SmallMap<Ptr<Region>, Value, 2>,
)
fn setup_promotion( &self, ctx: &mut Context, _: &AllocInfo, reaching_def: Value, _: bool, regions_to_process: &mut SmallMap<Ptr<Region>, Value, 2>, )
Called before descending into nested regions.
reaching_def is the value in slot on entry to this op.
Populate regions_to_process with the reaching def each region starts with.
You may mutate the op in place, but do NOT delete ops or touch terminators.Source§fn finalize_promotion(
&self,
ctx: &mut Context,
alloc: &AllocInfo,
reaching_def: Value,
has_value_stores: bool,
reaching_at_block_end: &HMap<Ptr<BasicBlock>, Value>,
) -> Value
fn finalize_promotion( &self, ctx: &mut Context, alloc: &AllocInfo, reaching_def: Value, has_value_stores: bool, reaching_at_block_end: &HMap<Ptr<BasicBlock>, Value>, ) -> Value
Called after reaching defs are computed for all regions, but before
blocking uses are removed. Returns the new reaching def at the op’s exit.
Mutation is allowed, but you must not change control flow or add ops that
interact with the slot’s value.
fn verify(_op: &dyn Op, _ctx: &Context) -> Result<()>where
Self: Sized,
Source§impl RegionBranchOpInterface for SwitchOp
impl RegionBranchOpInterface for SwitchOp
Source§fn entry_successor_regions(
&self,
ctx: &Context,
operands: &[Option<AttrObj>],
) -> Vec<RegionSuccessor>
fn entry_successor_regions( &self, ctx: &Context, operands: &[Option<AttrObj>], ) -> Vec<RegionSuccessor>
Returns all potential region successors when first executing the op. Read more
Source§fn successor_regions(
&self,
ctx: &Context,
pred: RegionPredecessor,
) -> Vec<RegionSuccessor>
fn successor_regions( &self, ctx: &Context, pred: RegionPredecessor, ) -> Vec<RegionSuccessor>
Returns all potential region successors when branching from
predecessor.
These are the regions that may be selected during the flow of control. Read moreSource§fn successor_inputs(
&self,
ctx: &Context,
successor: RegionSuccessor,
) -> Vec<Value>
fn successor_inputs( &self, ctx: &Context, successor: RegionSuccessor, ) -> Vec<Value>
Return all successor inputs for the given region successor. If the
given region successor is a region, then the returned values are block
arguments. Otherwise, if the given region successor is an operation,
the returned values are op results.
Source§fn region_invocation_bounds(
&self,
ctx: &Context,
operands: &[Option<AttrObj>],
) -> Vec<InvocationBounds>
fn region_invocation_bounds( &self, ctx: &Context, operands: &[Option<AttrObj>], ) -> Vec<InvocationBounds>
Populates
invocationBounds with the minimum and maximum number of
times this operation will invoke the attached regions (assuming the
regions yield normally, i.e. do not abort or invoke an infinite loop).
The minimum number of invocations is at least 0. If the maximum number
of invocations cannot be statically determined, then it will be set to
InvocationBounds::getUnknown(). Read morefn verify(_op: &dyn Op, _ctx: &Context) -> Result<()>where
Self: Sized,
Source§fn entry_successor_operands(
&self,
ctx: &Context,
successor: RegionSuccessor,
) -> Vec<Use<Value>>
fn entry_successor_operands( &self, ctx: &Context, successor: RegionSuccessor, ) -> Vec<Use<Value>>
Returns the operands of this operation that are forwarded to the
successor inputs when branching to
successor. successor is
guaranteed to be among the successors that are returned by
entry_successor_regions/successor_regions(parent()). Read moreSource§fn all_successor_regions_of_region(
&self,
ctx: &Context,
region: Ptr<Region>,
) -> Vec<RegionSuccessor>
fn all_successor_regions_of_region( &self, ctx: &Context, region: Ptr<Region>, ) -> Vec<RegionSuccessor>
Returns all potential region successors when branching from any
terminator in
region.Source§fn predecessors(
&self,
ctx: &Context,
successor: RegionSuccessor,
) -> Vec<RegionPredecessor>
fn predecessors( &self, ctx: &Context, successor: RegionSuccessor, ) -> Vec<RegionPredecessor>
Returns all potential branching points (predecessors) for a given
region successor.
Source§fn predecessor_values(
&self,
ctx: &Context,
successor: RegionSuccessor,
index: usize,
) -> Vec<Use<Value>>
fn predecessor_values( &self, ctx: &Context, successor: RegionSuccessor, index: usize, ) -> Vec<Use<Value>>
Returns all potential values across all (predecessors) for a given successor
input.
Source§fn are_types_compatible(
&self,
ctx: &Context,
lhs: TypeHandle,
rhs: TypeHandle,
) -> bool
fn are_types_compatible( &self, ctx: &Context, lhs: TypeHandle, rhs: TypeHandle, ) -> bool
This method is called to compare types along control-flow edges. By
default, the types are checked as equal.
Source§impl SideEffects for SwitchOp
impl SideEffects for SwitchOp
Source§fn has_side_effects(&self, ctx: &Context) -> bool
fn has_side_effects(&self, ctx: &Context) -> bool
Returns
true if the operation has side effects, and false otherwise.impl StructuralPartialEq for SwitchOp
Source§impl UniformRegionOpInterface for SwitchOp
impl UniformRegionOpInterface for SwitchOp
fn result_uniformity( &self, _ctx: &Context, operands: &[Uniformity], ) -> Uniformity
fn entry_successor_region_uniformity( &self, ctx: &Context, operands: &[Uniformity], ) -> Vec<Uniformity>
fn verify(_op: &dyn Op, _ctx: &Context) -> Result<()>where
Self: Sized,
Auto Trait Implementations§
impl !RefUnwindSafe for SwitchOp
impl !UnwindSafe for SwitchOp
impl Freeze for SwitchOp
impl Send for SwitchOp
impl Sync for SwitchOp
impl Unpin for SwitchOp
impl UnsafeUnpin for SwitchOp
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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