qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 7/8] target/mips: Support TCG_TARGET_SIGNED_ADDR32


From: Richard Henderson
Subject: Re: [PATCH 7/8] target/mips: Support TCG_TARGET_SIGNED_ADDR32
Date: Wed, 13 Oct 2021 15:24:06 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

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

[Prev in Thread] Current Thread [Next in Thread]