[][src]Struct gf::pivot::Module

pub struct Module {
    pub metadata: Metadata,
    // some fields omitted
}

Module, the main object of the Pivot IR.

Fields

metadata: Metadata

Metadata associated with the module as a whole.

Methods

impl Module[src]

pub fn new() -> Self[src]

Construct a new empty module.

pub fn basic_block(&self, id: BasicBlockId) -> Option<&BasicBlock>[src]

Return a shared reference to a basic block.

Errors

  • Returns None if id is not an existing basic block ID.

pub fn basic_block_mut(&mut self, id: BasicBlockId) -> Option<&mut BasicBlock>[src]

Return a mutable reference to a basic block.

Errors

  • Returns None if id is not an existing basic block ID.

pub fn constant(&self, id: ConstantId) -> Option<&Constant>[src]

Return a shared reference to a constant.

Errors

  • Returns None if id is not an existing constant ID.

pub fn constant_mut(&mut self, id: ConstantId) -> Option<&mut Constant>[src]

Return a mutable reference to a constant.

Errors

  • Returns None if id is not an existing constant ID.

pub fn fragment(&self, id: FragmentId) -> Option<&Fragment>[src]

Return a shared reference to a fragment.

Errors

  • Returns None if id is not an existing fragment ID.

pub fn fragment_mut(&mut self, id: FragmentId) -> Option<&mut Fragment>[src]

Return a mutable reference to a fragment.

Errors

  • Returns None if id is not an existing fragment ID.

pub fn operation(&self, id: OperationId) -> Option<&Operation>[src]

Return a shared reference to an operation.

Errors

  • Returns None if id is not an existing operation ID.

pub fn operation_mut(&mut self, id: OperationId) -> Option<&mut Operation>[src]

Return a mutable reference to an operation.

Errors

  • Returns None if id is not an existing operation ID.

pub fn register(&self, id: RegisterId) -> Option<&Register>[src]

Return a shared reference to a register.

Errors

  • Returns None if id is not an existing register ID.

pub fn register_mut(&mut self, id: RegisterId) -> Option<&mut Register>[src]

Return a mutable reference to a register.

Errors

  • Returns None if id is not an existing register ID.

pub fn space(&self, id: SpaceId) -> Option<&Space>[src]

Return a shared reference to a space.

Errors

  • Returns None if id is not an existing space ID.

pub fn space_mut(&mut self, id: SpaceId) -> Option<&mut Space>[src]

Return a mutable reference to a space.

Errors

  • Returns None if id is not an existing space ID.

pub fn enumerate_basic_blocks(
    &self
) -> impl Iterator<Item = (BasicBlockId, &BasicBlock)>
[src]

Return an iterator over basic blocks and their IDs.

pub fn enumerate_constants(
    &self
) -> impl Iterator<Item = (ConstantId, &Constant)>
[src]

Return an iterator over constants and their IDs.

pub fn enumerate_fragments(
    &self
) -> impl Iterator<Item = (FragmentId, &Fragment)>
[src]

Return an iterator over fragments and their IDs.

pub fn enumerate_operations(
    &self
) -> impl Iterator<Item = (OperationId, &Operation)>
[src]

Return an iterator over operations and their IDs.

pub fn enumerate_registers(
    &self
) -> impl Iterator<Item = (RegisterId, &Register)>
[src]

Return an iterator over registers and their IDs.

pub fn enumerate_spaces(&self) -> impl Iterator<Item = (SpaceId, &Space)>[src]

Return an iterator over spaces and their IDs.

pub fn add_basic_block(&mut self, basic_block: BasicBlock) -> BasicBlockId[src]

Add a new basic block to the module and return its assigned ID.

pub fn add_constant(&mut self, constant: Constant) -> ConstantId[src]

Add a new constant to the module and return its assigned ID.

pub fn add_fragment(&mut self, fragment: Fragment) -> FragmentId[src]

Add a new fragment to the module and return its assigned ID.

pub fn add_operation(&mut self, operation: Operation) -> OperationId[src]

Add a new operation to the module and return its assigned ID.

pub fn add_register(&mut self, register: Register) -> RegisterId[src]

Add a new register to the module and return its assigned ID.

pub fn add_space(&mut self, space: Space) -> SpaceId[src]

Add a new space to the module and return its assigned ID.

pub fn remove_basic_block(&mut self, id: BasicBlockId) -> Option<BasicBlock>[src]

Remove a basic block from the module, returning its data.

pub fn remove_constant(&mut self, id: ConstantId) -> Option<Constant>[src]

Remove a constant from the module, returning its data.

pub fn remove_fragment(&mut self, id: FragmentId) -> Option<Fragment>[src]

Remove a fragment from the module, returning its data.

pub fn remove_operation(&mut self, id: OperationId) -> Option<Operation>[src]

Remove an operation from the module, returning its data.

pub fn remove_register(&mut self, id: RegisterId) -> Option<Register>[src]

Remove a register from the module, returning its data.

pub fn remove_space(&mut self, id: SpaceId) -> Option<Space>[src]

Remove a space from the module, returning its data.

pub fn statement(&self, loc: StatementLoc) -> Option<&Statement>[src]

Return statement at given location.

Trait Implementations

impl Seal for Module[src]

impl Clone for Module[src]

impl Default for Module[src]

impl Debug for Module[src]

Auto Trait Implementations

impl Send for Module

impl Sync for Module

impl Unpin for Module

impl UnwindSafe for Module

impl RefUnwindSafe for Module

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]