pub struct Function {
pub decl: FunctionDecl,
pub instrs: Vec<Instruction>,
/* private fields */
}
Fields§
§decl: FunctionDecl
§instrs: Vec<Instruction>
Implementations§
Source§impl Function
impl Function
pub fn new(name: String, ty: Type) -> Self
pub fn add_param(&mut self, ty: Type) -> Register
pub fn set_variadic(&mut self, variadic: bool)
pub fn alloc(&mut self, ty: Type, count: usize) -> MemorySlot
pub fn load(&mut self, ty: Type, ptr: impl Into<Pointer>) -> Register
pub fn load_param(&mut self, param: Register) -> Register
pub fn store( &mut self, ty: Type, ptr: impl Into<Pointer>, value: impl Into<Value>, )
pub fn lea(&mut self, ty: Type, ptr: impl Into<Pointer>) -> Register
pub fn mov(&mut self, ty: Type, value: impl Into<Value>) -> Register
pub fn add( &mut self, ty: Type, lhs: impl Into<Value>, rhs: impl Into<Value>, ) -> Register
pub fn sub( &mut self, ty: Type, lhs: impl Into<Value>, rhs: impl Into<Value>, ) -> Register
pub fn mul( &mut self, ty: Type, lhs: impl Into<Value>, rhs: impl Into<Value>, ) -> Register
pub fn sdiv( &mut self, ty: Type, lhs: impl Into<Value>, rhs: impl Into<Value>, ) -> Register
pub fn udiv( &mut self, ty: Type, lhs: impl Into<Value>, rhs: impl Into<Value>, ) -> Register
pub fn call( &mut self, ty: Type, name: impl Into<String>, args: Vec<Register>, ) -> Register
pub fn new_label(&mut self) -> Label
pub fn add_label(&mut self, label: Label)
pub fn label(&mut self) -> Label
pub fn jump(&mut self, target: Label)
pub fn branch( &mut self, cond: Register, if_true: Label, if_false: Option<Label>, )
pub fn ret(&mut self, value: Option<impl Into<Value>>)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
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
Mutably borrows from an owned value. Read more