Lines Matching refs:e1

34 struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)  in expr_alloc_two()  argument
38 e->left.expr = e1; in expr_alloc_two()
52 struct expr *expr_alloc_and(struct expr *e1, struct expr *e2) in expr_alloc_and() argument
54 if (!e1) in expr_alloc_and()
56 return e2 ? expr_alloc_two(E_AND, e1, e2) : e1; in expr_alloc_and()
59 struct expr *expr_alloc_or(struct expr *e1, struct expr *e2) in expr_alloc_or() argument
61 if (!e1) in expr_alloc_or()
63 return e2 ? expr_alloc_two(E_OR, e1, e2) : e1; in expr_alloc_or()
139 #define e1 (*ep1) macro
154 if (e1->type == type) { in __expr_eliminate_eq()
155 __expr_eliminate_eq(type, &e1->left.expr, &e2); in __expr_eliminate_eq()
156 __expr_eliminate_eq(type, &e1->right.expr, &e2); in __expr_eliminate_eq()
160 __expr_eliminate_eq(type, &e1, &e2->left.expr); in __expr_eliminate_eq()
161 __expr_eliminate_eq(type, &e1, &e2->right.expr); in __expr_eliminate_eq()
167 if (e1->type == E_SYMBOL && e2->type == E_SYMBOL && in __expr_eliminate_eq()
168 e1->left.sym == e2->left.sym && in __expr_eliminate_eq()
169 (e1->left.sym == &symbol_yes || e1->left.sym == &symbol_no)) in __expr_eliminate_eq()
171 if (!expr_eq(e1, e2)) in __expr_eliminate_eq()
177 expr_free(e1); expr_free(e2); in __expr_eliminate_eq()
180 e1 = expr_alloc_symbol(&symbol_no); in __expr_eliminate_eq()
184 e1 = expr_alloc_symbol(&symbol_yes); in __expr_eliminate_eq()
223 if (!e1 || !e2) in expr_eliminate_eq()
225 switch (e1->type) { in expr_eliminate_eq()
228 __expr_eliminate_eq(e1->type, ep1, ep2); in expr_eliminate_eq()
232 if (e1->type != e2->type) switch (e2->type) { in expr_eliminate_eq()
239 e1 = expr_eliminate_yn(e1); in expr_eliminate_eq()
243 #undef e1
252 int expr_eq(struct expr *e1, struct expr *e2) in expr_eq() argument
260 if (!e1 || !e2) in expr_eq()
261 return expr_is_yes(e1) && expr_is_yes(e2); in expr_eq()
263 if (e1->type != e2->type) in expr_eq()
265 switch (e1->type) { in expr_eq()
272 return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym; in expr_eq()
274 return e1->left.sym == e2->left.sym; in expr_eq()
276 return expr_eq(e1->left.expr, e2->left.expr); in expr_eq()
279 e1 = expr_copy(e1); in expr_eq()
282 expr_eliminate_eq(&e1, &e2); in expr_eq()
283 res = (e1->type == E_SYMBOL && e2->type == E_SYMBOL && in expr_eq()
284 e1->left.sym == e2->left.sym); in expr_eq()
285 expr_free(e1); in expr_eq()
296 expr_fprint(e1, stdout); in expr_eq()
431 static struct expr *expr_join_or(struct expr *e1, struct expr *e2) in expr_join_or() argument
436 if (expr_eq(e1, e2)) in expr_join_or()
437 return expr_copy(e1); in expr_join_or()
438 if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) in expr_join_or()
442 if (e1->type == E_NOT) { in expr_join_or()
443 tmp = e1->left.expr; in expr_join_or()
448 sym1 = e1->left.sym; in expr_join_or()
460 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
461 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || in expr_join_or()
462 (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) { in expr_join_or()
466 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
467 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || in expr_join_or()
468 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) { in expr_join_or()
472 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
473 ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || in expr_join_or()
474 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) { in expr_join_or()
480 if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) || in expr_join_or()
481 (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL)) in expr_join_or()
487 expr_fprint(e1, stdout); in expr_join_or()
495 static struct expr *expr_join_and(struct expr *e1, struct expr *e2) in expr_join_and() argument
500 if (expr_eq(e1, e2)) in expr_join_and()
501 return expr_copy(e1); in expr_join_and()
502 if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) in expr_join_and()
506 if (e1->type == E_NOT) { in expr_join_and()
507 tmp = e1->left.expr; in expr_join_and()
512 sym1 = e1->left.sym; in expr_join_and()
524 if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) || in expr_join_and()
525 (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes)) in expr_join_and()
529 if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) || in expr_join_and()
530 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no)) in expr_join_and()
534 if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) || in expr_join_and()
535 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod)) in expr_join_and()
540 if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { in expr_join_and()
542 sym2 = e1->right.sym; in expr_join_and()
547 if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) { in expr_join_and()
550 if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) in expr_join_and()
551 return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) in expr_join_and()
554 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
555 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || in expr_join_and()
556 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) in expr_join_and()
560 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
561 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || in expr_join_and()
562 (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) in expr_join_and()
566 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
567 ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || in expr_join_and()
568 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) in expr_join_and()
572 if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) || in expr_join_and()
573 (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) || in expr_join_and()
574 (e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) || in expr_join_and()
575 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) in expr_join_and()
581 expr_fprint(e1, stdout); in expr_join_and()
598 #define e1 (*ep1) in expr_eliminate_dups1() macro
604 if (e1->type == type) { in expr_eliminate_dups1()
605 expr_eliminate_dups1(type, &e1->left.expr, &e2); in expr_eliminate_dups1()
606 expr_eliminate_dups1(type, &e1->right.expr, &e2); in expr_eliminate_dups1()
610 expr_eliminate_dups1(type, &e1, &e2->left.expr); in expr_eliminate_dups1()
611 expr_eliminate_dups1(type, &e1, &e2->right.expr); in expr_eliminate_dups1()
617 if (e1 == e2) in expr_eliminate_dups1()
620 switch (e1->type) { in expr_eliminate_dups1()
622 expr_eliminate_dups1(e1->type, &e1, &e1); in expr_eliminate_dups1()
629 tmp = expr_join_or(e1, e2); in expr_eliminate_dups1()
631 expr_free(e1); expr_free(e2); in expr_eliminate_dups1()
632 e1 = expr_alloc_symbol(&symbol_no); in expr_eliminate_dups1()
638 tmp = expr_join_and(e1, e2); in expr_eliminate_dups1()
640 expr_free(e1); expr_free(e2); in expr_eliminate_dups1()
641 e1 = expr_alloc_symbol(&symbol_yes); in expr_eliminate_dups1()
649 #undef e1 in expr_eliminate_dups1()
924 struct expr *e1, *e2; in expr_trans_compare() local
934 e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); in expr_trans_compare()
937 e = expr_alloc_two(E_AND, e1, e2); in expr_trans_compare()
939 e = expr_alloc_two(E_OR, e1, e2); in expr_trans_compare()
944 e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); in expr_trans_compare()
947 e = expr_alloc_two(E_OR, e1, e2); in expr_trans_compare()
949 e = expr_alloc_two(E_AND, e1, e2); in expr_trans_compare()