summaryrefslogtreecommitdiff
path: root/src/arch/arm
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@arm.com>2012-09-25 11:49:40 -0500
committerAndreas Sandberg <Andreas.Sandberg@arm.com>2012-09-25 11:49:40 -0500
commit6f603e0807ef82f250bda4946d94186e7220dedf (patch)
tree26c905f698b7c3d0a0f26e7ccd42a93ca1dde01b /src/arch/arm
parent4544f3def42ae9b8c528223d8762ae3634c7124a (diff)
downloadgem5-6f603e0807ef82f250bda4946d94186e7220dedf.tar.xz
arm: Use a static_assert to test that miscRegName[] is complete
Instead of statically defining miscRegName to contain NUM_MISCREGS elements, let the compiler determine the length of the array. This allows us to use a static_assert to test that all registers are listed in the name vector.
Diffstat (limited to 'src/arch/arm')
-rw-r--r--src/arch/arm/miscregs.hh6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/arch/arm/miscregs.hh b/src/arch/arm/miscregs.hh
index 7af4ec605..2dceab70c 100644
--- a/src/arch/arm/miscregs.hh
+++ b/src/arch/arm/miscregs.hh
@@ -43,6 +43,7 @@
#define __ARCH_ARM_MISCREGS_HH__
#include "base/bitunion.hh"
+#include "base/compiler.hh"
namespace ArmISA
{
@@ -250,7 +251,7 @@ namespace ArmISA
unsigned crm, unsigned opc2);
- const char * const miscRegName[NUM_MISCREGS] = {
+ const char * const miscRegName[] = {
"cpsr", "cpsr_q", "spsr", "spsr_fiq", "spsr_irq", "spsr_svc",
"spsr_mon", "spsr_und", "spsr_abt",
"fpsr", "fpsid", "fpscr", "fpscr_qc", "fpscr_exc", "fpexc",
@@ -325,6 +326,9 @@ namespace ArmISA
"nop", "raz"
};
+ static_assert(sizeof(miscRegName) / sizeof(*miscRegName) == NUM_MISCREGS,
+ "The miscRegName array and NUM_MISCREGS are inconsistent.");
+
BitUnion32(CPSR)
Bitfield<31,30> nz;
Bitfield<29> c;