Commit 0954d0d9e242b4bc122eeaefb8825cc8f8eb3ab5

Authored by blueswir1
1 parent db4a4ea4

Remove blank elements in tcg_target_reg_alloc_order[] (Stuart Brady)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4039 c046a42c-6fe2-441c-8c8c-71466251a162
@@ -26,6 +26,10 @@ @@ -26,6 +26,10 @@
26 #define MAX(a, b) (((a) > (b)) ? (a) : (b)) 26 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
27 #endif 27 #endif
28 28
  29 +#ifndef ARRAY_SIZE
  30 +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
  31 +#endif
  32 +
29 #ifndef always_inline 33 #ifndef always_inline
30 #if (__GNUC__ < 3) || defined(__APPLE__) 34 #if (__GNUC__ < 3) || defined(__APPLE__)
31 #define always_inline inline 35 #define always_inline inline
tcg/i386/tcg-target.c
@@ -32,7 +32,7 @@ const char *tcg_target_reg_names[TCG_TARGET_NB_REGS] = { @@ -32,7 +32,7 @@ const char *tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
32 "%edi", 32 "%edi",
33 }; 33 };
34 34
35 -int tcg_target_reg_alloc_order[TCG_TARGET_NB_REGS] = { 35 +int tcg_target_reg_alloc_order[] = {
36 TCG_REG_EAX, 36 TCG_REG_EAX,
37 TCG_REG_EDX, 37 TCG_REG_EDX,
38 TCG_REG_ECX, 38 TCG_REG_ECX,
tcg/sparc/tcg-target.c
@@ -57,7 +57,7 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { @@ -57,7 +57,7 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
57 "%i7", 57 "%i7",
58 }; 58 };
59 59
60 -static const int tcg_target_reg_alloc_order[TCG_TARGET_NB_REGS] = { 60 +static const int tcg_target_reg_alloc_order[] = {
61 TCG_REG_L0, 61 TCG_REG_L0,
62 TCG_REG_L1, 62 TCG_REG_L1,
63 TCG_REG_L2, 63 TCG_REG_L2,
tcg/tcg.c
@@ -1212,14 +1212,14 @@ static int tcg_reg_alloc(TCGContext *s, TCGRegSet reg1, TCGRegSet reg2) @@ -1212,14 +1212,14 @@ static int tcg_reg_alloc(TCGContext *s, TCGRegSet reg1, TCGRegSet reg2)
1212 tcg_regset_andnot(reg_ct, reg1, reg2); 1212 tcg_regset_andnot(reg_ct, reg1, reg2);
1213 1213
1214 /* first try free registers */ 1214 /* first try free registers */
1215 - for(i = 0; i < TCG_TARGET_NB_REGS; i++) { 1215 + for(i = 0; i < ARRAY_SIZE(tcg_target_reg_alloc_order); i++) {
1216 reg = tcg_target_reg_alloc_order[i]; 1216 reg = tcg_target_reg_alloc_order[i];
1217 if (tcg_regset_test_reg(reg_ct, reg) && s->reg_to_temp[reg] == -1) 1217 if (tcg_regset_test_reg(reg_ct, reg) && s->reg_to_temp[reg] == -1)
1218 return reg; 1218 return reg;
1219 } 1219 }
1220 1220
1221 /* XXX: do better spill choice */ 1221 /* XXX: do better spill choice */
1222 - for(i = 0; i < TCG_TARGET_NB_REGS; i++) { 1222 + for(i = 0; i < ARRAY_SIZE(tcg_target_reg_alloc_order); i++) {
1223 reg = tcg_target_reg_alloc_order[i]; 1223 reg = tcg_target_reg_alloc_order[i];
1224 if (tcg_regset_test_reg(reg_ct, reg)) { 1224 if (tcg_regset_test_reg(reg_ct, reg)) {
1225 tcg_reg_free(s, reg); 1225 tcg_reg_free(s, reg);
tcg/x86_64/tcg-target.c
@@ -40,7 +40,7 @@ const char *tcg_target_reg_names[TCG_TARGET_NB_REGS] = { @@ -40,7 +40,7 @@ const char *tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
40 "%r15", 40 "%r15",
41 }; 41 };
42 42
43 -int tcg_target_reg_alloc_order[TCG_TARGET_NB_REGS] = { 43 +int tcg_target_reg_alloc_order[] = {
44 TCG_REG_RDI, 44 TCG_REG_RDI,
45 TCG_REG_RSI, 45 TCG_REG_RSI,
46 TCG_REG_RDX, 46 TCG_REG_RDX,