Skip to content

Commit

Permalink
Update codegen_for_cond_exprs.md
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmuth authored Jul 31, 2024
1 parent acfc669 commit e7889f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions FrontEndDocs/codegen_for_cond_exprs.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def EmitConditional(cond, label_true, label_false):
elif cond is-a ExprBinary:
op1 = EmitExpr(cond.expr1) # op1 contains the register/var with value of cond.expr1
op2 = EmitExpr(cond.expr2) # similar as above
Emit(" b{AstCmpToAsmCmp(cond.kind)} {op1} {op2} {label_true}")
Emit(" bra {label_false}")
Emit(f" b{AstCmpToAsmCmp(cond.kind)} {op1} {op2} {label_true}")
Emit(f" bra {label_false}")
elif cond is-a Expr&&:
label_and = NewLabel()
EmitConditional(cond.expr1, label_and, label_false)
Emit(f"{label_and}:")
EmitConditional(cond.expr2, label_true, label_false)
elif kind is cwast.BINARY_EXPR_KIND.ORSC:
elif kind is-a Expr||:
label_or = NewLabel()
EmitConditional(cond.expr1, label_true, label_or)
Emit(f"{label_or}:")
Expand Down Expand Up @@ -145,4 +145,4 @@ def EmitIRConditional(cond, invert, label_false):
EmitConditional(cond.expr2, False, label_false)
else:
assert False, f"unexpected node {cond}"
```
```

0 comments on commit e7889f2

Please sign in to comment.