From 6a0af06bd9f66780d2c3e9f69c40f2b89ad90605 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Thu, 5 Nov 2009 22:04:25 -0800 Subject: [PATCH] ARM: shrink offsets 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 --- src/target/arm720t.h | 2 +- src/target/arm7_9_common.h | 2 +- src/target/arm920t.h | 2 +- src/target/arm926ejs.h | 2 +- src/target/arm966e.h | 2 +- src/target/xscale.h | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/target/arm720t.h b/src/target/arm720t.h index 0689e4442..c10cbe1b9 100644 --- a/src/target/arm720t.h +++ b/src/target/arm720t.h @@ -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; diff --git a/src/target/arm7_9_common.h b/src/target/arm7_9_common.h index 9eafc1d20..9c42b6b08 100644 --- a/src/target/arm7_9_common.h +++ b/src/target/arm7_9_common.h @@ -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; diff --git a/src/target/arm920t.h b/src/target/arm920t.h index eb66eaa81..af0f9828d 100644 --- a/src/target/arm920t.h +++ b/src/target/arm920t.h @@ -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; diff --git a/src/target/arm926ejs.h b/src/target/arm926ejs.h index ff811e3f2..01e3c090c 100644 --- a/src/target/arm926ejs.h +++ b/src/target/arm926ejs.h @@ -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; diff --git a/src/target/arm966e.h b/src/target/arm966e.h index 710f20716..e8346f9d4 100644 --- a/src/target/arm966e.h +++ b/src/target/arm966e.h @@ -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; diff --git a/src/target/xscale.h b/src/target/xscale.h index 56db18150..433ecfcf0 100644 --- a/src/target/xscale.h +++ b/src/target/xscale.h @@ -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; -- 2.11.4.GIT