Lines Matching refs:code
6 * modification, are permitted provided that: (1) source code distributions
8 * distributions including binary code include the above copyright notice and
73 * Currently, the use-def code assumes only one definition per instruction.
86 * Rather than traverse the code array, marking each item, 'cur_mark' is
369 register int c = s->code;
415 if (s->code == NOP)
418 switch (BPF_CLASS(s->code)) {
432 return BPF_MISCOP(s->code) == BPF_TAX ? X_ATOM : A_ATOM;
457 if (s->s.code == NOP)
481 if (BPF_CLASS(b->s.code) == BPF_JMP) {
543 int code;
577 F(code, v0, v1)
578 int code;
585 hash = (u_int)code ^ (v0 << 4) ^ (v1 << 8);
589 if (p->code == code && p->v0 == v0 && p->v1 == v1)
593 if (BPF_MODE(code) == BPF_IMM &&
594 (BPF_CLASS(code) == BPF_LD || BPF_CLASS(code) == BPF_LDX)) {
600 p->code = code;
617 s->code = NOP;
632 switch (BPF_OP(s->code)) {
675 s->code = BPF_LD|BPF_IMM;
683 while (s != 0 && s->s.code == NOP)
732 if (s->s.code == BPF_ST &&
733 next->s.code == (BPF_LDX|BPF_MEM) &&
736 next->s.code = BPF_MISC|BPF_TAX;
742 if (s->s.code == (BPF_LD|BPF_IMM) &&
743 next->s.code == (BPF_MISC|BPF_TAX)) {
744 s->s.code = BPF_LDX|BPF_IMM;
745 next->s.code = BPF_MISC|BPF_TXA;
752 if (s->s.code == (BPF_LD|BPF_IMM)) {
758 * We know the code generator won't generate
770 if (next->s.code != (BPF_LDX|BPF_MSH|BPF_B))
774 if (add == 0 || add->s.code != (BPF_ALU|BPF_ADD|BPF_X))
782 if (tax == 0 || tax->s.code != (BPF_MISC|BPF_TAX))
790 if (ild == 0 || BPF_CLASS(ild->s.code) != BPF_LD ||
791 BPF_MODE(ild->s.code) != BPF_IND)
822 s->s.code = NOP;
823 add->s.code = NOP;
824 tax->s.code = NOP;
835 if (b->s.code == (BPF_JMP|BPF_JEQ|BPF_K) &&
841 if (last->s.code == (BPF_ALU|BPF_SUB|BPF_X)) {
854 last->s.code = NOP;
866 last->s.code = NOP;
867 b->s.code = BPF_JMP|BPF_JEQ|BPF_X;
877 else if (last->s.code == (BPF_ALU|BPF_SUB|BPF_K)) {
878 last->s.code = NOP;
889 else if (last->s.code == (BPF_ALU|BPF_AND|BPF_K) &&
892 b->s.code = BPF_JMP|BPF_K|BPF_JSET;
893 last->s.code = NOP;
902 if (b->s.code == (BPF_JMP|BPF_K|BPF_JSET)) {
913 if (vmap[val].is_const && BPF_SRC(b->s.code) == BPF_K) {
915 switch (BPF_OP(b->s.code)) {
948 * do various optimizations. This code would be cleaner if symbolic
949 * evaluation and code transformations weren't folded together.
960 switch (s->code) {
965 v = F(s->code, s->k, 0L);
974 s->code = BPF_LD|BPF_ABS|BPF_SIZE(s->code);
976 v = F(s->code, s->k, 0L);
980 v = F(s->code, s->k, v);
985 v = F(s->code, 0L, 0L);
1000 v = F(s->code, s->k, 0L);
1006 s->code = BPF_LD|BPF_IMM;
1011 val[A_ATOM] = F(s->code, val[A_ATOM], 0L);
1022 op = BPF_OP(s->code);
1027 * fixup the generated math code */
1031 s->code = NOP;
1035 s->code = BPF_LD|BPF_IMM;
1046 val[A_ATOM] = F(s->code, val[A_ATOM], K(s->k));
1057 op = BPF_OP(s->code);
1064 s->code = BPF_ALU|BPF_K|op;
1068 F(s->code, val[A_ATOM], K(s->k));
1082 s->code = BPF_MISC|BPF_TXA;
1088 s->code = BPF_LD|BPF_IMM;
1094 s->code = NOP;
1098 val[A_ATOM] = F(s->code, val[A_ATOM], val[X_ATOM]);
1108 s->code = BPF_LD|BPF_IMM;
1122 s->code = BPF_LDX|BPF_IMM;
1159 last[atom]->code = NOP;
1181 last[atom]->code = NOP;
1198 if (BPF_CLASS(s->s.code) == BPF_JMP) {
1267 BPF_CLASS(b->s.code) == BPF_RET)) {
1279 if (BPF_SRC(b->s.code) == BPF_K)
1283 b->et.code = b->s.code;
1284 b->ef.code = -b->s.code;
1316 int code = ep->code;
1318 if (code < 0) {
1319 code = -code;
1324 if (child->s.code != code)
1343 if (sense && code == (BPF_JMP|BPF_JEQ|BPF_K))
1479 between dp0 and dp1. Currently, the code generator
1571 between diffp and samep. Currently, the code generator
1683 while (BPF_CLASS((*b)->s.code) == BPF_JMP && JT(*b) == JF(*b))
1696 if (BPF_CLASS((*b)->s.code) == BPF_RET)
1730 * Optimize the filter code in its dag representation.
1766 if (BPF_CLASS(p->s.code) != BPF_RET) {
1774 * Mark code array such that isMarked(i) is true
1794 while (x && x->s.code == NOP)
1796 while (y && y->s.code == NOP)
1802 if (x->s.code != y->s.code || x->s.k != y->s.k)
1813 if (b0->s.code == b1->s.code &&
1886 if (s->s.code != NOP)
2045 * Some pointers used to convert the basic block form of the code,
2107 if (src->s.code == NOP)
2109 dst->code = (u_short)src->s.code;
2113 if (BPF_CLASS(src->s.code) != BPF_JMP || src->s.code == (BPF_JMP|BPF_JA)) {
2131 printf("code=%x off=%d %x %x\n", src->s.code,
2175 dst->code = (u_short)p->s.code;
2190 dst[extrajmps].code = BPF_JMP|BPF_JA;
2207 dst[extrajmps].code = BPF_JMP|BPF_JA;