Skip to content

Commit

Permalink
add docs on if
Browse files Browse the repository at this point in the history
  • Loading branch information
edg-l committed Jan 15, 2024
1 parent 6ca3d15 commit f42c92f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/concrete_codegen_mlir/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ fn compile_function_def<'ctx, 'parent: 'ctx>(
))
}

/// Compile a if expression / statement
///
/// This returns a block if any branch doesn't have a function return terminator.
/// For example, if the if branch has a return and the else branch has a return,
/// it wouldn't make sense to add a merging block and MLIR would give a error saying there is a operation after a terminator.
///
/// The returned block is the merger block, the one we jump after processing the if branches.
///
/// ```text
/// - then block -
/// - if (prev block) - < > merge block --
/// - else block -
/// ```
fn compile_if_expr<'c, 'this: 'c>(
session: &Session,
context: &'c MeliorContext,
Expand Down

0 comments on commit f42c92f

Please sign in to comment.