pub struct BasicBlock {
pub attributes: AttributeDict,
/* private fields */
}Expand description
A basic block contains a list of Operations. It may have arguments.
Fields§
§attributes: AttributeDictA dictionary of attributes.
Implementations§
Source§impl BasicBlock
impl BasicBlock
Sourcepub fn new(
ctx: &mut Context,
label: Option<Identifier>,
arg_types: Vec<Ptr<TypeObj>>,
) -> Ptr<BasicBlock>
pub fn new( ctx: &mut Context, label: Option<Identifier>, arg_types: Vec<Ptr<TypeObj>>, ) -> Ptr<BasicBlock>
Create a new Basic Block.
Sourcepub fn get_parent_region(&self) -> Option<Ptr<Region>>
pub fn get_parent_region(&self) -> Option<Ptr<Region>>
Get parent region.
Sourcepub fn get_parent_block(&self, ctx: &Context) -> Option<Ptr<BasicBlock>>
pub fn get_parent_block(&self, ctx: &Context) -> Option<Ptr<BasicBlock>>
Get parent block.
Sourcepub fn get_argument(&self, arg_idx: usize) -> Value
pub fn get_argument(&self, arg_idx: usize) -> Value
Get idx’th argument as a Value. Panics on invalid index.
Sourcepub fn push_argument(
block: Ptr<BasicBlock>,
ctx: &Context,
ty: Ptr<TypeObj>,
) -> usize
pub fn push_argument( block: Ptr<BasicBlock>, ctx: &Context, ty: Ptr<TypeObj>, ) -> usize
Add an argument to the end of the argument list, returning its index.
Sourcepub fn pop_argument(block: Ptr<BasicBlock>, ctx: &Context)
pub fn pop_argument(block: Ptr<BasicBlock>, ctx: &Context)
Remove the last argument. Panics if there are no arguments or if the argument has uses. Any Value referring to the removed argument is invalidated.
Sourcepub fn insert_argument(
block: Ptr<BasicBlock>,
ctx: &Context,
arg_idx: usize,
ty: Ptr<TypeObj>,
)
pub fn insert_argument( block: Ptr<BasicBlock>, ctx: &Context, arg_idx: usize, ty: Ptr<TypeObj>, )
Insert a new argument at arg_idx, shifting existing arguments, from arg_idx, to the right.
Panics on invalid index.
Sourcepub fn remove_argument(block: Ptr<BasicBlock>, ctx: &Context, arg_idx: usize)
pub fn remove_argument(block: Ptr<BasicBlock>, ctx: &Context, arg_idx: usize)
Remove the argument at arg_idx, shifting subsequent arguments to the left.
Panics on invalid index or if the argument has uses.
Any Value referring to the removed argument is invalidated.
Sourcepub fn get_num_arguments(&self) -> usize
pub fn get_num_arguments(&self) -> usize
Get the number of arguments.
Sourcepub fn has_succ(&self, ctx: &Context, succ: Ptr<BasicBlock>) -> bool
pub fn has_succ(&self, ctx: &Context, succ: Ptr<BasicBlock>) -> bool
Is succ a successor of this block?
Sourcepub fn get_terminator(&self, ctx: &Context) -> Option<Ptr<Operation>>
pub fn get_terminator(&self, ctx: &Context) -> Option<Ptr<Operation>>
Get the block terminator, if one exists.
Sourcepub fn drop_all_uses(ptr: Ptr<Self>, ctx: &Context)
pub fn drop_all_uses(ptr: Ptr<Self>, ctx: &Context)
Drop all uses that this block holds.
Trait Implementations§
Source§impl ContainsLinkedList<BasicBlock> for Region
impl ContainsLinkedList<BasicBlock> for Region
Source§impl ContainsLinkedList<Operation> for BasicBlock
impl ContainsLinkedList<Operation> for BasicBlock
Source§impl LinkedList for BasicBlock
impl LinkedList for BasicBlock
Source§fn get_next(&self) -> Option<Ptr<Self>>
fn get_next(&self) -> Option<Ptr<Self>>
Source§fn get_prev(&self) -> Option<Ptr<Self>>
fn get_prev(&self) -> Option<Ptr<Self>>
Source§fn get_container(&self) -> Option<Ptr<Self::ContainerType>>
fn get_container(&self) -> Option<Ptr<Self::ContainerType>>
Source§impl Located for BasicBlock
impl Located for BasicBlock
Source§impl Named for BasicBlock
impl Named for BasicBlock
fn given_name(&self, _ctx: &Context) -> Option<Identifier>
fn id(&self, _ctx: &Context) -> Identifier
fn unique_name(&self, ctx: &Context) -> Identifier
Source§impl Parsable for BasicBlock
impl Parsable for BasicBlock
Source§type Parsed = Ptr<BasicBlock>
type Parsed = Ptr<BasicBlock>
Source§fn parse<'a>(
state_stream: &mut StateStream<'a>,
_arg: Self::Arg,
) -> ParseResult<'a, Self::Parsed>
fn parse<'a>( state_stream: &mut StateStream<'a>, _arg: Self::Arg, ) -> ParseResult<'a, Self::Parsed>
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<StateStream<'a>, Output = Self::Parsed, PartialState = ()> + 'a>
fn parser<'a>( arg: Self::Arg, ) -> Box<dyn Parser<StateStream<'a>, Output = Self::Parsed, PartialState = ()> + 'a>
Source§impl PartialEq for BasicBlock
impl PartialEq for BasicBlock
Auto Trait Implementations§
impl Freeze for BasicBlock
impl !RefUnwindSafe for BasicBlock
impl Send for BasicBlock
impl Sync for BasicBlock
impl Unpin for BasicBlock
impl UnsafeUnpin for BasicBlock
impl !UnwindSafe for BasicBlock
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> 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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.