svlog: impl if-gen decision making
For each if-generate, compute whether the condition is true or false and
thus which block to emit. Block emission is not yet implemented.
@@ -199,6 +199,20 @@ impl<'a, 'gcx, C: Context<'gcx>> CodeGenerator<'gcx, &'a C> {
_ => unreachable!(),
};
match hir.kind {
+ hir::GenKind::If {
+ cond,
+ main_body,
+ else_body,
+ } => {
+ debug!("emit if-generate {:#?}", hir.kind);
+ let k = self.constant_value_of(cond, env)?;
+ trace!("condition is {:#?}", k);
+ if k == self.type_default_value(k.ty) {
+ trace!("would emit else_body {:#?}", else_body);
+ } else {
+ trace!("would emit main_body {:#?}", main_body);
+ }
+ }
_ => return self.unimp_msg("code generation for", hir),
}
}
