preparing for dead code elemination

This commit is contained in:
mlokr 2024-09-03 22:41:44 +02:00
parent a31e02449c
commit 9e0e0242aa
No known key found for this signature in database
GPG key ID: DEA147DDEE644993

View file

@ -871,6 +871,7 @@ struct Func {
struct Global { struct Global {
offset: Offset, offset: Offset,
ty: ty::Id, ty: ty::Id,
runtime: bool,
} }
struct Field { struct Field {
@ -3126,7 +3127,11 @@ impl Codegen {
} => ty::Kind::Struct(self.build_struct(fields)), } => ty::Kind::Struct(self.build_struct(fields)),
Expr::BinOp { left, op: TokenKind::Decl, right } => { Expr::BinOp { left, op: TokenKind::Decl, right } => {
let gid = self.tys.globals.len() as ty::Global; let gid = self.tys.globals.len() as ty::Global;
self.tys.globals.push(Global { offset: u32::MAX, ty: Default::default() }); self.tys.globals.push(Global {
offset: u32::MAX,
ty: Default::default(),
runtime: false,
});
let ci = ItemCtx { let ci = ItemCtx {
file, file,
@ -3185,7 +3190,7 @@ impl Codegen {
self.ci.free_loc(ret.loc); self.ci.free_loc(ret.loc);
Global { ty: ret.ty, offset: offset as _ } Global { ty: ret.ty, offset: offset as _, runtime: false }
} }
fn dunp_imported_fns(&mut self) { fn dunp_imported_fns(&mut self) {