processClause :: AST.Name -> ((AST.Operand, AST.Name), AST.Name) -> S.Expr -> Codegen ((AST.Operand, AST.Name), AST.Name)
processClause exitBlock nextPhi (S.Clause cond code) = do
    let nextBlock = snd nextPhi

    caseTestBlock <- addBlock "case.test.block"
    caseCodeBlock <- addBlock "case.code.block"

    setBlock caseTestBlock
    cond <- cgen cond
    test <- fcmp FP.ONE false cond
    cbr test caseCodeBlock nextBlock
    caseTestBlock <- getBlock

    setBlock caseCodeBlock
    val <- cgen code       -- Generate code for the condition
    br exitBlock
    caseCodeBlock <- getBlock

    return ((val, caseCodeBlock), caseTestBlock)


-------------------------------------------------------------------------------
-- Compilation
-------------------------------------------------------------------------------
processClause :: AST.Name -> ((AST.Operand, AST.Name), AST.Name) -> S.Expr -> Codegen ((AST.Operand, AST.Name), AST.Name)
processClause exitBlock nextPhi (S.Clause cond code) = do
    let nextBlock = snd nextPhi

    caseTestBlock <- addBlock "case.test.block"
    caseCodeBlock <- addBlock "case.code.block"

    setBlock caseTestBlock
    cond <- cgen cond
    test <- fcmp FP.ONE false cond
    cbr test caseCodeBlock nextBlock
    caseTestBlock <- getBlock

    setBlock caseCodeBlock
    val <- cgen code       -- Generate code for the condition
    br exitBlock
    caseCodeBlock <- getBlock

    return ((val, caseCodeBlock), caseTestBlock)


-------------------------------------------------------------------------------
-- Compilation
-------------------------------------------------------------------------------
processClause exitBlock nextPhi (S.Clause cond code) = do
    let nextBlock = snd nextPhi

    caseTestBlock <- addBlock "case.test.block"
    caseCodeBlock <- addBlock "case.code.block"

    setBlock caseTestBlock
    cond <- cgen cond
    test <- fcmp FP.ONE false cond
    cbr test caseCodeBlock nextBlock
    caseTestBlock <- getBlock

    setBlock caseCodeBlock
    val <- cgen code       -- Generate code for the condition
    br exitBlock
    caseCodeBlock <- getBlock

    return ((val, caseCodeBlock), caseTestBlock)


-------------------------------------------------------------------------------
-- Compilation
-------------------------------------------------------------------------------