Commit 47700802 by Richard Stallman

(dbxout_symbol_location): Subroutine broken out from dbxout_symbol.

(dbxout_symbol_location): Subroutine broken out from
dbxout_symbol.  Handle CONCAT here.
(dbxout_symbol_name): New subroutine.  Handle anonymous decls too.
(dbxout_reg_parms): Simplify using dbxout_symbol_location.
Handle CONCAT.

From-SVN: r4921
parent ec4738c0
......@@ -263,6 +263,8 @@ void dbxout_symbol ();
static void dbxout_type_name ();
static void dbxout_type ();
static void dbxout_typedefs ();
static void dbxout_symbol_name ();
static void dbxout_symbol_location ();
static void dbxout_prepare_symbol ();
static void dbxout_finish_symbol ();
static void dbxout_continue ();
......@@ -1667,21 +1669,39 @@ dbxout_symbol (decl, local)
leaf_renumber_regs_insn (DECL_RTL (decl));
#endif
dbxout_symbol_location (decl, type, 0, DECL_RTL (decl));
}
}
/* Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL.
Add SUFFIX to its name, if SUFFIX is not 0.
Describe the variable as residing in HOME
(usually HOME is DECL_RTL (DECL), but not always). */
static void
dbxout_symbol_location (decl, type, suffix, home)
tree decl, type;
char *suffix;
rtx home;
{
int letter = 0;
int regno = -1;
/* Don't mention a variable at all
if it was completely optimized into nothingness.
If DECL was from an inline function, then it's rtl
If the decl was from an inline function, then it's rtl
is not identically the rtl that was used in this
particular compilation. */
if (GET_CODE (DECL_RTL (decl)) == REG)
if (GET_CODE (home) == REG)
{
regno = REGNO (DECL_RTL (decl));
regno = REGNO (home);
if (regno >= FIRST_PSEUDO_REGISTER)
return;
}
else if (GET_CODE (DECL_RTL (decl)) == SUBREG)
else if (GET_CODE (home) == SUBREG)
{
rtx value = DECL_RTL (decl);
rtx value = home;
int offset = 0;
while (GET_CODE (value) == SUBREG)
{
......@@ -1695,7 +1715,7 @@ dbxout_symbol (decl, local)
return;
regno += offset;
}
alter_subreg (DECL_RTL (decl));
alter_subreg (home);
}
/* The kind-of-variable letter depends on where
......@@ -1711,8 +1731,8 @@ dbxout_symbol (decl, local)
no letter at all, and N_LSYM, for auto variable,
r and N_RSYM for register variable. */
if (GET_CODE (DECL_RTL (decl)) == MEM
&& GET_CODE (XEXP (DECL_RTL (decl), 0)) == SYMBOL_REF)
if (GET_CODE (home) == MEM
&& GET_CODE (XEXP (home, 0)) == SYMBOL_REF)
{
if (TREE_PUBLIC (decl))
{
......@@ -1721,7 +1741,7 @@ dbxout_symbol (decl, local)
}
else
{
current_sym_addr = XEXP (DECL_RTL (decl), 0);
current_sym_addr = XEXP (home, 0);
letter = decl_function_context (decl) ? 'V' : 'S';
......@@ -1733,7 +1753,7 @@ dbxout_symbol (decl, local)
current_sym_code = DBX_STATIC_CONST_VAR_CODE;
else
{
/* Ultrix `as' seems to need this. */
/* Ultrix `as' seems to need this. */
#ifdef DBX_STATIC_STAB_DATA_SECTION
data_section ();
#endif
......@@ -1747,10 +1767,10 @@ dbxout_symbol (decl, local)
current_sym_code = N_RSYM;
current_sym_value = DBX_REGISTER_NUMBER (regno);
}
else if (GET_CODE (DECL_RTL (decl)) == MEM
&& (GET_CODE (XEXP (DECL_RTL (decl), 0)) == MEM
|| (GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG
&& REGNO (XEXP (DECL_RTL (decl), 0)) != FRAME_POINTER_REGNUM)))
else if (GET_CODE (home) == MEM
&& (GET_CODE (XEXP (home, 0)) == MEM
|| (GET_CODE (XEXP (home, 0)) == REG
&& REGNO (XEXP (home, 0)) != FRAME_POINTER_REGNUM)))
/* If the value is indirect by memory or by a register
that isn't the frame pointer
then it means the object is variable-sized and address through
......@@ -1759,19 +1779,19 @@ dbxout_symbol (decl, local)
If it's not a parameter, ignore it.
(VAR_DECLs like this can be made by integrate.c.) */
{
if (GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG)
if (GET_CODE (XEXP (home, 0)) == REG)
{
letter = 'r';
current_sym_code = N_RSYM;
current_sym_value = DBX_REGISTER_NUMBER (REGNO (XEXP (DECL_RTL (decl), 0)));
current_sym_value = DBX_REGISTER_NUMBER (REGNO (XEXP (home, 0)));
}
else
{
current_sym_code = N_LSYM;
/* DECL_RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
/* RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
We want the value of that CONST_INT. */
current_sym_value
= DEBUGGER_AUTO_OFFSET (XEXP (XEXP (DECL_RTL (decl), 0), 0));
= DEBUGGER_AUTO_OFFSET (XEXP (XEXP (home, 0), 0));
}
/* Effectively do build_pointer_type, but don't cache this type,
......@@ -1781,27 +1801,27 @@ dbxout_symbol (decl, local)
type = make_node (POINTER_TYPE);
TREE_TYPE (type) = TREE_TYPE (decl);
}
else if (GET_CODE (DECL_RTL (decl)) == MEM
&& GET_CODE (XEXP (DECL_RTL (decl), 0)) == REG)
else if (GET_CODE (home) == MEM
&& GET_CODE (XEXP (home, 0)) == REG)
{
current_sym_code = N_LSYM;
current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (DECL_RTL (decl), 0));
current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
}
else if (GET_CODE (DECL_RTL (decl)) == MEM
&& GET_CODE (XEXP (DECL_RTL (decl), 0)) == PLUS
&& GET_CODE (XEXP (XEXP (DECL_RTL (decl), 0), 1)) == CONST_INT)
else if (GET_CODE (home) == MEM
&& GET_CODE (XEXP (home, 0)) == PLUS
&& GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
{
current_sym_code = N_LSYM;
/* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
/* RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
We want the value of that CONST_INT. */
current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (DECL_RTL (decl), 0));
current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
}
else if (GET_CODE (DECL_RTL (decl)) == MEM
&& GET_CODE (XEXP (DECL_RTL (decl), 0)) == CONST)
else if (GET_CODE (home) == MEM
&& GET_CODE (XEXP (home, 0)) == CONST)
{
/* Handle an obscure case which can arise when optimizing and
when there are few available registers. (This is *always*
the case for i386/i486 targets). The DECL_RTL looks like
the case for i386/i486 targets). The RTL looks like
(MEM (CONST ...)) even though this variable is a local `auto'
or a local `register' variable. In effect, what has happened
is that the reload pass has seen that all assignments and
......@@ -1812,13 +1832,36 @@ dbxout_symbol (decl, local)
this variable was itself `static'. */
current_sym_code = N_LCSYM;
letter = 'V';
current_sym_addr = XEXP (XEXP (DECL_RTL (decl), 0), 0);
current_sym_addr = XEXP (XEXP (home, 0), 0);
}
else if (GET_CODE (home) == CONCAT)
{
tree subtype = TREE_TYPE (type);
/* If the variable's storage is in two parts,
output each as a separate stab with a modified name. */
if (WORDS_BIG_ENDIAN)
dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 0));
else
dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 0));
/* Cast avoids warning in old compilers. */
current_sym_code = (STAB_CODE_TYPE) 0;
current_sym_value = 0;
current_sym_addr = 0;
dbxout_prepare_symbol (decl);
if (WORDS_BIG_ENDIAN)
dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 1));
else
dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 1));
return;
}
else
/* Address might be a MEM, when DECL is a variable-sized object.
Or it might be const0_rtx, meaning previous passes
want us to ignore this variable. */
break;
return;
/* Ok, start a symtab entry and output the variable name. */
FORCE_TEXT;
......@@ -1827,10 +1870,28 @@ dbxout_symbol (decl, local)
DBX_STATIC_BLOCK_START (asmfile, current_sym_code);
#endif
dbxout_symbol_name (decl, suffix, letter);
dbxout_type (type, 0, 0);
dbxout_finish_symbol (decl);
#ifdef DBX_STATIC_BLOCK_END
DBX_STATIC_BLOCK_END (asmfile, current_sym_code);
#endif
}
/* Output the symbol name of DECL for a stabs, with suffix SUFFIX.
Then output LETTER to indicate the kind of location the symbol has. */
static void
dbxout_symbol_name (decl, suffix, letter)
tree decl;
char *suffix;
int letter;
{
/* One slight hitch: if this is a VAR_DECL which is a static
class member, we must put out the mangled name instead of the
DECL_NAME. */
{
char *name;
/* Note also that static member (variable) names DO NOT begin
with underscores in .stabs directives. */
......@@ -1838,17 +1899,12 @@ dbxout_symbol (decl, local)
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
else
name = IDENTIFIER_POINTER (DECL_NAME (decl));
fprintf (asmfile, "%s \"%s:", ASM_STABS_OP, name);
}
if (letter) putc (letter, asmfile);
dbxout_type (type, 0, 0);
dbxout_finish_symbol (decl);
if (name == 0)
name = "(anon)";
fprintf (asmfile, "%s \"%s%s:", ASM_STABS_OP, name,
(suffix ? suffix : ""));
#ifdef DBX_STATIC_BLOCK_END
DBX_STATIC_BLOCK_END (asmfile, current_sym_code);
#endif
break;
}
if (letter) putc (letter, asmfile);
}
static void
......@@ -2149,26 +2205,12 @@ dbxout_reg_parms (parms)
&& REGNO (DECL_RTL (parms)) >= 0
&& REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER
&& PARM_PASSED_IN_MEMORY (parms))
{
current_sym_code = N_RSYM;
current_sym_value = DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms)));
current_sym_addr = 0;
FORCE_TEXT;
if (DECL_NAME (parms))
{
current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
fprintf (asmfile, "%s \"%s:r", ASM_STABS_OP,
IDENTIFIER_POINTER (DECL_NAME (parms)));
}
else
{
current_sym_nchars = 8;
fprintf (asmfile, "%s \"(anon):r", ASM_STABS_OP);
}
dbxout_type (TREE_TYPE (parms), 0, 0);
dbxout_finish_symbol (parms);
}
dbxout_symbol_location (parms, TREE_TYPE (parms),
0, DECL_RTL (parms));
else if (GET_CODE (DECL_RTL (parms)) == CONCAT
&& PARM_PASSED_IN_MEMORY (parms))
dbxout_symbol_location (parms, TREE_TYPE (parms),
0, DECL_RTL (parms));
/* Report parms that live in memory but not where they were passed. */
else if (GET_CODE (DECL_RTL (parms)) == MEM
&& GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
......@@ -2188,23 +2230,8 @@ dbxout_reg_parms (parms)
#endif
if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset) {...}
#endif
current_sym_code = N_LSYM;
current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (DECL_RTL (parms), 0));
current_sym_addr = 0;
FORCE_TEXT;
if (DECL_NAME (parms))
{
current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
fprintf (asmfile, "%s \"%s:", ASM_STABS_OP,
IDENTIFIER_POINTER (DECL_NAME (parms)));
}
else
{
current_sym_nchars = 8;
fprintf (asmfile, "%s \"(anon):", ASM_STABS_OP);
}
dbxout_type (TREE_TYPE (parms), 0, 0);
dbxout_finish_symbol (parms);
dbxout_symbol_location (parms, TREE_TYPE (parms),
0, DECL_RTL (parms));
}
#if 0
else if (GET_CODE (DECL_RTL (parms)) == MEM
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment