diff --git a/src/x86/dumberdowner.c b/src/x86/dumberdowner.c index 071e623..c2579a5 100644 --- a/src/x86/dumberdowner.c +++ b/src/x86/dumberdowner.c @@ -109,6 +109,10 @@ static void mark_d(ScopeItem *si) { } } +/* + * RULE ONE OF DUMBING: NEVER xopify NOR varify MORE THAN ONCE IN A SINGLE CALL TO VISITOR!!! + * IF YOU DO THIS, stmtPrev WILL FUCK UP AND STATEMENTS WILL BE LOST + */ struct DumbenState { AST *targetTLC; int effective; @@ -129,14 +133,10 @@ static void dumben_visitor(AST **nptr, AST *stmt, AST *stmtPrev, AST *chu, AST * if(is_xop(e->exprBinOp.operands[0]) == XOP_NOT_XOP) { e->exprBinOp.operands[0] = xopify(tlc, chu, stmtPrev, s, e->exprBinOp.operands[0]); this->effective = 1; - } - - if(is_xop(e->exprBinOp.operands[1]) == XOP_NOT_XOP) { + } else if(is_xop(e->exprBinOp.operands[1]) == XOP_NOT_XOP) { e->exprBinOp.operands[1] = xopify(tlc, chu, stmtPrev, s, e->exprBinOp.operands[1]); this->effective = 1; - } - - if(is_xop(e->exprBinOp.operands[0]) == XOP_MEM && is_xop(e->exprBinOp.operands[1]) == XOP_MEM) { + } else if(is_xop(e->exprBinOp.operands[0]) == XOP_MEM && is_xop(e->exprBinOp.operands[1]) == XOP_MEM) { // Can't have two mems; put one in var e->exprBinOp.operands[1] = varify(tlc, chu, stmtPrev, s, e->exprBinOp.operands[1]); @@ -164,7 +164,7 @@ static void dumben_visitor(AST **nptr, AST *stmt, AST *stmtPrev, AST *chu, AST * ast_denoop(tlc, &s->stmtJump.condition); this->effective = 1; - + } else if(e->nodeKind == AST_EXPR_BINARY_OP && e->exprBinOp.operator == BINOP_LOGICAL_OR) { AST *cond0 = e->exprBinOp.operands[0];