diff options
Diffstat (limited to 'gcc/recog.c')
-rw-r--r-- | gcc/recog.c | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/gcc/recog.c b/gcc/recog.c index ded35f7..dd73a46 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -128,19 +128,18 @@ check_asm_operands (x) return 1; } -/* Static data for the next two routines. +/* Static data for the next two routines. */ - The maximum number of changes supported is defined as the maximum - number of operands times 5. This allows for repeated substitutions - inside complex indexed address, or, alternatively, changes in up - to 5 insns. */ - -#define MAX_CHANGE_LOCS (MAX_RECOG_OPERANDS * 5) +typedef struct change_t +{ + rtx object; + int old_code; + rtx *loc; + rtx old; +} change_t; -static rtx change_objects[MAX_CHANGE_LOCS]; -static int change_old_codes[MAX_CHANGE_LOCS]; -static rtx *change_locs[MAX_CHANGE_LOCS]; -static rtx change_olds[MAX_CHANGE_LOCS]; +static change_t *changes; +static int changes_allocated; static int num_changes = 0; @@ -174,22 +173,35 @@ validate_change (object, loc, new, in_group) if (old == new || rtx_equal_p (old, new)) return 1; - if (num_changes >= MAX_CHANGE_LOCS - || (in_group == 0 && num_changes != 0)) + if (in_group == 0 && num_changes != 0) abort (); *loc = new; /* Save the information describing this change. */ - change_objects[num_changes] = object; - change_locs[num_changes] = loc; - change_olds[num_changes] = old; + if (num_changes >= changes_allocated) + { + if (changes_allocated == 0) + /* This value allows for repeated substitutions inside complex + indexed addresses, or changes in up to 5 insns. */ + changes_allocated = MAX_RECOG_OPERANDS * 5; + else + changes_allocated *= 2; + + changes = + (change_t*) xrealloc (changes, + sizeof (change_t) * changes_allocated); + } + + changes[num_changes].object = object; + changes[num_changes].loc = loc; + changes[num_changes].old = old; if (object && GET_CODE (object) != MEM) { /* Set INSN_CODE to force rerecognition of insn. Save old code in case invalid. */ - change_old_codes[num_changes] = INSN_CODE (object); + changes[num_changes].old_code = INSN_CODE (object); INSN_CODE (object) = -1; } @@ -224,7 +236,7 @@ apply_change_group () for (i = 0; i < num_changes; i++) { - rtx object = change_objects[i]; + rtx object = changes[i].object; if (object == 0) continue; @@ -319,9 +331,9 @@ cancel_changes (num) they were made. */ for (i = num_changes - 1; i >= num; i--) { - *change_locs[i] = change_olds[i]; - if (change_objects[i] && GET_CODE (change_objects[i]) != MEM) - INSN_CODE (change_objects[i]) = change_old_codes[i]; + *changes[i].loc = changes[i].old; + if (changes[i].object && GET_CODE (changes[i].object) != MEM) + INSN_CODE (changes[i].object) = changes[i].old_code; } num_changes = num; } |