fuse results of sub- morphisms in complex morphisms

This commit is contained in:
Michael Sippel 2025-04-02 14:37:31 +02:00
parent 35b747ea15
commit 98592aa596
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -67,6 +67,7 @@ impl LdmcCTargetMorph {
LdmcCTargetMorph {
includes: vec![
"#include <stdint.h>".into(),
"#define FUSE(x) { int result = x; if(result) return result; }".into()
],
active_instantiations: Vec::new(),
active_types: Vec::new(),
@ -98,6 +99,7 @@ impl LdmcCTargetMorph {
let mut source = String::new();
for inc in self.includes {
source.push_str(&inc);
source.push('\n');
}
for ty in self.active_types {
@ -175,7 +177,7 @@ impl LdmcCTargetMorph {
{{
{} const * restrict src = {};
{} * restrict dst = {};
{} ( src, dst );
FUSE( {} ( src, dst ) );
}}"#,
src_c_type, src_buf,
dst_c_type, dst_buf,
@ -224,7 +226,7 @@ impl LdmcCTargetMorph {
{{
{} const * restrict src = (void*) {};
{} * restrict dst = (void*) {};
{} ( {}, src, dst );
FUSE( {} ( {}, src, dst );
}}"#,
src_c_type, src_buf,
dst_c_type, dst_buf,
@ -256,7 +258,7 @@ impl LdmcCTargetMorph {
let name = name.replace("-", "_").replace(".","_dot_");
c_source.push_str(
&format!("
{} ( &src->{}, &dst->{} );
FUSE( {} ( &src->{}, &dst->{} ) );
",
inst.symbol,
name, name