asm output, random fixes

This commit is contained in:
2025-04-07 19:42:40 -04:00
parent f57af3b2b5
commit cb9a366f43
18 changed files with 266 additions and 117 deletions

View File

@@ -1,6 +1,6 @@
use super::{func::FnLowerCtx, FnLowerable, PExpr, UnaryOp};
use crate::{
ir::{DataDef, IRUInstruction, Origin, Type, VarInst},
ir::{DataDef, IRUInstruction, Type, VarInst},
parser::PInfixOp,
};
@@ -15,7 +15,7 @@ impl FnLowerable for PExpr {
let src = ctx.program.def_data(
DataDef {
ty: Type::Bits(8).arr(data.len() as u32),
origin: Origin::File(l.span),
origin: l.span,
label: format!("string \"{}\"", s.replace("\n", "\\n")),
},
data,
@@ -29,7 +29,7 @@ impl FnLowerable for PExpr {
let src = ctx.program.def_data(
DataDef {
ty,
origin: Origin::File(l.span),
origin: l.span,
label: format!("char '{c}'"),
},
c.to_string().as_bytes().to_vec(),
@@ -44,7 +44,7 @@ impl FnLowerable for PExpr {
let src = ctx.program.def_data(
DataDef {
ty,
origin: Origin::File(l.span),
origin: l.span,
label: format!("num {n:?}"),
},
n.whole.parse::<i64>().unwrap().to_le_bytes().to_vec(),
@@ -131,10 +131,7 @@ impl FnLowerable for PExpr {
}
}
PExpr::Block(b) => b.lower(ctx)?,
PExpr::AsmBlock(b) => {
b.lower(ctx);
return None;
}
PExpr::AsmBlock(b) => b.lower(ctx)?,
PExpr::Call(e, args) => {
let fe = e.lower(ctx)?;
let mut nargs = Vec::new();