This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: internal compiler error
- To: egcs-patches at cygnus dot com, egcs-bugs at cygnus dot com
- Subject: Re: internal compiler error
- From: hjl at lucon dot org (H.J. Lu)
- Date: Tue, 7 Jul 1998 21:18:13 -0700 (PDT)
- Cc: Georg dot Baum at post dot rwth-aachen dot de
The problem is the register on the stack reg-stack.c is virtual. That
is why we have get_hard_regnum () to get the hard register number from
the virtual register.
--
H.J. Lu (hjl@gnu.org)
---
Tue Jul 7 21:08:22 1998 H.J. Lu (hjl@gnu.org)
* reg-stack.c (straighten_stack): Handle the virtual register
stack.
--- ../../../import/egcs/gcc/reg-stack.c Mon Apr 20 08:23:00 1998
+++ ./reg-stack.c Tue Jul 7 21:05:56 1998
@@ -297,7 +297,7 @@ mark_regs_pat (pat, set)
SET_HARD_REG_BIT (*set, regno);
}
-/* Reorganise the stack into ascending numbers,
+/* Reorganise the virtual register stack into ascending numbers,
after this insn. */
static void
@@ -305,15 +305,27 @@ straighten_stack (insn, regstack)
rtx insn;
stack regstack;
{
- struct stack_def temp_stack;
- int top;
+ if (regstack->reg_set)
+ {
+ struct stack_def temp_stack;
+ int top;
+ int first_start_reg;
+
+#if defined(__GNUC__) && __GNUC__ >= 2 && defined (__OPTIMIZE__)
+ first_start_reg = ffs (regstack->reg_set) - 1;
+#else
+ first_start_reg = 0;
+ for (top = regstack->reg_set; (top & 1) == 0; top >>= 1)
+ first_start_reg++;
+#endif
- temp_stack.reg_set = regstack->reg_set;
+ temp_stack.reg_set = regstack->reg_set;
- for (top = temp_stack.top = regstack->top; top >= 0; top--)
- temp_stack.reg[top] = FIRST_STACK_REG + temp_stack.top - top;
+ for (top = temp_stack.top = regstack->top; top >= 0; top--)
+ temp_stack.reg[top] = first_start_reg + temp_stack.top - top;
- change_stack (insn, regstack, &temp_stack, emit_insn_after);
+ change_stack (insn, regstack, &temp_stack, emit_insn_after);
+ }
}
/* Return non-zero if any stack register is mentioned somewhere within PAT. */
@@ -2407,11 +2419,9 @@ subst_stack_regs_pat (insn, regstack, pa