1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-15 17:30:06 +00:00

No more unnecessary jump-over labels generated for logical OR false cases.

This commit is contained in:
acqn 2021-04-17 16:50:59 +08:00 committed by Oliver Schmidt
parent 1f4ce41846
commit 71bd6415d6

View File

@ -3757,7 +3757,6 @@ static void hieOr (ExprDesc *Expr)
unsigned Flags = Expr->Flags & E_MASK_KEEP_SUBEXPR;
int AndOp; /* Did we have a && operation? */
unsigned TrueLab; /* Jump to this label if true */
unsigned DoneLab;
int HasTrueJump = 0;
CodeMark Start;
@ -3884,19 +3883,23 @@ static void hieOr (ExprDesc *Expr)
/* If we really had boolean ops, generate the end sequence if necessary */
if (HasTrueJump) {
/* False case needs to jump over true case */
DoneLab = GetLocalLabel ();
if ((Flags & E_EVAL_UNEVAL) != E_EVAL_UNEVAL) {
/* False case needs to jump over true case */
unsigned DoneLab = GetLocalLabel ();
/* Load false only if the result is not true */
g_getimmed (CF_INT | CF_CONST, 0, 0); /* Load FALSE */
g_falsejump (CF_NONE, DoneLab);
/* Load the true value */
g_defcodelabel (TrueLab);
g_getimmed (CF_INT | CF_CONST, 1, 0); /* Load TRUE */
g_defcodelabel (DoneLab);
} else {
/* Load the true value */
g_defcodelabel (TrueLab);
g_getimmed (CF_INT | CF_CONST, 1, 0); /* Load TRUE */
}
/* Load the true value */
g_defcodelabel (TrueLab);
g_getimmed (CF_INT | CF_CONST, 1, 0); /* Load TRUE */
g_defcodelabel (DoneLab);
/* The result is an rvalue in primary */
ED_FinalizeRValLoad (Expr);
/* Condition codes are set */