public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Probable bug in gcc/reg-stack.c (example given)
@ 1997-08-26  2:30 Stan Cox
  1997-08-26  2:39 ` this week's patch for libgcc2-elf.a UNNECESSARY Robert Lipe
  0 siblings, 1 reply; 2+ messages in thread
From: Stan Cox @ 1997-08-26  2:30 UTC (permalink / raw)
  To: egcs

Bernd> Unfortunately, I don't think that it could easily handle them

This fixes reg-stack.c, but it is awkward as Bernd mentions.

--- /udd/sac/coxs/fm-fsf/reg-stack.c	Fri Aug  8 17:04:20 1997
+++ /pdd/c/sources/gcc-970803/reg-stack.c	Mon Aug 25 15:22:41 1997
@@ -2728,2 +2728,3 @@ subst_stack_regs (insn, regstack)
   register int i;
+  rtx head, jump, pat, cipat;
   int n_operands;
@@ -2798,2 +2799,32 @@ subst_stack_regs (insn, regstack)
     return;
+
+  /* If we are reached by a computed goto which sets this same stack register,
+     then pop this stack register, but maintain regstack. */
+
+  head = block_begin[BLOCK_NUM(insn)];
+  pat = PATTERN(insn);
+  if (GET_CODE (head) == CODE_LABEL
+      && GET_CODE (pat) == SET && STACK_REG_P (SET_DEST (pat)))
+    for (jump = LABEL_REFS (head);
+	 jump != head;
+	 jump = LABEL_NEXTREF (jump))
+      {
+	register int from_block = BLOCK_NUM (CONTAINING_INSN (jump));
+	cipat = PATTERN (CONTAINING_INSN (jump));
+	if (GET_CODE (cipat) == SET
+	    && SET_DEST (cipat) == pc_rtx
+	    && uses_reg_or_mem (SET_SRC (cipat)))
+	  {
+	    if (TEST_HARD_REG_BIT (block_out_reg_set[from_block],
+				   REGNO (SET_DEST (pat))))
+	      {
+		struct stack_def old;
+		bcopy (regstack->reg, old.reg, sizeof (old.reg));
+		emit_pop_insn (insn, regstack, SET_DEST (pat), emit_insn_before);
+		regstack->top += 1;
+		bcopy (old.reg, regstack->reg, sizeof (old.reg));
+		SET_HARD_REG_BIT (regstack->reg_set, REGNO (SET_DEST (pat)));
+	      }
+	  }
+      }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: this week's patch for libgcc2-elf.a UNNECESSARY
  1997-08-26  2:30 Probable bug in gcc/reg-stack.c (example given) Stan Cox
@ 1997-08-26  2:39 ` Robert Lipe
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Lipe @ 1997-08-26  2:39 UTC (permalink / raw)
  To: egcs

Robert Lipe wrote:

> This patch was originally against gcc2-970803, but it seems to 
> vastly help egcs-970825.   Without it, libgcc2-elf.a doesn't 

Later in the day, Kean Johnston (jkj@sco.com) submitted a more ambitious
patch to address this problem.   Though I knew that the way the elf/coff
libbing was done was really icky and knew it needed multilibbing, I didn't
do it.

Please use Kean's and disregard mine.   His is a real fix, where mine
is a patch to a kludge.

Kean, will you please also submit this to the gcc2 group in the hopes
that it might actually be accepted before 2.8.0?

Thanx,
RJL

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-08-26  2:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-26  2:30 Probable bug in gcc/reg-stack.c (example given) Stan Cox
1997-08-26  2:39 ` this week's patch for libgcc2-elf.a UNNECESSARY Robert Lipe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).