On 10/10/21 9:20 PM, WANG Xuerui wrote:
+++ b/tcg/mips/tcg-target-sa32.h
@@ -1 +1,9 @@
+/*
+ * Do not set TCG_TARGET_SIGNED_ADDR32 for mips32;
+ * TCG expects this to only be set for 64-bit hosts.
+ */
+#ifdef __mips64
+#define TCG_TARGET_SIGNED_ADDR32 1
+#else
  #define TCG_TARGET_SIGNED_ADDR32 0
+#endif
It looks like we never want to set TCG_TARGET_SIGNED_ADDR32 on 32-bit
hosts; maybe a compile-time assert could be added somewhere for
statically guaranteeing this?

I've placed a build-time assert in tcg/tcg.c.

-    if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) {
+    if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS && !guest_base_signed_addr32) {
Is there precedent of extracting predicates like this into some header
for reuse? However I agree that the current expression conveys enough
meaning without being overly complicated.

Depends on the expected scope of the predicate, I guess.

If it's private to tcg-target.c.inc, I'd put it in tcg.c.
If it's private to tcg in general, I'd put it in tcg-internal.h.
Beyond that, I guess it depends.

For this, I don't know what I'd call it that isn't more verbose than the 
expression itself.

r~

Reply via email to