mirror of
https://github.com/Noratrieb/uwucc.git
synced 2026-01-15 17:15:10 +01:00
more
This commit is contained in:
parent
542c0daf6a
commit
86b924f5e3
7 changed files with 171 additions and 67 deletions
|
|
@ -4,7 +4,7 @@ use super::LoweringCx;
|
|||
use crate::{
|
||||
ir::{
|
||||
self, BasicBlock, BbIdx, BinKind, Branch, ConstValue, Func, Layout, Operand, Register,
|
||||
RegisterData, Statement, StatementKind, TyLayout,
|
||||
RegisterData, Statement, StatementKind, TyLayout, UnaryKind,
|
||||
},
|
||||
ty::{Ty, TyKind},
|
||||
};
|
||||
|
|
@ -85,6 +85,25 @@ impl<'a, 'cx> FuncBuilder<'a, 'cx> {
|
|||
reg
|
||||
}
|
||||
|
||||
pub fn unary(
|
||||
&mut self,
|
||||
kind: UnaryKind,
|
||||
rhs: Operand,
|
||||
span: Span,
|
||||
result_tyl: TyLayout<'cx>,
|
||||
) -> Register {
|
||||
let reg = self.new_reg(None, result_tyl);
|
||||
let stmt = StatementKind::UnaryOperation {
|
||||
kind,
|
||||
rhs,
|
||||
result: reg,
|
||||
};
|
||||
self.cur_bb_mut()
|
||||
.statements
|
||||
.push(Statement { span, kind: stmt });
|
||||
reg
|
||||
}
|
||||
|
||||
pub fn load(&mut self, tyl: TyLayout<'cx>, ptr_reg: Register, span: Span) -> Register {
|
||||
let reg = self.new_reg(None, tyl.clone());
|
||||
let stmt = StatementKind::Load {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue