Commit 41a972a9 by Mark Mitchell Committed by Jeff Law

rtl.h (rtx_function): New type.

	* rtl.h (rtx_function): New type.
	(for_each_rtx): New function.
	* rtlanal.c (for_each_rtx): Define it.
	* recog.c (change_t): New type.
	(change_objects, change_old_codes, change_locs, change_olds):
	Replace with ...
	(changes): New variable.
	(validate_change): Dynamically allocate room for more changes, if
	necessary.  Uses changes array instead of change_objects, etc.
	(apply_change_group):  Use changes array instead of
	change_objects, etc.
	* loop.c (loop_mem_info): New type.
	(loop_mems): New variable.
	(loop_mems_idx): Likewise.
	(looop_mems_allocated): Likewise.
	(scan_loop): Remove nregs parameter.
	(next_insn_in_loop): New function.
	(load_mems_and_recount_loop_regs_set): Likewise.
	(load_mems): Likewise.
	(insert_loop_mem): Likewise.
	(replace_loop_mem): Likewise.
	(replace_label): Likewise.
	(INSN_IN_RANGE_P): New macro.
	(loop_optimize): Don't pass max_reg_num() to scan_loop.
	(scan_loop): Remove nregs parameter, compute it after any new
	registers are created by load_mems.  Use INSN_IN_RANGE_P and
	next_insn_in_loop rather than expanding them inline.  Call
	load_mems to load memory into pseudos, if appropriate.
	(prescan_loop): Figure out whether or not there are jumps from the
	loop to targets other than the label immediately following the
	loop.  Call insert_loop_mem to notice all the MEMs used in the
	loop, if it could be safe to pull MEMs into REGs for the duration
	of the loop.
	(strength_reduce): Use next_insn_in_loop.  Tweak comments.

From-SVN: r21845
parent 031fec00
Wed Aug 19 13:28:41 1998 Mark Mitchell <mark@markmitchell.com>
* rtl.h (rtx_function): New type.
(for_each_rtx): New function.
* rtlanal.c (for_each_rtx): Define it.
* recog.c (change_t): New type.
(change_objects, change_old_codes, change_locs, change_olds):
Replace with ...
(changes): New variable.
(validate_change): Dynamically allocate room for more changes, if
necessary. Uses changes array instead of change_objects, etc.
(apply_change_group): Use changes array instead of
change_objects, etc.
* loop.c (loop_mem_info): New type.
(loop_mems): New variable.
(loop_mems_idx): Likewise.
(looop_mems_allocated): Likewise.
(scan_loop): Remove nregs parameter.
(next_insn_in_loop): New function.
(load_mems_and_recount_loop_regs_set): Likewise.
(load_mems): Likewise.
(insert_loop_mem): Likewise.
(replace_loop_mem): Likewise.
(replace_label): Likewise.
(INSN_IN_RANGE_P): New macro.
(loop_optimize): Don't pass max_reg_num() to scan_loop.
(scan_loop): Remove nregs parameter, compute it after any new
registers are created by load_mems. Use INSN_IN_RANGE_P and
next_insn_in_loop rather than expanding them inline. Call
load_mems to load memory into pseudos, if appropriate.
(prescan_loop): Figure out whether or not there are jumps from the
loop to targets other than the label immediately following the
loop. Call insert_loop_mem to notice all the MEMs used in the
loop, if it could be safe to pull MEMs into REGs for the duration
of the loop.
(strength_reduce): Use next_insn_in_loop. Tweak comments.
Wed Aug 19 08:29:44 1998 Richard Earnshaw (rearnsha@arm.com)
* arm.c (arm_override_options): Remove lie about ignoring PIC flag.
......
......@@ -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;
}
......
......@@ -1000,6 +1000,8 @@ extern int inequality_comparison_p PROTO((rtx));
extern rtx replace_rtx PROTO((rtx, rtx, rtx));
extern rtx replace_regs PROTO((rtx, rtx *, int, int));
extern int computed_jump_p PROTO((rtx));
typedef int (*rtx_function) PROTO((rtx *, void *));
extern int for_each_rtx PROTO((rtx *, rtx_function, void *));
/* Maximum number of parallel sets and clobbers in any insn in this fn.
Always at least 3, since the combiner could put that many togetherm
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment