Lines Matching refs:insn
117 void ir_print_const(const ir_ctx *ctx, const ir_insn *insn, FILE *f, bool quoted) argument
121 if (insn->op == IR_FUNC || insn->op == IR_SYM) {
122 fprintf(f, "%s", ir_get_str(ctx, insn->val.name));
124 } else if (insn->op == IR_STR) {
126 const char *str = ir_get_strl(ctx, insn->val.str, &len);
137 IR_ASSERT(IR_IS_CONST_OP(insn->op) || insn->op == IR_FUNC_ADDR);
138 switch (insn->type) {
140 fprintf(f, "%u", insn->val.b);
143 fprintf(f, "%u", insn->val.u8);
146 fprintf(f, "%u", insn->val.u16);
149 fprintf(f, "%u", insn->val.u32);
152 fprintf(f, "%" PRIu64, insn->val.u64);
155 if (insn->val.addr) {
156 fprintf(f, "0x%" PRIxPTR, insn->val.addr);
162 if (insn->val.c == '\\') {
164 } else if (insn->val.c >= ' ') {
165 fprintf(f, "'%c'", insn->val.c);
166 } else if (insn->val.c == '\t') {
168 } else if (insn->val.c == '\r') {
170 } else if (insn->val.c == '\n') {
172 } else if (insn->val.c == '\0') {
175 fprintf(f, "%u", insn->val.c);
179 fprintf(f, "%d", insn->val.i8);
182 fprintf(f, "%d", insn->val.i16);
185 fprintf(f, "%d", insn->val.i32);
188 fprintf(f, "%" PRIi64, insn->val.i64);
191 if (isnan(insn->val.d)) {
194 snprintf(buf, sizeof(buf), "%g", insn->val.d);
195 if (strtod(buf, NULL) != insn->val.d) {
196 snprintf(buf, sizeof(buf), "%.53e", insn->val.d);
197 if (strtod(buf, NULL) != insn->val.d) {
205 if (isnan(insn->val.f)) {
208 snprintf(buf, sizeof(buf), "%g", insn->val.f);
209 if (strtod(buf, NULL) != insn->val.f) {
210 snprintf(buf, sizeof(buf), "%.24e", insn->val.f);
211 if (strtod(buf, NULL) != insn->val.f) {
462 ir_insn *insn = &ctx->ir_base[ref]; local
464 insn->optx = IR_OPT(IR_ADDR, IR_ADDR);
465 insn->val.u64 = addr;
467 insn->prev_const = IR_UNUSED;
469 insn->prev_const = ctx->prev_const_chain[IR_ADDR];
488 insn->prev_const = prev_insn->prev_const;
491 insn->prev_const = ctx->prev_const_chain[IR_ADDR];
501 ir_insn *insn, *prev_insn; local
512 insn = &ctx->ir_base[ref];
513 if (UNEXPECTED(insn->val.u64 >= val.u64)) {
514 if (insn->val.u64 == val.u64) {
515 if (insn->optx == optx) {
522 prev_insn = insn;
523 ref = insn->prev_const;
535 insn = &ctx->ir_base[ref];
536 insn->prev_const = prev;
538 insn->optx = optx;
539 insn->val.u64 = val.u64;
801 ir_insn *insn = &ctx->ir_base[ref]; local
803 insn->optx = opt;
804 insn->op1 = op1;
805 insn->op2 = op2;
806 insn->op3 = op3;
834 ir_insn *insn; local
849 insn = &ctx->ir_base[ref];
850 if (insn->opt == opt && insn->op1 == op1 && insn->op2 == op2 && insn->op3 == op3) {
853 if (!insn->prev_insn_offset) {
856 ref = ref - (ir_ref)(uint32_t)insn->prev_insn_offset;
989 ir_insn *insn = ctx->ir_base + ref; local
992 insn->prev_insn_offset = 0;
994 insn->prev_insn_offset = ref - prev;
1062 ir_insn *insn; local
1070 insn = &ctx->ir_base[ref];
1071 insn->optx = opt | (count << IR_OPT_INPUTS_SHIFT);
1072 for (i = 1, p = insn->ops + i; i <= (count|3); i++, p++) {
1081 ir_insn *insn = &ctx->ir_base[ref]; local
1087 IR_ASSERT(IR_OP_HAS_VAR_INPUTS(ir_op_flags[insn->op]));
1088 count = insn->inputs_count;
1092 ir_insn_set_op(insn, n, val);
1129 ir_insn *insn;
1135 for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) {
1136 uint32_t flags = ir_op_flags[insn->op];
1139 n = insn->inputs_count;
1141 n = insn->inputs_count = IR_INPUT_EDGES_COUNT(flags);
1143 for (j = n, p = insn->ops + 1; j > 0; j--, p++) {
1151 insn += n;
1162 for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) {
1163 n = insn->inputs_count;
1164 for (j = n, p = insn->ops + 1; j > 0; j--, p++) {
1173 insn += n;
1184 ir_insn *insn; local
1193 for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) {
1194 uint32_t flags = ir_op_flags[insn->op];
1197 n = insn->inputs_count;
1199 n = insn->inputs_count = IR_INPUT_EDGES_COUNT(flags);
1201 for (j = n, p = insn->ops + 1; j > 0; j--, p++) {
1226 insn += n;
1885 ir_insn *insn; local
1889 insn = &ctx->ir_base[ref];
1890 if (insn->op == IR_LOAD) {
1891 if (insn->op2 == addr) {
1892 if (insn->type == type) {
1894 } else if (ir_type_size[insn->type] == ir_type_size[type]) {
1896 } else if (ir_type_size[insn->type] > ir_type_size[type]
1897 && IR_IS_TYPE_INT(type) && IR_IS_TYPE_INT(insn->type)) {
1901 } else if (insn->op == IR_STORE) {
1902 ir_type type2 = ctx->ir_base[insn->op3].type;
1904 if (insn->op2 == addr) {
1905 if (ctx->ir_base[insn->op3].op == IR_RLOAD
1906 && (modified_regset & (1 << ctx->ir_base[insn->op3].op2))) {
1910 return insn->op3; /* store forwarding (S2L) */
1912 …return ir_fold1(ctx, IR_OPT(IR_BITCAST, type), insn->op3); /* store forwarding with bitcast (S2L) …
1915 return ir_fold1(ctx, IR_OPT(IR_TRUNC, type), insn->op3); /* partial store forwarding (S2L) */
1919 } else if (ir_check_partial_aliasing(ctx, addr, insn->op2, type, type2) != IR_NO_ALIAS) {
1922 } else if (insn->op == IR_RSTORE) {
1923 modified_regset |= (1 << insn->op3);
1924 …} else if (insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN || insn->op == IR_CALL || insn->op ==…
1927 ref = insn->op1;
2003 ir_insn *insn = &ctx->ir_base[phi]; local
2004 ir_ref *ops = insn->ops;
2006 IR_ASSERT(insn->op == IR_PHI);
2007 IR_ASSERT(ctx->ir_base[insn->op1].op == IR_MERGE || ctx->ir_base[insn->op1].op == IR_LOOP_BEGIN);
2008 IR_ASSERT(pos > 0 && pos < insn->inputs_count);
2046 ir_insn *insn = &ctx->ir_base[ref]; local
2048 if (insn->op == IR_NE && IR_IS_CONST_REF(insn->op2)) {
2049 ir_insn *op2_insn = &ctx->ir_base[insn->op2];
2052 return insn->op1;
2069 ir_insn *insn; local
2072 insn = &ctx->ir_base[ref];
2073 if (insn->op == IR_GUARD_NOT) {
2074 if (insn->op2 == condition) {
2078 } else if (insn->op == IR_GUARD) {
2079 if (insn->op2 == condition) {
2083 } else if (insn->op == IR_IF) {
2084 if (insn->op2 == condition) {
2093 } else if (insn->op == IR_START || insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN) {
2096 prev = insn;
2097 ref = insn->op1;
2175 ir_insn *insn = &ctx->ir_base[merge]; local
2176 ir_ref *ops = insn->ops;
2178 IR_ASSERT(insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN);
2179 IR_ASSERT(pos > 0 && pos <= insn->inputs_count);
2218 ir_insn *insn = &ctx->ir_base[ref]; local
2220 IR_ASSERT(insn->op == IR_END);
2221 ref = insn->op2;
2235 ir_insn *insn = &ctx->ir_base[ref]; local
2238 ref = insn->op2;
2239 insn->op2 = IR_UNUSED;
2619 ir_insn *insn; local
2622 insn = &ctx->ir_base[ref];
2623 if (insn->op == IR_GUARD) {
2624 if (insn->op2 == condition) {
2627 } else if (insn->op == IR_GUARD_NOT) {
2628 if (insn->op2 == condition) {
2632 } else if (insn->op == IR_IF) {
2633 if (insn->op2 == condition) {
2641 } else if (insn->op == IR_START || insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN) {
2644 prev = insn;
2645 ref = insn->op1;
2665 ir_insn *insn; local
2668 insn = &ctx->ir_base[ref];
2669 if (insn->op == IR_GUARD_NOT) {
2670 if (insn->op2 == condition) {
2673 } else if (insn->op == IR_GUARD) {
2674 if (insn->op2 == condition) {
2678 } else if (insn->op == IR_IF) {
2679 if (insn->op2 == condition) {
2687 } else if (insn->op == IR_START || insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN) {
2690 prev = insn;
2691 ref = insn->op1;
2713 ir_insn *insn = &ctx->ir_base[snapshot]; local
2714 ir_ref *ops = insn->ops;
2717 IR_ASSERT(insn->op == IR_SNAPSHOT);
2719 IR_ASSERT(pos > 1 && pos <= insn->inputs_count);
2744 ir_insn *insn; local
2747 insn = &ctx->ir_base[ref];
2748 if (insn->op == IR_VLOAD) {
2749 if (insn->op2 == var) {
2750 if (insn->type == type) {
2752 } else if (ir_type_size[insn->type] == ir_type_size[type]) {
2754 } else if (ir_type_size[insn->type] > ir_type_size[type]
2755 && IR_IS_TYPE_INT(type) && IR_IS_TYPE_INT(insn->type)) {
2759 } else if (insn->op == IR_VSTORE) {
2760 ir_type type2 = ctx->ir_base[insn->op3].type;
2762 if (insn->op2 == var) {
2764 return insn->op3; /* store forwarding (S2L) */
2766 …return ir_fold1(ctx, IR_OPT(IR_BITCAST, type), insn->op3); /* store forwarding with bitcast (S2L) …
2769 return ir_fold1(ctx, IR_OPT(IR_TRUNC, type), insn->op3); /* partial store forwarding (S2L) */
2774 …} else if (insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN || insn->op == IR_CALL || insn->op ==…
2777 ref = insn->op1;
2789 ir_insn *insn; local
2793 insn = &ctx->ir_base[val];
2794 if (insn->op == IR_BITCAST
2795 && !IR_IS_CONST_REF(insn->op1)
2796 && ir_type_size[insn->type] == ir_type_size[ctx->ir_base[insn->op1].type]) {
2798 val = insn->op1;
2804 insn = &ctx->ir_base[ref];
2805 if (insn->op == IR_VSTORE) {
2806 if (insn->op2 == var) {
2807 if (insn->op3 == val) {
2812 ctx->ir_base[prev].op1 = insn->op1;
2814 ctx->control = insn->op1;
2816 MAKE_NOP(insn);
2821 } else if (insn->op == IR_VLOAD) {
2822 if (insn->op2 == var) {
2825 } else if (insn->op == IR_GUARD || insn->op == IR_GUARD_NOT) {
2827 …} else if (insn->op >= IR_START || insn->op == IR_CALL || insn->op == IR_LOAD || insn->op == IR_ST…
2831 ref = insn->op1;
2870 ir_insn *insn; local
2876 insn = &ctx->ir_base[val];
2877 if (insn->op == IR_BITCAST
2878 && !IR_IS_CONST_REF(insn->op1)
2879 && ir_type_size[insn->type] == ir_type_size[ctx->ir_base[insn->op1].type]) {
2881 val = insn->op1;
2887 insn = &ctx->ir_base[ref];
2888 if (insn->op == IR_STORE) {
2889 if (insn->op2 == addr) {
2890 if (ctx->ir_base[insn->op3].type == type) {
2891 if (insn->op3 == val) {
2896 ctx->ir_base[prev].op1 = insn->op1;
2898 ctx->control = insn->op1;
2900 MAKE_NOP(insn);
2908 type2 = ctx->ir_base[insn->op3].type;
2911 } else if (insn->op == IR_LOAD) {
2912 if (insn->op2 == addr) {
2915 type2 = insn->type;
2917 if (ir_check_partial_aliasing(ctx, addr, insn->op2, type, type2) != IR_NO_ALIAS) {
2920 } else if (insn->op == IR_GUARD || insn->op == IR_GUARD_NOT) {
2922 } else if (insn->op >= IR_START || insn->op == IR_CALL) {
2926 ref = insn->op1;