aboutsummaryrefslogtreecommitdiff
path: root/tcg/tcg-op.h
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2010-03-14 23:01:01 +0100
committerAurelien Jarno <aurelien@aurel32.net>2010-03-14 23:01:01 +0100
commitdbfff4deb5b8082d65e374950f2a6f2d88fb8fe0 (patch)
treeca2d64efe1b313f439d7c9dbb5c6ead8af3a5b1e /tcg/tcg-op.h
parent39324ca488ac8f7124b3698d28bf46b90d9acd84 (diff)
tcg: declare internal helpers as const and pure
TCG internal helpers only access to the values passed in arguments, and do not modify the CPU internal state. Thus they can be declared as const and pure. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'tcg/tcg-op.h')
-rw-r--r--tcg/tcg-op.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
index c71e1a8c51..a58b17a655 100644
--- a/tcg/tcg-op.h
+++ b/tcg/tcg-op.h
@@ -364,7 +364,11 @@ static inline void tcg_gen_helperN(void *func, int flags, int sizemask,
tcg_temp_free_ptr(fn);
}
-/* FIXME: Should this be pure? */
+/* Note: Both tcg_gen_helper32() and tcg_gen_helper64() are currently
+ reserved for helpers in tcg-runtime.c. These helpers are all const
+ and pure, hence the call to tcg_gen_callN() with TCG_CALL_CONST |
+ TCG_CALL_PURE. This may need to be adjusted if these functions
+ start to be used with other helpers. */
static inline void tcg_gen_helper32(void *func, TCGv_i32 ret,
TCGv_i32 a, TCGv_i32 b)
{
@@ -373,11 +377,11 @@ static inline void tcg_gen_helper32(void *func, TCGv_i32 ret,
fn = tcg_const_ptr((tcg_target_long)func);
args[0] = GET_TCGV_I32(a);
args[1] = GET_TCGV_I32(b);
- tcg_gen_callN(&tcg_ctx, fn, 0, 0, GET_TCGV_I32(ret), 2, args);
+ tcg_gen_callN(&tcg_ctx, fn, TCG_CALL_CONST | TCG_CALL_PURE,
+ 0, GET_TCGV_I32(ret), 2, args);
tcg_temp_free_ptr(fn);
}
-/* FIXME: Should this be pure? */
static inline void tcg_gen_helper64(void *func, TCGv_i64 ret,
TCGv_i64 a, TCGv_i64 b)
{
@@ -386,7 +390,8 @@ static inline void tcg_gen_helper64(void *func, TCGv_i64 ret,
fn = tcg_const_ptr((tcg_target_long)func);
args[0] = GET_TCGV_I64(a);
args[1] = GET_TCGV_I64(b);
- tcg_gen_callN(&tcg_ctx, fn, 0, 7, GET_TCGV_I64(ret), 2, args);
+ tcg_gen_callN(&tcg_ctx, fn, TCG_CALL_CONST | TCG_CALL_PURE,
+ 7, GET_TCGV_I64(ret), 2, args);
tcg_temp_free_ptr(fn);
}