summaryrefslogtreecommitdiff
path: root/tcg/tcg.h
diff options
context:
space:
mode:
Diffstat (limited to 'tcg/tcg.h')
-rw-r--r--tcg/tcg.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 5fcdec1fc5..828c1e70e5 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -729,6 +729,18 @@ struct TCGContext {
extern TCGContext tcg_ctx;
extern bool parallel_cpus;
+static inline size_t temp_idx(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(TCGTemp *ts)
+{
+ return temp_idx(ts);
+}
+
static inline TCGTemp *arg_temp(TCGArg a)
{
return a == TCG_CALL_DUMMY_ARG ? NULL : &tcg_ctx.temps[a];