This commit is contained in:
nora 2023-12-29 17:18:20 +01:00
parent 46e5662aab
commit ce2ad5a957
6 changed files with 124 additions and 110 deletions

View file

@ -138,15 +138,15 @@ pub enum StatementKind {
ptr: Operand,
value: Operand,
/// Amount of bytes to store.
size: Operand,
align: Operand,
size: u64,
align: u64,
},
Load {
result: Register,
ptr: Operand,
/// Amount of bytes to load.
size: Operand,
align: Operand,
size: u64,
align: u64,
},
BinOp {
result: Register,

View file

@ -112,11 +112,9 @@ impl<W: Write> PrettyPrinter<W> {
align,
} => writeln!(
self.out,
" store {}, {}, size={}, align={}",
" store {}, {}, size={size}, align={align}",
print_op(ptr_reg),
print_op(value),
print_op(size),
print_op(align)
print_op(value),
),
StatementKind::Load {
result,
@ -125,11 +123,9 @@ impl<W: Write> PrettyPrinter<W> {
align,
} => writeln!(
self.out,
" {} = load {}, size={}, align={}",
" {} = load {}, size={size}, align={align}",
print_reg(result),
print_op(ptr_reg),
print_op(size),
print_op(align)
),
StatementKind::BinOp {
kind,

View file

@ -40,24 +40,20 @@ pub trait Visitor {
StatementKind::Store {
ptr,
value,
size,
align,
size: _,
align: _,
} => {
self.visit_operand(ptr);
self.visit_operand(value);
self.visit_operand(size);
self.visit_operand(align);
}
StatementKind::Load {
result,
ptr,
size,
align,
size: _,
align: _,
} => {
self.visit_reg(result);
self.visit_operand(ptr);
self.visit_operand(size);
self.visit_operand(align);
}
StatementKind::BinOp {
kind: _,

View file

@ -118,8 +118,8 @@ impl<'a, 'cx> FuncBuilder<'a, 'cx> {
let stmt = StatementKind::Load {
result: reg,
ptr,
size: Operand::const_u64(tyl.layout.size),
align: Operand::const_u64(tyl.layout.align),
size: tyl.layout.size,
align: tyl.layout.align,
};
self.cur_bb_mut()
.statements
@ -131,8 +131,8 @@ impl<'a, 'cx> FuncBuilder<'a, 'cx> {
let stmt = StatementKind::Store {
ptr,
value: rhs,
size: Operand::const_u64(layout.size),
align: Operand::const_u64(layout.align),
size: layout.size,
align: layout.align,
};
self.cur_bb_mut()
.statements