This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
stabs for invisible reference parameters
- To: gcc-patches at gcc dot gnu dot org
- Subject: stabs for invisible reference parameters
- From: Geoffrey Keating <geoffk at thief dot cygnus dot com>
- Date: Thu, 30 Nov 2000 23:26:52 -0800
- CC: jibm at redhat dot com
According to Jim Blandy, the type of an invisible reference parameters
should just be the type of the parameter, and it's the user's
responsibility to know that on the architecture, they're really passed
by reference. (Before, we were explicitly saying that the parameter
was a C++ reference as passed, which is a little confusing for plain C
code.)
This patch fixes a gdb regression. Tested on sparc-sun-solaris2.5.1.
I'll commit tommorow if there are no objections.
--
Geoff Keating <geoffk@redhat.com>
===File ~/patches/jimb-invisparam.patch=====================
2000-11-21 Jim Blandy <jimb@redhat.com>
* dbxout.c (dbxout_parms): Correctly describe parameters passed by
invisible reference in registers, but then spilled to the stack.
Remove code to emit a second stab for such parameters; it attempts
to describe the value's location by introducing a synthetic C++
`reference' type, and then saying the stack slot has that
reference type. This loses type information (breaking GDB's
`ptype' command, among other things) just to describe a location
which stabs can represent correctly in other ways.
Index: gcc/dbxout.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/dbxout.c,v
retrieving revision 1.182
diff -c -r1.182 dbxout.c
*** gcc/dbxout.c 2000/11/09 18:15:30 1.182
--- gcc/dbxout.c 2000/11/22 02:25:00
***************
*** 2514,2519 ****
--- 2514,2537 ----
dbxout_finish_symbol (parms);
}
else if (GET_CODE (DECL_RTL (parms)) == MEM
+ && GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
+ {
+ /* Parm was passed via invisible reference, with the reference
+ living on the stack. DECL_RTL looks like
+ (MEM (MEM (PLUS (REG ...) (CONST_INT ...)))). */
+ const char *decl_name = (DECL_NAME (parms)
+ ? IDENTIFIER_POINTER (DECL_NAME (parms))
+ : "(anon)");
+ current_sym_value
+ = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1));
+ current_sym_addr = 0;
+
+ FORCE_TEXT;
+ fprintf (asmfile, "%s\"%s:v", ASM_STABS_OP, decl_name);
+ dbxout_type (TREE_TYPE (parms), 0, 0);
+ dbxout_finish_symbol (parms);
+ }
+ else if (GET_CODE (DECL_RTL (parms)) == MEM
&& XEXP (DECL_RTL (parms), 0) != const0_rtx
/* ??? A constant address for a parm can happen
when the reg it lives in is equiv to a constant in memory.
***************
*** 2521,2542 ****
&& ! CONSTANT_P (XEXP (DECL_RTL (parms), 0)))
{
/* Parm was passed in registers but lives on the stack. */
- int aux_sym_value = 0;
current_sym_code = N_PSYM;
/* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
in which case we want the value of that CONST_INT,
! or (MEM (REG ...)) or (MEM (MEM ...)),
in which case we use a value of zero. */
if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG)
current_sym_value = 0;
- else if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
- {
- /* Remember the location on the stack the parm is moved to */
- aux_sym_value
- = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1));
- current_sym_value = 0;
- }
else
current_sym_value
= INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
--- 2539,2552 ----
&& ! CONSTANT_P (XEXP (DECL_RTL (parms), 0)))
{
/* Parm was passed in registers but lives on the stack. */
current_sym_code = N_PSYM;
/* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
in which case we want the value of that CONST_INT,
! or (MEM (REG ...)),
in which case we use a value of zero. */
if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG)
current_sym_value = 0;
else
current_sym_value
= INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
***************
*** 2576,2592 ****
XEXP (DECL_RTL (parms), 0));
dbxout_type (TREE_TYPE (parms), 0, 0);
dbxout_finish_symbol (parms);
- if (aux_sym_value != 0)
- {
- /* Generate an entry for the stack location */
-
- fprintf (asmfile, "%s\"%s:", ASM_STABS_OP,
- IDENTIFIER_POINTER (DECL_NAME (parms)));
- current_sym_value = aux_sym_value;
- current_sym_code = N_LSYM;
- dbxout_type (build_reference_type (TREE_TYPE (parms)), 0, 0);
- dbxout_finish_symbol (parms);
- }
}
}
}
--- 2586,2591 ----
============================================================