From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Iverson To: mark@markmitchell.com Cc: egcs@egcs.cygnus.com, egcs-patches@egcs.cygnus.com Subject: Re: MIPS test failures Date: Fri, 12 Mar 1999 18:20:00 -0000 Message-id: <199903130220.SAA16668@Canada.AI.SRI.COM> In-reply-to: Your message of "Fri, 12 Mar 1999 07:57:08 PST." < 199903121557.HAA07434@adsl-206-170-148-33.dsl.pacbell.net > References: <199903121557.HAA07434@adsl-206-170-148-33.dsl.pacbell.net> X-SW-Source: 1999-03/msg00469.html In message < 199903121557.HAA07434@adsl-206-170-148-33.dsl.pacbell.net > you writ e: > > Folks -- > > What's the status of the problem that's causing many MIPS C++ tests to > fail at the moment? For example, g++.brendan/copy3.C reports an error > involving an undefined `.Lxxx' symbol at link-time on > mips-sgi-irix6.5. Do we know what the problem is? Do we know how to > fix it? > > I need to fix this problem soon, so I'm happy to look at it if nobody > else is going to, but I'd like to avoid duplicating work. The fix in http://egcs.cygnus.com/ml/egcs-patches/1999-03/msg00206.html solves the problem but seems to be overkill to me. I managed a good bootstrap on mips-sgi-irix6.3 with the following patches. ------------------------------------------------------------------------------- Lee Iverson SRI International leei@ai.sri.com 333 Ravenswood Ave., Menlo Park CA 94025 http://www.ai.sri.com/~leei/ (650) 859-3307 1999-03-12 Lee Iverson * jump.c (restore_reg_labels_1): New function. Searches for label_refs and restores REG_LABEL notes as appropriate. (restore_reg_labels): New function. Restores any lost REG_LABEL notes to an instruction. * reload1.c (reload): Call restore_reg_label to restore REG_LABEL notes which may have been destroyed. Index: jump.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/jump.c,v retrieving revision 1.55 diff -p -u -r1.55 jump.c --- jump.c 1999/03/10 19:45:18 1.55 +++ jump.c 1999/03/13 02:09:28 @@ -3726,6 +3726,95 @@ mark_jump_label (x, insn, cross_jump) } } +/* Iterate over all components of X that might contain a LABEL_REF, adding + REG_LABEL notes to the INSN if not already there. */ + +static void +restore_reg_labels_1 (x, insn) + rtx x, insn; +{ + register RTX_CODE code = GET_CODE (x); + register int i; + register char *fmt; + + switch (code) + { + case PC: + case CC0: + case REG: + case SUBREG: + case CONST_INT: + case SYMBOL_REF: + case CONST_DOUBLE: + case CLOBBER: + case CALL: + /* Is this correct? Are REG_LABELs never generated for ADDR_VECs? */ + case ADDR_VEC: + case ADDR_DIFF_VEC: + return; + + case MEM: + /* If this is a constant-pool reference, see if it is a label. */ + if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF + && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0))) + restore_reg_labels_1 (get_pool_constant (XEXP (x, 0)), insn); + break; + + case LABEL_REF: + { + rtx label = XEXP (x, 0); + rtx note; + + if (GET_CODE (label) != CODE_LABEL) + abort (); + + /* Ignore references to labels of containing functions. */ + if (LABEL_REF_NONLOCAL_P (x)) + break; + + if (GET_CODE (insn) == JUMP_INSN) + ; + + /* Otherwise, add a REG_LABEL note for LABEL unless there already + is one. */ + else if (! find_reg_note (insn, REG_LABEL, label)) + { + REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_LABEL, label, + REG_NOTES (insn)); + } + + return; + } + + default: + break; + } + + fmt = GET_RTX_FORMAT (code); + for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + { + if (fmt[i] == 'e') + restore_reg_labels_1 (XEXP (x, i), insn); + else if (fmt[i] == 'E') + { + register int j; + for (j = 0; j < XVECLEN (x, i); j++) + restore_reg_labels_1 (XVECEXP (x, i, j), insn); + } + } +} + +/* If the REG_LABEL notes may have been deleted from an INSN, then call this + to reestablish them. */ + +void +restore_reg_labels (insn) + rtx insn; +{ + if (! INSN_DELETED_P (insn)) + restore_reg_labels_1 (PATTERN (insn), insn); +} + /* If all INSN does is set the pc, delete it, and delete the insn that set the condition codes for it if that's what the previous thing was. */ Index: reload1.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v retrieving revision 1.135 diff -p -u -r1.135 reload1.c --- reload1.c 1999/03/12 12:39:59 1.135 +++ reload1.c 1999/03/13 02:09:29 @@ -1157,6 +1157,9 @@ reload (first, global, dumpfile) pnote = &XEXP (*pnote, 1); } + /* Restore any REG_LABEL notes which are now missing. */ + restore_reg_labels (insn); + /* And simplify (subreg (reg)) if it appears as an operand. */ cleanup_subreg_operands (insn); } From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Iverson To: mark@markmitchell.com Cc: egcs@egcs.cygnus.com, egcs-patches@egcs.cygnus.com Subject: Re: MIPS test failures Date: Wed, 31 Mar 1999 23:46:00 -0000 Message-ID: <199903130220.SAA16668@Canada.AI.SRI.COM> References: <199903121557.HAA07434@adsl-206-170-148-33.dsl.pacbell.net> X-SW-Source: 1999-03n/msg00474.html Message-ID: <19990331234600.LaS0R3VqrGYvDlp1PLRvq50znVmirIt2Kga2tVK_cJg@z> In message < 199903121557.HAA07434@adsl-206-170-148-33.dsl.pacbell.net > you writ e: > > Folks -- > > What's the status of the problem that's causing many MIPS C++ tests to > fail at the moment? For example, g++.brendan/copy3.C reports an error > involving an undefined `.Lxxx' symbol at link-time on > mips-sgi-irix6.5. Do we know what the problem is? Do we know how to > fix it? > > I need to fix this problem soon, so I'm happy to look at it if nobody > else is going to, but I'd like to avoid duplicating work. The fix in http://egcs.cygnus.com/ml/egcs-patches/1999-03/msg00206.html solves the problem but seems to be overkill to me. I managed a good bootstrap on mips-sgi-irix6.3 with the following patches. ------------------------------------------------------------------------------- Lee Iverson SRI International leei@ai.sri.com 333 Ravenswood Ave., Menlo Park CA 94025 http://www.ai.sri.com/~leei/ (650) 859-3307 1999-03-12 Lee Iverson * jump.c (restore_reg_labels_1): New function. Searches for label_refs and restores REG_LABEL notes as appropriate. (restore_reg_labels): New function. Restores any lost REG_LABEL notes to an instruction. * reload1.c (reload): Call restore_reg_label to restore REG_LABEL notes which may have been destroyed. Index: jump.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/jump.c,v retrieving revision 1.55 diff -p -u -r1.55 jump.c --- jump.c 1999/03/10 19:45:18 1.55 +++ jump.c 1999/03/13 02:09:28 @@ -3726,6 +3726,95 @@ mark_jump_label (x, insn, cross_jump) } } +/* Iterate over all components of X that might contain a LABEL_REF, adding + REG_LABEL notes to the INSN if not already there. */ + +static void +restore_reg_labels_1 (x, insn) + rtx x, insn; +{ + register RTX_CODE code = GET_CODE (x); + register int i; + register char *fmt; + + switch (code) + { + case PC: + case CC0: + case REG: + case SUBREG: + case CONST_INT: + case SYMBOL_REF: + case CONST_DOUBLE: + case CLOBBER: + case CALL: + /* Is this correct? Are REG_LABELs never generated for ADDR_VECs? */ + case ADDR_VEC: + case ADDR_DIFF_VEC: + return; + + case MEM: + /* If this is a constant-pool reference, see if it is a label. */ + if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF + && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0))) + restore_reg_labels_1 (get_pool_constant (XEXP (x, 0)), insn); + break; + + case LABEL_REF: + { + rtx label = XEXP (x, 0); + rtx note; + + if (GET_CODE (label) != CODE_LABEL) + abort (); + + /* Ignore references to labels of containing functions. */ + if (LABEL_REF_NONLOCAL_P (x)) + break; + + if (GET_CODE (insn) == JUMP_INSN) + ; + + /* Otherwise, add a REG_LABEL note for LABEL unless there already + is one. */ + else if (! find_reg_note (insn, REG_LABEL, label)) + { + REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_LABEL, label, + REG_NOTES (insn)); + } + + return; + } + + default: + break; + } + + fmt = GET_RTX_FORMAT (code); + for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + { + if (fmt[i] == 'e') + restore_reg_labels_1 (XEXP (x, i), insn); + else if (fmt[i] == 'E') + { + register int j; + for (j = 0; j < XVECLEN (x, i); j++) + restore_reg_labels_1 (XVECEXP (x, i, j), insn); + } + } +} + +/* If the REG_LABEL notes may have been deleted from an INSN, then call this + to reestablish them. */ + +void +restore_reg_labels (insn) + rtx insn; +{ + if (! INSN_DELETED_P (insn)) + restore_reg_labels_1 (PATTERN (insn), insn); +} + /* If all INSN does is set the pc, delete it, and delete the insn that set the condition codes for it if that's what the previous thing was. */ Index: reload1.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v retrieving revision 1.135 diff -p -u -r1.135 reload1.c --- reload1.c 1999/03/12 12:39:59 1.135 +++ reload1.c 1999/03/13 02:09:29 @@ -1157,6 +1157,9 @@ reload (first, global, dumpfile) pnote = &XEXP (*pnote, 1); } + /* Restore any REG_LABEL notes which are now missing. */ + restore_reg_labels (insn); + /* And simplify (subreg (reg)) if it appears as an operand. */ cleanup_subreg_operands (insn); }