]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: m32r: move arch-specific settings to internal header
authorMike Frysinger <vapier@gentoo.org>
Fri, 23 Dec 2022 05:49:09 +0000 (00:49 -0500)
committerMike Frysinger <vapier@gentoo.org>
Fri, 23 Dec 2022 13:32:59 +0000 (08:32 -0500)
There's no need for these settings to be in sim-main.h which is shared
with common/ sim code, so move it all out to the existing m32r-sim.h.
Unfortunately, we can't yet drop the m32r-sim.h include from sim-main.h
as many of the generated CGEN files refer only to sim-main.h.  We'll
have to improve the CGEN interface before we can make more progress,
but this is at least a minor improvement.

sim/m32r/m32r-sim.h
sim/m32r/m32r.c
sim/m32r/m32r2.c
sim/m32r/m32rx.c
sim/m32r/sim-if.c
sim/m32r/sim-main.h
sim/m32r/traps.c

index fc41c2146f75180f7be1a13064ce62a2f949e54f..3586f32978809b16b5da32ed12833eb5c71eb517 100644 (file)
@@ -166,5 +166,27 @@ do { \
 
 /* Handle the trap insn.  */
 USI m32r_trap (SIM_CPU *, PCADDR, int);
+\f
+struct m32r_sim_cpu {
+  M32R_MISC_PROFILE m32r_misc_profile;
+#define CPU_M32R_MISC_PROFILE(cpu) (& M32R_SIM_CPU (cpu)->m32r_misc_profile)
+
+  /* CPU specific parts go here.
+     Note that in files that don't need to access these pieces WANT_CPU_FOO
+     won't be defined and thus these parts won't appear.  This is ok in the
+     sense that things work.  It is a source of bugs though.
+     One has to of course be careful to not take the size of this
+     struct and no structure members accessed in non-cpu specific files can
+     go after here.  Oh for a better language.  */
+#if defined (WANT_CPU_M32RBF)
+  M32RBF_CPU_DATA cpu_data;
+#endif
+#if defined (WANT_CPU_M32RXF)
+  M32RXF_CPU_DATA cpu_data;
+#elif defined (WANT_CPU_M32R2F)
+  M32R2F_CPU_DATA cpu_data;
+#endif
+};
+#define M32R_SIM_CPU(cpu) ((struct m32r_sim_cpu *) CPU_ARCH_DATA (cpu))
 
 #endif /* M32R_SIM_H */
index 478a45c258694e8dd2c69bc9d661fdf41da7c966..014aa712c160ba3dbf2befe912c985365fe46bac 100644 (file)
@@ -28,6 +28,8 @@
 #include "cgen-ops.h"
 #include <stdlib.h>
 
+#include "m32r-sim.h"
+
 /* Return the size of REGNO in bytes.  */
 
 static int
index 8881bc68081f1597834f20c60aa59174d056211f..b95e509a41aab2f5340e6221aaaddfcde9e8a40b 100644 (file)
@@ -27,6 +27,8 @@
 #include "cgen-mem.h"
 #include "cgen-ops.h"
 
+#include "m32r-sim.h"
+
 /* The contents of BUF are in target byte order.  */
 
 int
index e5724c5410d603611d72d08a4051755af639f72f..52073e1344a0f347a7f684c29029169360d4ee6a 100644 (file)
@@ -27,6 +27,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "cgen-mem.h"
 #include "cgen-ops.h"
 
+#include "m32r-sim.h"
+
 /* The contents of BUF are in target byte order.  */
 
 int
index e11545461c5dea9a94357fa8d5bbcbfd05999544..c8c04b38b68a96034cc535d512131d851dd1c435 100644 (file)
@@ -30,6 +30,7 @@
 #include "libiberty.h"
 #include "bfd.h"
 
+#include "m32r-sim.h"
 #include "dv-m32r_uart.h"
 
 #define M32R_DEFAULT_MEM_SIZE 0x2000000 /* 32M */
index 70962320dfc7f04ce5c1c47965dfdf85962b3f5d..9a52563f25a214a74d5c17dcf5970d52651cf21c 100644 (file)
 #include "arch.h"
 #include "sim-base.h"
 #include "cgen-sim.h"
-#include "m32r-sim.h"
-\f
-struct m32r_sim_cpu {
-  M32R_MISC_PROFILE m32r_misc_profile;
-#define CPU_M32R_MISC_PROFILE(cpu) (& M32R_SIM_CPU (cpu)->m32r_misc_profile)
 
-  /* CPU specific parts go here.
-     Note that in files that don't need to access these pieces WANT_CPU_FOO
-     won't be defined and thus these parts won't appear.  This is ok in the
-     sense that things work.  It is a source of bugs though.
-     One has to of course be careful to not take the size of this
-     struct and no structure members accessed in non-cpu specific files can
-     go after here.  Oh for a better language.  */
-#if defined (WANT_CPU_M32RBF)
-  M32RBF_CPU_DATA cpu_data;
-#endif
-#if defined (WANT_CPU_M32RXF)
-  M32RXF_CPU_DATA cpu_data;
-#elif defined (WANT_CPU_M32R2F)
-  M32R2F_CPU_DATA cpu_data;
-#endif
-};
-#define M32R_SIM_CPU(cpu) ((struct m32r_sim_cpu *) CPU_ARCH_DATA (cpu))
+/* TODO: Move this to the CGEN generated files instead.  */
+#include "m32r-sim.h"
 \f
 /* Misc.  */
 
index 12a87b4a6978d318e84b90b7450c2cf409d4236c..b82f974dc53469612afaaebca4c602b596074108 100644 (file)
@@ -55,6 +55,8 @@
 #include <linux/unistd.h>
 #endif
 
+#include "m32r-sim.h"
+
 #define TRAP_LINUX_SYSCALL 2
 #define TRAP_FLUSH_CACHE 12
 /* The semantic code invokes this for invalid (unrecognized) instructions.  */