Lines Matching refs:type
19 e->type = E_SYMBOL; in expr_alloc_symbol()
24 struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) in expr_alloc_one() argument
28 e->type = type; in expr_alloc_one()
33 struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) in expr_alloc_two() argument
37 e->type = type; in expr_alloc_two()
43 struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) in expr_alloc_comp() argument
47 e->type = type; in expr_alloc_comp()
76 switch (org->type) { in expr_copy()
95 printf("can't copy type %d\n", e->type); in expr_copy()
109 switch (e->type) { in expr_free()
124 printf("how to free type %d?\n", e->type); in expr_free()
135 static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct expr **ep2) in __expr_eliminate_eq() argument
137 if (e1->type == type) { in __expr_eliminate_eq()
138 __expr_eliminate_eq(type, &e1->left.expr, &e2); in __expr_eliminate_eq()
139 __expr_eliminate_eq(type, &e1->right.expr, &e2); in __expr_eliminate_eq()
142 if (e2->type == type) { in __expr_eliminate_eq()
143 __expr_eliminate_eq(type, &e1, &e2->left.expr); in __expr_eliminate_eq()
144 __expr_eliminate_eq(type, &e1, &e2->right.expr); in __expr_eliminate_eq()
147 if (e1->type == E_SYMBOL && e2->type == E_SYMBOL && in __expr_eliminate_eq()
154 switch (type) { in __expr_eliminate_eq()
172 switch (e1->type) { in expr_eliminate_eq()
175 __expr_eliminate_eq(e1->type, ep1, ep2); in expr_eliminate_eq()
179 if (e1->type != e2->type) switch (e2->type) { in expr_eliminate_eq()
182 __expr_eliminate_eq(e2->type, ep1, ep2); in expr_eliminate_eq()
197 if (e1->type != e2->type) in expr_eq()
199 switch (e1->type) { in expr_eq()
213 res = (e1->type == E_SYMBOL && e2->type == E_SYMBOL && in expr_eq()
239 if (e) switch (e->type) { in expr_eliminate_yn()
243 if (e->left.expr->type == E_SYMBOL) { in expr_eliminate_yn()
247 e->type = E_SYMBOL; in expr_eliminate_yn()
259 if (e->right.expr->type == E_SYMBOL) { in expr_eliminate_yn()
263 e->type = E_SYMBOL; in expr_eliminate_yn()
279 if (e->left.expr->type == E_SYMBOL) { in expr_eliminate_yn()
289 e->type = E_SYMBOL; in expr_eliminate_yn()
295 if (e->right.expr->type == E_SYMBOL) { in expr_eliminate_yn()
305 e->type = E_SYMBOL; in expr_eliminate_yn()
325 switch (e->type) { in expr_trans_bool()
334 if (e->left.sym->type == S_TRISTATE) { in expr_trans_bool()
336 e->type = E_SYMBOL; in expr_trans_bool()
357 if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) in expr_join_or()
359 if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) in expr_join_or()
361 if (e1->type == E_NOT) { in expr_join_or()
363 if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) in expr_join_or()
368 if (e2->type == E_NOT) { in expr_join_or()
369 if (e2->left.expr->type != E_SYMBOL) in expr_join_or()
376 if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) in expr_join_or()
378 if (sym1->type == S_TRISTATE) { in expr_join_or()
379 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
385 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
391 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
398 if (sym1->type == S_BOOLEAN && sym1 == sym2) { in expr_join_or()
399 if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) || in expr_join_or()
400 (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL)) in expr_join_or()
421 if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) in expr_join_and()
423 if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) in expr_join_and()
425 if (e1->type == E_NOT) { in expr_join_and()
427 if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) in expr_join_and()
432 if (e2->type == E_NOT) { in expr_join_and()
433 if (e2->left.expr->type != E_SYMBOL) in expr_join_and()
440 if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) in expr_join_and()
443 if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) || in expr_join_and()
444 (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes)) in expr_join_and()
448 if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) || in expr_join_and()
449 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no)) in expr_join_and()
453 if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) || in expr_join_and()
454 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod)) in expr_join_and()
458 if (sym1->type == S_TRISTATE) { in expr_join_and()
459 if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { in expr_join_and()
466 if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) { in expr_join_and()
473 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
479 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
485 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
491 if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) || in expr_join_and()
492 (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) || in expr_join_and()
493 (e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) || in expr_join_and()
494 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) in expr_join_and()
508 static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct expr **ep2) in expr_eliminate_dups1() argument
514 if (e1->type == type) { in expr_eliminate_dups1()
515 expr_eliminate_dups1(type, &e1->left.expr, &e2); in expr_eliminate_dups1()
516 expr_eliminate_dups1(type, &e1->right.expr, &e2); in expr_eliminate_dups1()
519 if (e2->type == type) { in expr_eliminate_dups1()
520 expr_eliminate_dups1(type, &e1, &e2->left.expr); in expr_eliminate_dups1()
521 expr_eliminate_dups1(type, &e1, &e2->right.expr); in expr_eliminate_dups1()
527 switch (e1->type) { in expr_eliminate_dups1()
529 expr_eliminate_dups1(e1->type, &e1, &e1); in expr_eliminate_dups1()
534 switch (type) { in expr_eliminate_dups1()
560 static void expr_eliminate_dups2(enum expr_type type, struct expr **ep1, struct expr **ep2) in expr_eliminate_dups2() argument
566 if (e1->type == type) { in expr_eliminate_dups2()
567 expr_eliminate_dups2(type, &e1->left.expr, &e2); in expr_eliminate_dups2()
568 expr_eliminate_dups2(type, &e1->right.expr, &e2); in expr_eliminate_dups2()
571 if (e2->type == type) { in expr_eliminate_dups2()
572 expr_eliminate_dups2(type, &e1, &e2->left.expr); in expr_eliminate_dups2()
573 expr_eliminate_dups2(type, &e1, &e2->right.expr); in expr_eliminate_dups2()
578 switch (e1->type) { in expr_eliminate_dups2()
580 expr_eliminate_dups2(e1->type, &e1, &e1); in expr_eliminate_dups2()
595 expr_eliminate_dups2(e1->type, &e1, &e1); in expr_eliminate_dups2()
625 switch (e->type) { in expr_eliminate_dups()
627 expr_eliminate_dups1(e->type, &e, &e); in expr_eliminate_dups()
628 expr_eliminate_dups2(e->type, &e, &e); in expr_eliminate_dups()
646 switch (e->type) { in expr_transform()
657 switch (e->type) { in expr_transform()
659 if (e->left.sym->type != S_BOOLEAN) in expr_transform()
662 e->type = E_NOT; in expr_transform()
669 e->type = E_SYMBOL; in expr_transform()
675 e->type = E_SYMBOL; in expr_transform()
681 if (e->left.sym->type != S_BOOLEAN) in expr_transform()
684 e->type = E_SYMBOL; in expr_transform()
690 e->type = E_SYMBOL; in expr_transform()
696 e->type = E_NOT; in expr_transform()
703 switch (e->left.expr->type) { in expr_transform()
718 e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL; in expr_transform()
723 e->type = E_AND; in expr_transform()
725 tmp->type = E_NOT; in expr_transform()
732 e->type = E_OR; in expr_transform()
734 tmp->type = E_NOT; in expr_transform()
744 e->type = E_SYMBOL; in expr_transform()
753 e->type = E_SYMBOL; in expr_transform()
762 e->type = E_SYMBOL; in expr_transform()
782 switch (dep->type) { in expr_contains_symbol()
806 switch (dep->type) { in expr_depends_symbol()
852 void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2) in expr_extract_eq() argument
856 if (e1->type == type) { in expr_extract_eq()
857 expr_extract_eq(type, ep, &e1->left.expr, &e2); in expr_extract_eq()
858 expr_extract_eq(type, ep, &e1->right.expr, &e2); in expr_extract_eq()
861 if (e2->type == type) { in expr_extract_eq()
862 expr_extract_eq(type, ep, ep1, &e2->left.expr); in expr_extract_eq()
863 expr_extract_eq(type, ep, ep1, &e2->right.expr); in expr_extract_eq()
867 *ep = *ep ? expr_alloc_two(type, *ep, e1) : e1; in expr_extract_eq()
869 if (type == E_AND) { in expr_extract_eq()
872 } else if (type == E_OR) { in expr_extract_eq()
881 struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym) in expr_trans_compare() argument
887 if (type == E_UNEQUAL) in expr_trans_compare()
891 switch (e->type) { in expr_trans_compare()
899 if (type == E_UNEQUAL) in expr_trans_compare()
909 if (type == E_UNEQUAL) in expr_trans_compare()
913 return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym); in expr_trans_compare()
916 if (type == E_EQUAL) { in expr_trans_compare()
933 return expr_alloc_comp(type, e->left.sym, sym); in expr_trans_compare()
950 switch (e->type) { in expr_calc_value()
978 printf("expr_calc_value: %d?\n", e->type); in expr_calc_value()
1022 if (expr_compare_type(prevtoken, e->type) > 0) in expr_print()
1024 switch (e->type) { in expr_print()
1072 sprintf(buf, "<unknown type %d>", e->type); in expr_print()
1077 if (expr_compare_type(prevtoken, e->type) > 0) in expr_print()