summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/regmove.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-05-09 20:02:13 +0000
committerobrien <obrien@FreeBSD.org>2002-05-09 20:02:13 +0000
commitc8f5fc7032940ad6633f932ac40cade82ec4d0cc (patch)
tree29a0f0a6c79a69ecc64f612947a0fe5904311713 /contrib/gcc/regmove.c
parentc9ab9ae440a8066b2c2b85b157b1fdadcf09916a (diff)
downloadFreeBSD-src-c8f5fc7032940ad6633f932ac40cade82ec4d0cc.zip
FreeBSD-src-c8f5fc7032940ad6633f932ac40cade82ec4d0cc.tar.gz
Gcc 3.1.0 pre-release from the FSF anoncvs repo on 9-May-2002 15:57:15 EDT.
Diffstat (limited to 'contrib/gcc/regmove.c')
-rw-r--r--contrib/gcc/regmove.c74
1 files changed, 36 insertions, 38 deletions
diff --git a/contrib/gcc/regmove.c b/contrib/gcc/regmove.c
index 9530128..59b1005 100644
--- a/contrib/gcc/regmove.c
+++ b/contrib/gcc/regmove.c
@@ -1328,19 +1328,22 @@ regmove_optimize (f, nregs, regmove_dump_file)
}
src_class = reg_preferred_class (REGNO (src));
dst_class = reg_preferred_class (REGNO (dst));
- if (! regclass_compatible_p (src_class, dst_class))
+
+ if (! (src_note = find_reg_note (insn, REG_DEAD, src)))
{
- if (!copy_src)
- {
- copy_src = src;
- copy_dst = dst;
- }
+ /* We used to force the copy here like in other cases, but
+ it produces worse code, as it eliminates no copy
+ instructions and the copy emitted will be produced by
+ reload anyway. On patterns with multiple alternatives,
+ there may be better sollution availble.
+
+ In particular this change produced slower code for numeric
+ i387 programs. */
+
continue;
}
- /* Can not modify an earlier insn to set dst if this insn
- uses an old value in the source. */
- if (reg_overlap_mentioned_p (dst, SET_SRC (set)))
+ if (! regclass_compatible_p (src_class, dst_class))
{
if (!copy_src)
{
@@ -1350,7 +1353,9 @@ regmove_optimize (f, nregs, regmove_dump_file)
continue;
}
- if (! (src_note = find_reg_note (insn, REG_DEAD, src)))
+ /* Can not modify an earlier insn to set dst if this insn
+ uses an old value in the source. */
+ if (reg_overlap_mentioned_p (dst, SET_SRC (set)))
{
if (!copy_src)
{
@@ -1360,7 +1365,6 @@ regmove_optimize (f, nregs, regmove_dump_file)
continue;
}
-
/* If src is set once in a different basic block,
and is set equal to a constant, then do not use
it for this optimization, as this would make it
@@ -2327,19 +2331,17 @@ combine_stack_adjustments_for_block (bb)
HOST_WIDE_INT last_sp_adjust = 0;
rtx last_sp_set = NULL_RTX;
struct csa_memlist *memlist = NULL;
- rtx pending_delete;
- rtx insn, next;
+ rtx insn, next, set;
struct record_stack_memrefs_data data;
+ bool end_of_block = false;
- for (insn = bb->head; ; insn = next)
+ for (insn = bb->head; !end_of_block ; insn = next)
{
- rtx set;
-
- pending_delete = NULL_RTX;
+ end_of_block = insn == bb->end;
next = NEXT_INSN (insn);
if (! INSN_P (insn))
- goto processed;
+ continue;
set = single_set_for_csa (insn);
if (set)
@@ -2361,7 +2363,7 @@ combine_stack_adjustments_for_block (bb)
{
last_sp_set = insn;
last_sp_adjust = this_adjust;
- goto processed;
+ continue;
}
/* If not all recorded memrefs can be adjusted, or the
@@ -2393,9 +2395,9 @@ combine_stack_adjustments_for_block (bb)
this_adjust))
{
/* It worked! */
- pending_delete = insn;
+ delete_insn (insn);
last_sp_adjust += this_adjust;
- goto processed;
+ continue;
}
}
@@ -2414,16 +2416,20 @@ combine_stack_adjustments_for_block (bb)
last_sp_adjust += this_adjust;
free_csa_memlist (memlist);
memlist = NULL;
- goto processed;
+ continue;
}
}
- /* Combination failed. Restart processing from here. */
+ /* Combination failed. Restart processing from here. If
+ deallocation+allocation conspired to cancel, we can
+ delete the old deallocation insn. */
+ if (last_sp_set && last_sp_adjust == 0)
+ delete_insn (insn);
free_csa_memlist (memlist);
memlist = NULL;
last_sp_set = insn;
last_sp_adjust = this_adjust;
- goto processed;
+ continue;
}
/* Find a predecrement of exactly the previous adjustment and
@@ -2449,15 +2455,12 @@ combine_stack_adjustments_for_block (bb)
stack_pointer_rtx),
0))
{
- if (last_sp_set == bb->head)
- bb->head = NEXT_INSN (last_sp_set);
delete_insn (last_sp_set);
-
free_csa_memlist (memlist);
memlist = NULL;
last_sp_set = NULL_RTX;
last_sp_adjust = 0;
- goto processed;
+ continue;
}
}
@@ -2467,7 +2470,7 @@ combine_stack_adjustments_for_block (bb)
&& !for_each_rtx (&PATTERN (insn), record_stack_memrefs, &data))
{
memlist = data.memlist;
- goto processed;
+ continue;
}
memlist = data.memlist;
@@ -2477,20 +2480,15 @@ combine_stack_adjustments_for_block (bb)
&& (GET_CODE (insn) == CALL_INSN
|| reg_mentioned_p (stack_pointer_rtx, PATTERN (insn))))
{
+ if (last_sp_set && last_sp_adjust == 0)
+ delete_insn (last_sp_set);
free_csa_memlist (memlist);
memlist = NULL;
last_sp_set = NULL_RTX;
last_sp_adjust = 0;
}
-
- processed:
- if (insn == bb->end)
- break;
-
- if (pending_delete)
- delete_insn (pending_delete);
}
- if (pending_delete)
- delete_insn (pending_delete);
+ if (last_sp_set && last_sp_adjust == 0)
+ delete_insn (last_sp_set);
}
OpenPOWER on IntegriCloud