ARM: shrink offsets
authorDavid Brownell <dbrownell@users.sourceforge.net>
Fri, 6 Nov 2009 06:04:25 +0000 (22:04 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Fri, 6 Nov 2009 06:04:25 +0000 (22:04 -0800)
Move various embedded target structs to the beginnings of
their containers ... pretty much the way C++ or Obj-C
would for single inheritance.

This shrinks code that accesses those embedded structs by
letting common offsets use smaller instructions.  Sample
before/after sizes (on amd64):

  17181     312       0   17493    4455 arm920t.o
  16810     312       0   17122    42e2 arm920t.o

Where the "after" is the smaller number, with this patch
over the ones leveraging that embedding knowledge.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/target/arm720t.h
src/target/arm7_9_common.h
src/target/arm920t.h
src/target/arm926ejs.h
src/target/arm966e.h
src/target/xscale.h

index 0689e4442157a4097bd999086ac833a8d7154d5c..c10cbe1b92f7087752dce07ed87e255575c26380 100644 (file)
@@ -27,9 +27,9 @@
 
 typedef struct arm720t_common_s
 {
+       arm7tdmi_common_t arm7tdmi_common;
        uint32_t common_magic;
        armv4_5_mmu_common_t armv4_5_mmu;
-       arm7tdmi_common_t arm7tdmi_common;
        uint32_t cp15_control_reg;
        uint32_t fsr_reg;
        uint32_t far_reg;
index 9eafc1d20f7046642538b9ce76b2e1ade3a5b1ce..9c42b6b0841733268296f3cacaef823e4ed4a3b5 100644 (file)
@@ -39,6 +39,7 @@
  */
 typedef struct arm7_9_common_s
 {
+       armv4_5_common_t armv4_5_common;
        uint32_t common_magic;
 
        arm_jtag_t jtag_info; /**< JTAG information for target */
@@ -107,7 +108,6 @@ typedef struct arm7_9_common_s
        void (*pre_restore_context)(target_t *target); /**< Callback function called before restoring the processor context */
        void (*post_restore_context)(target_t *target); /**< Callback function called after restoring the processor context */
 
-       armv4_5_common_t armv4_5_common;
 
 } arm7_9_common_t;
 
index eb66eaa81135e81a27521c93aac513d1880c513d..af0f9828daae162491e586aa70d192fcde9a742d 100644 (file)
@@ -27,9 +27,9 @@
 
 typedef struct arm920t_common_s
 {
+       arm9tdmi_common_t arm9tdmi_common;
        uint32_t common_magic;
        armv4_5_mmu_common_t armv4_5_mmu;
-       arm9tdmi_common_t arm9tdmi_common;
        uint32_t cp15_control_reg;
        uint32_t d_fsr;
        uint32_t i_fsr;
index ff811e3f26c8667050b68a2f4ab40e2ead78e197..01e3c090c82c8d014badcb6433684410e4e4a4e5 100644 (file)
@@ -27,9 +27,9 @@
 
 typedef struct arm926ejs_common_s
 {
+       arm9tdmi_common_t arm9tdmi_common;
        uint32_t common_magic;
        armv4_5_mmu_common_t armv4_5_mmu;
-       arm9tdmi_common_t arm9tdmi_common;
        int (*read_cp15)(target_t *target, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value);
        int (*write_cp15)(target_t *target, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t value);
        uint32_t cp15_control_reg;
index 710f2071661d47b5f67f54fe51a0e7dc9b1a69d7..e8346f9d436ad939102d433f3bfb15385fa8f4f6 100644 (file)
@@ -29,8 +29,8 @@
 
 typedef struct arm966e_common_s
 {
-       int common_magic;
        arm9tdmi_common_t arm9tdmi_common;
+       int common_magic;
        uint32_t cp15_control_reg;
 } arm966e_common_t;
 
index 56db1815083bce7635e81a67c51222ec908530e7..433ecfcf03a76620aad710c772567958f3bf8814 100644 (file)
@@ -80,6 +80,9 @@ typedef struct xscale_trace_s
 
 typedef struct xscale_common_s
 {
+       /* armv4/5 common stuff */
+       armv4_5_common_t armv4_5_common;
+
        int common_magic;
 
        /* XScale registers (CP15, DBG) */
@@ -121,9 +124,6 @@ typedef struct xscale_common_s
 
        int arch_debug_reason;
 
-       /* armv4/5 common stuff */
-       armv4_5_common_t armv4_5_common;
-
        /* MMU/Caches */
        armv4_5_mmu_common_t armv4_5_mmu;
        uint32_t cp15_control_reg;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)