Lines Matching refs:op

216 static TCGOp *find_op(TCGOp *op, TCGOpcode opc)  in find_op()  argument
218 while (op) { in find_op()
219 if (op->opc == opc) { in find_op()
220 return op; in find_op()
222 op = QTAILQ_NEXT(op, link); in find_op()
236 static TCGOp *rm_ops(TCGOp *op) in rm_ops() argument
238 TCGOp *end_op = find_op(op, INDEX_op_plugin_cb_end); in rm_ops()
241 return rm_ops_range(op, end_op); in rm_ops()
244 static TCGOp *copy_op_nocheck(TCGOp **begin_op, TCGOp *op) in copy_op_nocheck() argument
250 op = tcg_op_insert_after(tcg_ctx, op, old_op->opc, nargs); in copy_op_nocheck()
251 memcpy(op->args, old_op->args, sizeof(op->args[0]) * nargs); in copy_op_nocheck()
253 return op; in copy_op_nocheck()
256 static TCGOp *copy_op(TCGOp **begin_op, TCGOp *op, TCGOpcode opc) in copy_op() argument
258 op = copy_op_nocheck(begin_op, op); in copy_op()
260 return op; in copy_op()
263 static TCGOp *copy_const_ptr(TCGOp **begin_op, TCGOp *op, void *ptr) in copy_const_ptr() argument
267 op = copy_op(begin_op, op, INDEX_op_mov_i32); in copy_const_ptr()
268 op->args[1] = tcgv_i32_arg(tcg_constant_i32((uintptr_t)ptr)); in copy_const_ptr()
271 op = copy_op(begin_op, op, INDEX_op_mov_i64); in copy_const_ptr()
272 op->args[1] = tcgv_i64_arg(tcg_constant_i64((uintptr_t)ptr)); in copy_const_ptr()
274 return op; in copy_const_ptr()
277 static TCGOp *copy_ld_i64(TCGOp **begin_op, TCGOp *op) in copy_ld_i64() argument
281 op = copy_op(begin_op, op, INDEX_op_ld_i32); in copy_ld_i64()
282 op = copy_op(begin_op, op, INDEX_op_ld_i32); in copy_ld_i64()
285 op = copy_op(begin_op, op, INDEX_op_ld_i64); in copy_ld_i64()
287 return op; in copy_ld_i64()
290 static TCGOp *copy_st_i64(TCGOp **begin_op, TCGOp *op) in copy_st_i64() argument
294 op = copy_op(begin_op, op, INDEX_op_st_i32); in copy_st_i64()
295 op = copy_op(begin_op, op, INDEX_op_st_i32); in copy_st_i64()
298 op = copy_op(begin_op, op, INDEX_op_st_i64); in copy_st_i64()
300 return op; in copy_st_i64()
303 static TCGOp *copy_add_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) in copy_add_i64() argument
308 op = copy_op(begin_op, op, INDEX_op_add2_i32); in copy_add_i64()
309 op->args[4] = tcgv_i32_arg(tcg_constant_i32(v)); in copy_add_i64()
310 op->args[5] = tcgv_i32_arg(tcg_constant_i32(v >> 32)); in copy_add_i64()
312 op = copy_op(begin_op, op, INDEX_op_add_i64); in copy_add_i64()
313 op->args[2] = tcgv_i64_arg(tcg_constant_i64(v)); in copy_add_i64()
315 return op; in copy_add_i64()
318 static TCGOp *copy_st_ptr(TCGOp **begin_op, TCGOp *op) in copy_st_ptr() argument
322 op = copy_op(begin_op, op, INDEX_op_st_i32); in copy_st_ptr()
325 op = copy_st_i64(begin_op, op); in copy_st_ptr()
327 return op; in copy_st_ptr()
330 static TCGOp *copy_call(TCGOp **begin_op, TCGOp *op, void *func, int *cb_idx) in copy_call() argument
337 op = copy_op_nocheck(begin_op, op); in copy_call()
338 } while (op->opc != INDEX_op_call); in copy_call()
342 TCGOP_CALLI(op) = TCGOP_CALLI(old_op); in copy_call()
343 TCGOP_CALLO(op) = TCGOP_CALLO(old_op); in copy_call()
344 tcg_debug_assert(op->life == 0); in copy_call()
346 func_idx = TCGOP_CALLO(op) + TCGOP_CALLI(op); in copy_call()
348 op->args[func_idx] = (uintptr_t)func; in copy_call()
350 return op; in copy_call()
360 TCGOp *begin_op, TCGOp *op, int *cb_idx) in append_udata_cb() argument
363 op = copy_const_ptr(&begin_op, op, cb->userp); in append_udata_cb()
367 op = copy_op(&begin_op, op, INDEX_op_ld_i32); in append_udata_cb()
374 op = copy_call(&begin_op, op, cb->f.vcpu_udata, cb_idx); in append_udata_cb()
376 return op; in append_udata_cb()
380 TCGOp *begin_op, TCGOp *op, in append_inline_cb() argument
384 op = copy_const_ptr(&begin_op, op, cb->userp); in append_inline_cb()
387 op = copy_ld_i64(&begin_op, op); in append_inline_cb()
390 op = copy_add_i64(&begin_op, op, cb->inline_insn.imm); in append_inline_cb()
393 op = copy_st_i64(&begin_op, op); in append_inline_cb()
395 return op; in append_inline_cb()
399 TCGOp *begin_op, TCGOp *op, int *cb_idx) in append_mem_cb() argument
406 op = copy_op(&begin_op, op, INDEX_op_mov_i32); in append_mem_cb()
409 op = copy_const_ptr(&begin_op, op, cb->userp); in append_mem_cb()
413 op = copy_op(&begin_op, op, INDEX_op_ld_i32); in append_mem_cb()
421 op = copy_call(&begin_op, op, cb->f.vcpu_udata, cb_idx); in append_mem_cb()
424 return op; in append_mem_cb()
428 TCGOp *begin_op, TCGOp *op, int *intp);
429 typedef bool (*op_ok_fn)(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb);
431 static bool op_ok(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb) in op_ok() argument
436 static bool op_rw(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb) in op_rw() argument
440 w = op->args[2]; in op_rw()
448 TCGOp *op; in inject_cb_type() local
460 op = end_op; in inject_cb_type()
468 op = inject(cb, begin_op, op, &cb_idx); in inject_cb_type()
496 TCGOp *op; in inject_mem_helper() local
502 op = copy_const_ptr(&begin_op, end_op, arr); in inject_mem_helper()
505 op = copy_st_ptr(&begin_op, op); in inject_mem_helper()
648 TCGOp *op; in pr_ops() local
651 QTAILQ_FOREACH(op, &tcg_ctx->ops, link) { in pr_ops()
655 if (op->opc == INDEX_op_plugin_cb_start) { in pr_ops()
656 switch (op->args[0]) { in pr_ops()
672 switch (op->args[1]) { in pr_ops()
692 printf("op[%2i]: %s %s %s\n", i, tcg_op_defs[op->opc].name, name, type); in pr_ops()
700 TCGOp *op; in plugin_gen_inject() local
705 QTAILQ_FOREACH(op, &tcg_ctx->ops, link) { in plugin_gen_inject()
706 switch (op->opc) { in plugin_gen_inject()
712 enum plugin_gen_from from = op->args[0]; in plugin_gen_inject()
713 enum plugin_gen_cb type = op->args[1]; in plugin_gen_inject()
722 plugin_gen_tb_udata(plugin_tb, op); in plugin_gen_inject()
725 plugin_gen_tb_inline(plugin_tb, op); in plugin_gen_inject()
738 plugin_gen_insn_udata(plugin_tb, op, insn_idx); in plugin_gen_inject()
741 plugin_gen_insn_inline(plugin_tb, op, insn_idx); in plugin_gen_inject()
744 plugin_gen_enable_mem_helper(plugin_tb, op, insn_idx); in plugin_gen_inject()
757 plugin_gen_mem_regular(plugin_tb, op, insn_idx); in plugin_gen_inject()
760 plugin_gen_mem_inline(plugin_tb, op, insn_idx); in plugin_gen_inject()
774 plugin_gen_disable_mem_helper(plugin_tb, op, insn_idx); in plugin_gen_inject()