WIP
This commit is contained in:
parent
286218daa5
commit
305836305c
|
@ -75,7 +75,11 @@ impl<'b> CodeGenerator for ArtiqCodeGenerator<'b> {
|
||||||
params: Vec<(Option<StrRef>, ValueEnum<'ctx>)>,
|
params: Vec<(Option<StrRef>, ValueEnum<'ctx>)>,
|
||||||
) -> Result<Option<BasicValueEnum<'ctx>>, String> {
|
) -> Result<Option<BasicValueEnum<'ctx>>, String> {
|
||||||
let result = gen_call(self, ctx, obj, fun, params)?;
|
let result = gen_call(self, ctx, obj, fun, params)?;
|
||||||
if let Some(end) = self.end.clone() {
|
|
||||||
|
if let (
|
||||||
|
Some(start),
|
||||||
|
Some(end)
|
||||||
|
) = (self.start.clone(), self.end.clone()) {
|
||||||
let old_end = self.gen_expr(ctx, &end)?.unwrap().to_basic_value_enum(ctx, self, end.custom.unwrap())?;
|
let old_end = self.gen_expr(ctx, &end)?.unwrap().to_basic_value_enum(ctx, self, end.custom.unwrap())?;
|
||||||
let now = self.timeline.emit_now_mu(ctx);
|
let now = self.timeline.emit_now_mu(ctx);
|
||||||
let smax = ctx.module.get_function("llvm.smax.i64").unwrap_or_else(|| {
|
let smax = ctx.module.get_function("llvm.smax.i64").unwrap_or_else(|| {
|
||||||
|
@ -94,11 +98,11 @@ impl<'b> CodeGenerator for ArtiqCodeGenerator<'b> {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let end_store = self.gen_store_target(ctx, &end, Some("end_store.addr"))?;
|
let end_store = self.gen_store_target(ctx, &end, Some("end_store.addr"))?;
|
||||||
ctx.builder.build_store(end_store, max);
|
ctx.builder.build_store(end_store, max);
|
||||||
}
|
|
||||||
if let Some(start) = self.start.clone() {
|
|
||||||
let start_val = self.gen_expr(ctx, &start)?.unwrap().to_basic_value_enum(ctx, self, start.custom.unwrap())?;
|
let start_val = self.gen_expr(ctx, &start)?.unwrap().to_basic_value_enum(ctx, self, start.custom.unwrap())?;
|
||||||
self.timeline.emit_at_mu(ctx, start_val);
|
self.timeline.emit_at_mu(ctx, start_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,9 +239,7 @@ impl<'b> CodeGenerator for ArtiqCodeGenerator<'b> {
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else if id == &"sequential".into() {
|
} else if id == &"sequential".into() {
|
||||||
let start = self.start.take();
|
|
||||||
self.gen_block(ctx, body.iter())?;
|
self.gen_block(ctx, body.iter())?;
|
||||||
self.start = start;
|
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue