basic support for structures through the IR

This commit is contained in:
2024-03-16 16:41:23 -07:00
parent b0cc2fc26b
commit a7b85d37da
12 changed files with 572 additions and 94 deletions

View File

@@ -33,6 +33,9 @@ impl<M: Module> Backend<M> {
types::Type::triple_pointer_type(&self.platform),
ir::ArgumentExtension::None,
),
Type::Structure(_) => {
unimplemented!()
}
Type::Primitive(PrimitiveType::Void) => (types::I8, ir::ArgumentExtension::None), // FIXME?
Type::Primitive(PrimitiveType::I8) => (types::I8, ir::ArgumentExtension::Sext),
Type::Primitive(PrimitiveType::I16) => (types::I16, ir::ArgumentExtension::Sext),
@@ -88,6 +91,10 @@ impl<M: Module> Backend<M> {
self.defined_symbols
.insert(top_level_name, (data_id, pt.into()));
}
Type::Structure(_) => {
unimplemented!()
}
}
}
@@ -392,6 +399,9 @@ impl<M: Module> Backend<M> {
}
}
Expression::Construct(_, _, _, _) => unimplemented!(),
Expression::FieldRef(_, _, _, _) => unimplemented!(),
Expression::Block(_, _, mut exprs) => match exprs.pop() {
None => Ok((builder.ins().iconst(types::I64, 0), ConstantType::Void)),
Some(last) => {
@@ -511,8 +521,10 @@ impl<M: Module> Backend<M> {
Type::Function(_, _) => {
panic!("function returns a function?")
}
Type::Structure(_) => unimplemented!(),
Type::Primitive(ct) => Ok((*result, ct.into())),
},
Type::Structure(_) => unimplemented!(),
},
_ => panic!("don't support multi-value returns yet"),
}