tcg: Allow non-constant control macros
authorRichard Henderson <rth@twiddle.net>
Thu, 2 May 2013 10:35:08 +0000 (11:35 +0100)
committerRichard Henderson <rth@twiddle.net>
Tue, 9 Jul 2013 14:14:35 +0000 (07:14 -0700)
This allows TCG_TARGET_HAS_* to be a variable rather than a constant,
which allows easier support for differing ISA levels for the host.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg/tcg-opc.h

index 12967fb6ee6ae3da0a97c93d1ecbb4cdc8653c2a..c94e25526ce3d8ad2c7ac1733c0db08ae4dca697 100644 (file)
@@ -40,7 +40,7 @@ DEF(set_label, 0, 0, 1, TCG_OPF_BB_END)
 DEF(call, 0, 1, 2, TCG_OPF_CALL_CLOBBER) /* variable number of parameters */
 DEF(br, 0, 0, 1, TCG_OPF_BB_END)
 
-#define IMPL(X) (X ? 0 : TCG_OPF_NOT_PRESENT)
+#define IMPL(X) (__builtin_constant_p(X) && !(X) ? TCG_OPF_NOT_PRESENT : 0)
 #if TCG_TARGET_REG_BITS == 32
 # define IMPL64  TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT
 #else