Commit 184bb750 by J"orn Rennecke Committed by Jeff Law

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
parent 9d194380
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) 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 * regclass.c (record_address_regs): Don't use REG_OK_FOR_BASE_P
......
/* Allocate registers within a basic block, for GNU compiler. /* 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. This file is part of GNU CC.
...@@ -249,8 +249,6 @@ static int validate_equiv_mem PROTO((rtx, rtx, rtx)); ...@@ -249,8 +249,6 @@ static int validate_equiv_mem PROTO((rtx, rtx, rtx));
static int contains_replace_regs PROTO((rtx, char *)); static int contains_replace_regs PROTO((rtx, char *));
static int memref_referenced_p PROTO((rtx, rtx)); static int memref_referenced_p PROTO((rtx, rtx));
static int memref_used_between_p PROTO((rtx, 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 update_equiv_regs PROTO((void));
static void block_alloc PROTO((int)); static void block_alloc PROTO((int));
static int qty_sugg_compare PROTO((int, int)); static int qty_sugg_compare PROTO((int, int));
...@@ -752,7 +750,7 @@ memref_used_between_p (memref, start, end) ...@@ -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 DEST to be tied to SRC, thus often saving one register in addition to a
register-register copy. */ register-register copy. */
static void int
optimize_reg_copy_1 (insn, dest, src) optimize_reg_copy_1 (insn, dest, src)
rtx insn; rtx insn;
rtx dest; rtx dest;
...@@ -764,15 +762,15 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -764,15 +762,15 @@ optimize_reg_copy_1 (insn, dest, src)
int sregno = REGNO (src); int sregno = REGNO (src);
int dregno = REGNO (dest); int dregno = REGNO (dest);
/* We don't want to mess with hard regs if register classes are small. */
if (sregno == dregno if (sregno == dregno
/* We don't want to mess with hard regs if register classes are small. */
|| (SMALL_REGISTER_CLASSES || (SMALL_REGISTER_CLASSES
&& (sregno < FIRST_PSEUDO_REGISTER && (sregno < FIRST_PSEUDO_REGISTER
|| dregno < FIRST_PSEUDO_REGISTER)) || dregno < FIRST_PSEUDO_REGISTER))
/* We don't see all updates to SP if they are in an auto-inc memory /* 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. */ reference, so we must disallow this optimization on them. */
|| sregno == STACK_POINTER_REGNUM || dregno == STACK_POINTER_REGNUM) || sregno == STACK_POINTER_REGNUM || dregno == STACK_POINTER_REGNUM)
return; return 0;
for (p = NEXT_INSN (insn); p; p = NEXT_INSN (p)) for (p = NEXT_INSN (insn); p; p = NEXT_INSN (p))
{ {
...@@ -864,9 +862,13 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -864,9 +862,13 @@ optimize_reg_copy_1 (insn, dest, src)
later. Make sure ALL of DEST dies here; again, this is later. Make sure ALL of DEST dies here; again, this is
overly conservative. */ overly conservative. */
if (dest_death == 0 if (dest_death == 0
&& (dest_death = find_regno_note (q, REG_DEAD, dregno)) != 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); if (GET_MODE (XEXP (dest_death, 0)) != GET_MODE (dest))
failed = 1, dest_death = 0;
else
remove_note (q, dest_death);
}
} }
if (! failed) if (! failed)
...@@ -876,7 +878,7 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -876,7 +878,7 @@ optimize_reg_copy_1 (insn, dest, src)
if (REG_LIVE_LENGTH (sregno) >= 0) if (REG_LIVE_LENGTH (sregno) >= 0)
{ {
REG_LIVE_LENGTH (sregno) -= length; 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 combine if sched is not run, so make sure that we
still have a reasonable value. */ still have a reasonable value. */
if (REG_LIVE_LENGTH (sregno) < 2) if (REG_LIVE_LENGTH (sregno) < 2)
...@@ -907,7 +909,7 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -907,7 +909,7 @@ optimize_reg_copy_1 (insn, dest, src)
REG_NOTES (p) = dest_death; REG_NOTES (p) = dest_death;
} }
return; return ! failed;
} }
/* If SRC is a hard register which is set or killed in some other /* 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) ...@@ -916,6 +918,7 @@ optimize_reg_copy_1 (insn, dest, src)
&& dead_or_set_p (p, src)) && dead_or_set_p (p, src))
break; break;
} }
return 0;
} }
/* INSN is a copy of SRC to DEST, in which SRC dies. See if we now have /* 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) ...@@ -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 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. */ this for hard registers since the substitutions we may make might fail. */
static void void
optimize_reg_copy_2 (insn, dest, src) optimize_reg_copy_2 (insn, dest, src)
rtx insn; rtx insn;
rtx dest; rtx dest;
......
/* Communication between reload.c and reload1.c. /* 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. This file is part of GNU CC.
...@@ -200,9 +200,10 @@ extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *, ...@@ -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. */ /* Return 1 if register REGNO is the subject of a clobber in insn INSN. */
extern int regno_clobbered_p PROTO((int, rtx)); extern int regno_clobbered_p PROTO((int, rtx));
/* Functions in reload1.c: */ /* Functions in reload1.c: */
int count_occurrences PROTO((rtx, rtx));
/* Initialize the reload pass once per compilation. */ /* Initialize the reload pass once per compilation. */
extern void init_reload PROTO((void)); extern void init_reload PROTO((void));
......
/* Reload pseudo regs into hard regs for insns that require hard regs. /* 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. This file is part of GNU CC.
...@@ -392,7 +392,6 @@ static void emit_reload_insns PROTO((rtx)); ...@@ -392,7 +392,6 @@ static void emit_reload_insns PROTO((rtx));
static void delete_output_reload PROTO((rtx, int, rtx)); static void delete_output_reload PROTO((rtx, int, rtx));
static void inc_for_reload PROTO((rtx, rtx, int)); static void inc_for_reload PROTO((rtx, rtx, int));
static int constraint_accepts_reg_p PROTO((char *, rtx)); 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 void reload_cse_invalidate_regno PROTO((int, enum machine_mode, int));
static int reload_cse_mem_conflict_p PROTO((rtx, rtx)); static int reload_cse_mem_conflict_p PROTO((rtx, rtx));
static void reload_cse_invalidate_mem PROTO((rtx)); static void reload_cse_invalidate_mem PROTO((rtx));
...@@ -7510,7 +7509,7 @@ constraint_accepts_reg_p (string, reg) ...@@ -7510,7 +7509,7 @@ constraint_accepts_reg_p (string, reg)
/* Return the number of places FIND appears within X, but don't count /* Return the number of places FIND appears within X, but don't count
an occurrence if some SET_DEST is FIND. */ an occurrence if some SET_DEST is FIND. */
static int int
count_occurrences (x, find) count_occurrences (x, find)
register rtx x, find; register rtx x, find;
{ {
......
/* Register Transfer Language (RTL) definitions for GNU C-Compiler /* 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. This file is part of GNU CC.
...@@ -1389,4 +1389,8 @@ extern void init_alias_once PROTO ((void)); ...@@ -1389,4 +1389,8 @@ extern void init_alias_once PROTO ((void));
extern void init_alias_analysis PROTO ((void)); extern void init_alias_analysis PROTO ((void));
extern void end_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 */ #endif /* _RTL_H */
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