regmove.c: New implementation of regmove pass.

* regmove.c: New implementation of regmove pass.
        * local-alloc.c (optimize_reg_copy_1, optimize_reg_copy_2): Remove
        decls, make them have external linkage.  Return a value from
        optimize_reg_copy_1.
        * reload.h (count_occurrences): Add decl.
        * reload1.c (count_occurrences): Delete decl, make it have external
        linkage.
        * rtl.h (optimize_reg_copy_1, optimize_reg_copy_2): Declare.

Co-Authored-By: Jeffrey A Law <law@cygnus.com>

From-SVN: r17316
This commit is contained in:
J"orn Rennecke 1998-01-10 20:54:37 +00:00 committed by Jeff Law
parent 9d1943807a
commit 184bb750da
6 changed files with 1259 additions and 816 deletions

View File

@ -1,3 +1,15 @@
Sat Jan 10 21:50:16 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
Jeffrey A Law (law@cygnus.com)
* regmove.c: New implementation of regmove pass.
* local-alloc.c (optimize_reg_copy_1, optimize_reg_copy_2): Remove
decls, make them have external linkage. Return a value from
optimize_reg_copy_1.
* reload.h (count_occurrences): Add decl.
* reload1.c (count_occurrences): Delete decl, make it have external
linkage.
* rtl.h (optimize_reg_copy_1, optimize_reg_copy_2): Declare.
Sat Jan 10 20:30:12 1998 Jeffrey A Law (law@cygnus.com)
* regclass.c (record_address_regs): Don't use REG_OK_FOR_BASE_P

View File

@ -1,5 +1,5 @@
/* Allocate registers within a basic block, for GNU compiler.
Copyright (C) 1987, 88, 91, 93-6, 1997 Free Software Foundation, Inc.
Copyright (C) 1987, 88, 91, 93-97, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -249,8 +249,6 @@ static int validate_equiv_mem PROTO((rtx, rtx, rtx));
static int contains_replace_regs PROTO((rtx, char *));
static int memref_referenced_p PROTO((rtx, rtx));
static int memref_used_between_p PROTO((rtx, rtx, rtx));
static void optimize_reg_copy_1 PROTO((rtx, rtx, rtx));
static void optimize_reg_copy_2 PROTO((rtx, rtx, rtx));
static void update_equiv_regs PROTO((void));
static void block_alloc PROTO((int));
static int qty_sugg_compare PROTO((int, int));
@ -752,7 +750,7 @@ memref_used_between_p (memref, start, end)
DEST to be tied to SRC, thus often saving one register in addition to a
register-register copy. */
static void
int
optimize_reg_copy_1 (insn, dest, src)
rtx insn;
rtx dest;
@ -764,15 +762,15 @@ optimize_reg_copy_1 (insn, dest, src)
int sregno = REGNO (src);
int dregno = REGNO (dest);
/* We don't want to mess with hard regs if register classes are small. */
if (sregno == dregno
/* We don't want to mess with hard regs if register classes are small. */
|| (SMALL_REGISTER_CLASSES
&& (sregno < FIRST_PSEUDO_REGISTER
|| dregno < FIRST_PSEUDO_REGISTER))
/* We don't see all updates to SP if they are in an auto-inc memory
reference, so we must disallow this optimization on them. */
|| sregno == STACK_POINTER_REGNUM || dregno == STACK_POINTER_REGNUM)
return;
return 0;
for (p = NEXT_INSN (insn); p; p = NEXT_INSN (p))
{
@ -864,9 +862,13 @@ optimize_reg_copy_1 (insn, dest, src)
later. Make sure ALL of DEST dies here; again, this is
overly conservative. */
if (dest_death == 0
&& (dest_death = find_regno_note (q, REG_DEAD, dregno)) != 0
&& GET_MODE (XEXP (dest_death, 0)) == GET_MODE (dest))
remove_note (q, dest_death);
&& (dest_death = find_regno_note (q, REG_DEAD, dregno)) != 0)
{
if (GET_MODE (XEXP (dest_death, 0)) != GET_MODE (dest))
failed = 1, dest_death = 0;
else
remove_note (q, dest_death);
}
}
if (! failed)
@ -876,7 +878,7 @@ optimize_reg_copy_1 (insn, dest, src)
if (REG_LIVE_LENGTH (sregno) >= 0)
{
REG_LIVE_LENGTH (sregno) -= length;
/* reg_live_length is only an approximation after
/* REG_LIVE_LENGTH is only an approximation after
combine if sched is not run, so make sure that we
still have a reasonable value. */
if (REG_LIVE_LENGTH (sregno) < 2)
@ -907,7 +909,7 @@ optimize_reg_copy_1 (insn, dest, src)
REG_NOTES (p) = dest_death;
}
return;
return ! failed;
}
/* If SRC is a hard register which is set or killed in some other
@ -916,6 +918,7 @@ optimize_reg_copy_1 (insn, dest, src)
&& dead_or_set_p (p, src))
break;
}
return 0;
}
/* INSN is a copy of SRC to DEST, in which SRC dies. See if we now have
@ -932,7 +935,7 @@ optimize_reg_copy_1 (insn, dest, src)
It is assumed that DEST and SRC are pseudos; it is too complicated to do
this for hard registers since the substitutions we may make might fail. */
static void
void
optimize_reg_copy_2 (insn, dest, src)
rtx insn;
rtx dest;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* Communication between reload.c and reload1.c.
Copyright (C) 1987, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
Copyright (C) 1987, 91-95, 1997, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -200,9 +200,10 @@ extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *,
/* Return 1 if register REGNO is the subject of a clobber in insn INSN. */
extern int regno_clobbered_p PROTO((int, rtx));
/* Functions in reload1.c: */
int count_occurrences PROTO((rtx, rtx));
/* Initialize the reload pass once per compilation. */
extern void init_reload PROTO((void));

View File

@ -1,5 +1,5 @@
/* Reload pseudo regs into hard regs for insns that require hard regs.
Copyright (C) 1987, 88, 89, 92-6, 1997 Free Software Foundation, Inc.
Copyright (C) 1987, 88, 89, 92-7 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -392,7 +392,6 @@ static void emit_reload_insns PROTO((rtx));
static void delete_output_reload PROTO((rtx, int, rtx));
static void inc_for_reload PROTO((rtx, rtx, int));
static int constraint_accepts_reg_p PROTO((char *, rtx));
static int count_occurrences PROTO((rtx, rtx));
static void reload_cse_invalidate_regno PROTO((int, enum machine_mode, int));
static int reload_cse_mem_conflict_p PROTO((rtx, rtx));
static void reload_cse_invalidate_mem PROTO((rtx));
@ -7510,7 +7509,7 @@ constraint_accepts_reg_p (string, reg)
/* Return the number of places FIND appears within X, but don't count
an occurrence if some SET_DEST is FIND. */
static int
int
count_occurrences (x, find)
register rtx x, find;
{

View File

@ -1,5 +1,5 @@
/* Register Transfer Language (RTL) definitions for GNU C-Compiler
Copyright (C) 1987, 91-96, 1997 Free Software Foundation, Inc.
Copyright (C) 1987, 91-97, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -1389,4 +1389,8 @@ extern void init_alias_once PROTO ((void));
extern void init_alias_analysis PROTO ((void));
extern void end_alias_analysis PROTO ((void));
/* In local-alloc.c */
extern int optimize_reg_copy_1 PROTO((rtx, rtx, rtx));
extern void optimize_reg_copy_2 PROTO((rtx, rtx, rtx));
#endif /* _RTL_H */