BasicBlock

Struct BasicBlock 

Source
pub struct BasicBlock {
    pub attributes: AttributeDict,
    /* private fields */
}
Expand description

A basic block contains a list of Operations. It may have arguments.

Fields§

§attributes: AttributeDict

A dictionary of attributes.

Implementations§

Source§

impl BasicBlock

Source

pub fn new( ctx: &mut Context, label: Option<Identifier>, arg_types: Vec<Ptr<TypeObj>>, ) -> Ptr<BasicBlock>

Create a new Basic Block.

Source

pub fn get_parent_region(&self) -> Option<Ptr<Region>>

Get parent region.

Source

pub fn get_parent_op(&self, ctx: &Context) -> Option<Ptr<Operation>>

Get parent operation.

Source

pub fn get_argument(&self, arg_idx: usize) -> Value

Get idx’th argument as a Value.

Source

pub fn arguments(&self) -> impl Iterator<Item = Value> + '_

Get an iterator over the arguments

Source

pub fn add_argument(&mut self, ty: Ptr<TypeObj>) -> usize

Add a new argument with specified type. Returns idx at which it was added.

Source

pub fn get_num_arguments(&self) -> usize

Get the number of arguments.

Source

pub fn succs(&self, ctx: &Context) -> Vec<Ptr<BasicBlock>>

Get all successors of this block.

Source

pub fn has_succ(&self, ctx: &Context, succ: Ptr<BasicBlock>) -> bool

Is succ a successor of this block?

Source

pub fn get_terminator(&self, ctx: &Context) -> Option<Ptr<Operation>>

Get the block terminator, if one exists.

Source

pub fn drop_all_uses(ptr: Ptr<Self>, ctx: &Context)

Drop all uses that this block holds.

Source

pub fn erase(ptr: Ptr<Self>, ctx: &mut Context)

Unlink and deallocate this block and everything that it contains. There must not be any uses outside the block.

Trait Implementations§

Source§

impl ContainsLinkedList<BasicBlock> for Region

Source§

fn get_head(&self) -> Option<Ptr<BasicBlock>>

Simply get the head of the list.
Source§

fn get_tail(&self) -> Option<Ptr<BasicBlock>>

Simply get the tail of the list.
Source§

fn iter<'a>(&self, ctx: &'a Context) -> Iter<'a, T>

Get an iterator over the items. Context is borrowed throughout.
Source§

impl ContainsLinkedList<Operation> for BasicBlock

Source§

fn get_head(&self) -> Option<Ptr<Operation>>

Simply get the head of the list.
Source§

fn get_tail(&self) -> Option<Ptr<Operation>>

Simply get the tail of the list.
Source§

fn iter<'a>(&self, ctx: &'a Context) -> Iter<'a, T>

Get an iterator over the items. Context is borrowed throughout.
Source§

impl LinkedList for BasicBlock

Source§

fn get_next(&self) -> Option<Ptr<Self>>

Simple getter for the item previous to this in the list.
Source§

fn get_prev(&self) -> Option<Ptr<Self>>

Simple getter for the item previous to this in the list.
Source§

fn get_container(&self) -> Option<Ptr<Self::ContainerType>>

Get a reference to the object that contains this linked list.
Source§

impl Located for BasicBlock

Source§

fn loc(&self) -> Location

Source§

fn set_loc(&mut self, loc: Location)

Source§

impl Named for BasicBlock

Source§

fn given_name(&self, _ctx: &Context) -> Option<Identifier>

Source§

fn id(&self, _ctx: &Context) -> Identifier

Source§

fn unique_name(&self, ctx: &Context) -> Identifier

Source§

impl Parsable for BasicBlock

Source§

fn parse<'a>( state_stream: &mut StateStream<'a>, _arg: Self::Arg, ) -> ParseResult<'a, Self::Parsed>

A basic block is label(arg_1: type_1, …, arg_n: type_n): op_1; … ; op_n

Source§

type Arg = ()

Type of the argument that must be passed to the parser.
Source§

type Parsed = Ptr<BasicBlock>

The type of the parsed entity.
Source§

fn parser<'a>( arg: Self::Arg, ) -> Box<dyn Parser<StateStream<'a>, Output = Self::Parsed, PartialState = ()> + 'a>

Get a parser combinator that can work on StateStream as its input.
Source§

fn parser_fn<'a>( _: &'a (), arg: Self::Arg, ) -> Box<dyn Parser<StateStream<'a>, Output = Self::Parsed, PartialState = ()> + 'a>

Same as Self::parser but takes a unit reference for use as ParserFn
Source§

impl PartialEq for BasicBlock

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Printable for BasicBlock

Source§

fn fmt(&self, ctx: &Context, state: &State, f: &mut Formatter<'_>) -> Result

Source§

fn disp<'t, 'c>(&'t self, ctx: &'c Context) -> Box<dyn Display + 'c>
where 't: 'c,

Get a Display’able object from the given Context and default State.
Source§

fn print<'t, 'c>( &'t self, ctx: &'c Context, state: &State, ) -> Box<dyn Display + 'c>
where 't: 'c,

Get a Display’able object from the given Context and State.
Source§

impl Verify for BasicBlock

Source§

fn verify(&self, ctx: &Context) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.