Lines Matching refs:e2
14 static int expr_eq(struct expr *e1, struct expr *e2);
33 struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) in expr_alloc_two() argument
38 e->right.expr = e2; in expr_alloc_two()
51 struct expr *expr_alloc_and(struct expr *e1, struct expr *e2) in expr_alloc_and() argument
54 return e2; in expr_alloc_and()
55 return e2 ? expr_alloc_two(E_AND, e1, e2) : e1; in expr_alloc_and()
58 struct expr *expr_alloc_or(struct expr *e1, struct expr *e2) in expr_alloc_or() argument
61 return e2; in expr_alloc_or()
62 return e2 ? expr_alloc_two(E_OR, e1, e2) : e1; in expr_alloc_or()
139 #define e2 (*ep2) macro
154 __expr_eliminate_eq(type, &e1->left.expr, &e2); in __expr_eliminate_eq()
155 __expr_eliminate_eq(type, &e1->right.expr, &e2); in __expr_eliminate_eq()
158 if (e2->type == type) { in __expr_eliminate_eq()
159 __expr_eliminate_eq(type, &e1, &e2->left.expr); in __expr_eliminate_eq()
160 __expr_eliminate_eq(type, &e1, &e2->right.expr); in __expr_eliminate_eq()
166 if (e1->type == E_SYMBOL && e2->type == E_SYMBOL && in __expr_eliminate_eq()
167 e1->left.sym == e2->left.sym && in __expr_eliminate_eq()
170 if (!expr_eq(e1, e2)) in __expr_eliminate_eq()
176 expr_free(e1); expr_free(e2); in __expr_eliminate_eq()
180 e2 = expr_alloc_symbol(&symbol_no); in __expr_eliminate_eq()
184 e2 = expr_alloc_symbol(&symbol_yes); in __expr_eliminate_eq()
222 if (!e1 || !e2) in expr_eliminate_eq()
231 if (e1->type != e2->type) switch (e2->type) { in expr_eliminate_eq()
234 __expr_eliminate_eq(e2->type, ep1, ep2); in expr_eliminate_eq()
239 e2 = expr_eliminate_yn(e2); in expr_eliminate_eq()
243 #undef e2
251 static int expr_eq(struct expr *e1, struct expr *e2) in expr_eq() argument
255 if (e1->type != e2->type) in expr_eq()
264 return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym; in expr_eq()
266 return e1->left.sym == e2->left.sym; in expr_eq()
268 return expr_eq(e1->left.expr, e2->left.expr); in expr_eq()
272 e2 = expr_copy(e2); in expr_eq()
274 expr_eliminate_eq(&e1, &e2); in expr_eq()
275 res = (e1->type == E_SYMBOL && e2->type == E_SYMBOL && in expr_eq()
276 e1->left.sym == e2->left.sym); in expr_eq()
278 expr_free(e2); in expr_eq()
290 expr_fprint(e2, stdout); in expr_eq()
423 static struct expr *expr_join_or(struct expr *e1, struct expr *e2) in expr_join_or() argument
428 if (expr_eq(e1, e2)) in expr_join_or()
432 if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) in expr_join_or()
441 if (e2->type == E_NOT) { in expr_join_or()
442 if (e2->left.expr->type != E_SYMBOL) in expr_join_or()
444 sym2 = e2->left.expr->left.sym; in expr_join_or()
446 sym2 = e2->left.sym; in expr_join_or()
452 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
453 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || in expr_join_or()
454 (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) { in expr_join_or()
458 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
459 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || in expr_join_or()
460 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) { in expr_join_or()
464 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
465 ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || in expr_join_or()
466 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) { in expr_join_or()
472 if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) || in expr_join_or()
473 (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL)) in expr_join_or()
481 expr_fprint(e2, stdout); in expr_join_or()
487 static struct expr *expr_join_and(struct expr *e1, struct expr *e2) in expr_join_and() argument
492 if (expr_eq(e1, e2)) in expr_join_and()
496 if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) in expr_join_and()
505 if (e2->type == E_NOT) { in expr_join_and()
506 if (e2->left.expr->type != E_SYMBOL) in expr_join_and()
508 sym2 = e2->left.expr->left.sym; in expr_join_and()
510 sym2 = e2->left.sym; in expr_join_and()
516 if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) || in expr_join_and()
517 (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes)) in expr_join_and()
521 if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) || in expr_join_and()
522 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no)) in expr_join_and()
526 if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) || in expr_join_and()
527 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod)) in expr_join_and()
532 if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { in expr_join_and()
535 if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) in expr_join_and()
536 return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) in expr_join_and()
539 if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) { in expr_join_and()
541 sym2 = e2->right.sym; in expr_join_and()
546 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
547 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || in expr_join_and()
548 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) in expr_join_and()
552 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
553 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || in expr_join_and()
554 (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) in expr_join_and()
558 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
559 ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || in expr_join_and()
560 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) in expr_join_and()
564 if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) || in expr_join_and()
565 (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) || in expr_join_and()
566 (e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) || in expr_join_and()
567 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) in expr_join_and()
575 expr_fprint(e2, stdout); in expr_join_and()
591 #define e2 (*ep2) in expr_eliminate_dups1() macro
597 expr_eliminate_dups1(type, &e1->left.expr, &e2); in expr_eliminate_dups1()
598 expr_eliminate_dups1(type, &e1->right.expr, &e2); in expr_eliminate_dups1()
601 if (e2->type == type) { in expr_eliminate_dups1()
602 expr_eliminate_dups1(type, &e1, &e2->left.expr); in expr_eliminate_dups1()
603 expr_eliminate_dups1(type, &e1, &e2->right.expr); in expr_eliminate_dups1()
609 if (e1 == e2) in expr_eliminate_dups1()
621 tmp = expr_join_or(e1, e2); in expr_eliminate_dups1()
623 expr_free(e1); expr_free(e2); in expr_eliminate_dups1()
625 e2 = tmp; in expr_eliminate_dups1()
630 tmp = expr_join_and(e1, e2); in expr_eliminate_dups1()
632 expr_free(e1); expr_free(e2); in expr_eliminate_dups1()
634 e2 = tmp; in expr_eliminate_dups1()
642 #undef e2 in expr_eliminate_dups1()
916 struct expr *e1, *e2; in expr_trans_compare() local
927 e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); in expr_trans_compare()
929 e = expr_alloc_two(E_AND, e1, e2); in expr_trans_compare()
931 e = expr_alloc_two(E_OR, e1, e2); in expr_trans_compare()
937 e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); in expr_trans_compare()
939 e = expr_alloc_two(E_OR, e1, e2); in expr_trans_compare()
941 e = expr_alloc_two(E_AND, e1, e2); in expr_trans_compare()