tcg: Introduce temp_arg, export temp_idx

At the same time, drop the TCGContext argument and use tcg_ctx instead.

Backports commit 1807f4c40098070008eb84b2032e25b7ac42569e from qemu
This commit is contained in:
Richard Henderson 2018-03-05 07:24:13 -05:00 committed by Lioncash
parent a659a03ff5
commit 87f2067aac
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -987,6 +987,18 @@ struct TCGContext {
TCGLabel *exitreq_label; // gen_tb_start()
};
static inline size_t temp_idx(TCGContext *tcg_ctx, TCGTemp *ts)
{
ptrdiff_t n = ts - tcg_ctx->temps;
tcg_debug_assert(n >= 0 && n < tcg_ctx->nb_temps);
return n;
}
static inline TCGArg temp_arg(TCGContext *tcg_ctx, TCGTemp *ts)
{
return temp_idx(tcg_ctx, ts);
}
static inline TCGTemp *arg_temp(TCGContext *tcg_ctx, TCGArg a)
{
return a == TCG_CALL_DUMMY_ARG ? NULL : &tcg_ctx->temps[a];