pub struct Function<'a> {
pub linkage: Linkage,
pub name: String,
pub arguments: Vec<(Type<'a>, Value)>,
pub return_ty: Option<Type<'a>>,
pub blocks: Vec<Block<'a>>,
}Expand description
QBE function
Fields§
§linkage: LinkageFunction’s linkage
name: StringFunction name
arguments: Vec<(Type<'a>, Value)>Function arguments
return_ty: Option<Type<'a>>Return type
blocks: Vec<Block<'a>>Labelled blocks
Implementations§
source§impl<'a> Function<'a>
impl<'a> Function<'a>
sourcepub fn new(
linkage: Linkage,
name: String,
arguments: Vec<(Type<'a>, Value)>,
return_ty: Option<Type<'a>>
) -> Self
pub fn new(
linkage: Linkage,
name: String,
arguments: Vec<(Type<'a>, Value)>,
return_ty: Option<Type<'a>>
) -> Self
Instantiates an empty function and returns it
sourcepub fn add_block(&mut self, label: String) -> &mut Block<'a>
pub fn add_block(&mut self, label: String) -> &mut Block<'a>
Adds a new empty block with a specified label and returns a reference to it
sourcepub fn last_block(&mut self) -> &Block<'_>
👎Deprecated since 3.0.0: Use self.blocks.last() or self.blocks.last_mut() instead.
pub fn last_block(&mut self) -> &Block<'_>
self.blocks.last() or self.blocks.last_mut() instead.Returns a reference to the last block
sourcepub fn assign_instr(&mut self, temp: Value, ty: Type<'a>, instr: Instr<'a>)
pub fn assign_instr(&mut self, temp: Value, ty: Type<'a>, instr: Instr<'a>)
Adds a new instruction assigned to a temporary
Trait Implementations§
source§impl<'a> Ord for Function<'a>
impl<'a> Ord for Function<'a>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'a> PartialEq<Function<'a>> for Function<'a>
impl<'a> PartialEq<Function<'a>> for Function<'a>
source§impl<'a> PartialOrd<Function<'a>> for Function<'a>
impl<'a> PartialOrd<Function<'a>> for Function<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more