Commit 0954d0d9e242b4bc122eeaefb8825cc8f8eb3ab5
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
Showing
5 changed files
with
9 additions
and
5 deletions
osdep.h
... | ... | @@ -26,6 +26,10 @@ |
26 | 26 | #define MAX(a, b) (((a) > (b)) ? (a) : (b)) |
27 | 27 | #endif |
28 | 28 | |
29 | +#ifndef ARRAY_SIZE | |
30 | +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | |
31 | +#endif | |
32 | + | |
29 | 33 | #ifndef always_inline |
30 | 34 | #if (__GNUC__ < 3) || defined(__APPLE__) |
31 | 35 | #define always_inline inline | ... | ... |
tcg/i386/tcg-target.c
tcg/sparc/tcg-target.c
... | ... | @@ -57,7 +57,7 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { |
57 | 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 | 61 | TCG_REG_L0, |
62 | 62 | TCG_REG_L1, |
63 | 63 | TCG_REG_L2, | ... | ... |
tcg/tcg.c
... | ... | @@ -1212,14 +1212,14 @@ static int tcg_reg_alloc(TCGContext *s, TCGRegSet reg1, TCGRegSet reg2) |
1212 | 1212 | tcg_regset_andnot(reg_ct, reg1, reg2); |
1213 | 1213 | |
1214 | 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 | 1216 | reg = tcg_target_reg_alloc_order[i]; |
1217 | 1217 | if (tcg_regset_test_reg(reg_ct, reg) && s->reg_to_temp[reg] == -1) |
1218 | 1218 | return reg; |
1219 | 1219 | } |
1220 | 1220 | |
1221 | 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 | 1223 | reg = tcg_target_reg_alloc_order[i]; |
1224 | 1224 | if (tcg_regset_test_reg(reg_ct, reg)) { |
1225 | 1225 | tcg_reg_free(s, reg); | ... | ... |
tcg/x86_64/tcg-target.c