calyx_ir

Struct Printer

Source
pub struct Printer;
Expand description

Printer for the IR.

Implementations§

Source§

impl Printer

Source

pub fn format_at_attributes(attrs: &Attributes) -> String

Format attributes of the form @static(1). Returns the empty string if the attrs is empty.

Source

pub fn format_attributes(attrs: &Attributes) -> String

Format attributes of the form <"static"=1>. Returns the empty string if the attrs is empty.

Source

pub fn format_ports(ports: &[RRC<Port>]) -> String

Formats port definitions in signatures

Source

pub fn format_port_def<W: Display>(port_defs: &[&PortDef<W>]) -> String

Source

pub fn write_context<F: Write>( ctx: &Context, skip_primitives: bool, f: &mut F, ) -> Result<()>

Prints out the program context. If skip_primitives is true, the printer will skip printing primitives defined outside the source file.

Source

pub fn write_externs<'a, F, I>( (path, prims): (&Path, I), f: &mut F, ) -> Result<()>
where F: Write, I: Iterator<Item = &'a Primitive>,

Formats and writes extern statements.

Source

pub fn write_primitive<F: Write>( prim: &Primitive, indent: usize, f: &mut F, ) -> Result<()>

Source

pub fn write_component<F: Write>(comp: &Component, f: &mut F) -> Result<()>

Formats and writes the Component to the formatter.

Source

pub fn write_float_const<F: Write>( cell: &Cell, indent_level: usize, f: &mut F, ) -> Result<()>

Source

pub fn write_cell<F: Write>( cell: &Cell, indent_level: usize, f: &mut F, ) -> Result<()>

Format and write a cell.

Source

pub fn write_assignment<F: Write, T: Clone + ToString + Eq>( assign: &Assignment<T>, indent_level: usize, f: &mut F, ) -> Result<()>

Format and write an assignment.

Source

pub fn assignment_to_str<T>(assign: &Assignment<T>) -> String
where T: ToString + Clone + Eq,

Convinience method to get string representation of ir::Assignment.

Source

pub fn control_to_str(assign: &Control) -> String

Convinience method to get string representation of ir::Control.

Source

pub fn write_comb_group<F: Write>( group: &CombGroup, indent_level: usize, f: &mut F, ) -> Result<()>

Format and write a combinational group.

Source

pub fn write_group<F: Write>( group: &Group, indent_level: usize, f: &mut F, ) -> Result<()>

Format and write a group.

Source

pub fn write_static_group<F: Write>( group: &StaticGroup, indent_level: usize, f: &mut F, ) -> Result<()>

Format and write a static group.

Source

pub fn write_static_control<F: Write>( scontrol: &StaticControl, indent_level: usize, f: &mut F, ) -> Result<()>

Format and write a static control program

Source

pub fn write_control<F: Write>( control: &Control, indent_level: usize, f: &mut F, ) -> Result<()>

Format and write a control program

Source

pub fn guard_str<T>(guard: &Guard<T>) -> String
where T: Eq + ToString,

Generate a String-based representation for a guard.

Source

pub fn port_to_str(port: &Port) -> String

Get the port access expression.

Source

pub fn format_metadata(metadata: &Option<String>) -> String

Formats the top-level metadata if present

Source

pub fn write_source_info_table<W: Write>( f: &mut W, metadata: &Option<SourceInfoTable>, ) -> Result<(), Error>

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.