This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] dwarf2out.c: Don't emit DW_OP_regx for register -1


On a mips64 target (and probably just mips too), when compiling at a
sufficiently high optimization level, it's possible to see DW_OP_regx
for register -1 in the DWARF 2 output.  E.g,

<2><156dc>: Abbrev Number: 46 (DW_TAG_variable)
  DW_AT_name        : (indirect string, offset: 0x2778): addr
  DW_AT_decl_file   : 1 
  DW_AT_decl_line   : 157 
  DW_AT_type        : <13912> 
<2><15a3b>: Abbrev Number: 53 (DW_TAG_variable)
  DW_AT_abstract_origin: <156dc> 
  DW_AT_location    : 6 byte block: 90 ff ff ff ff f (DW_OP_regx: 4294967295; )

The patch below prevents the above from happening when there's no
suitable mapping from internal gcc register numbers to dwarf register
numbers.

I've boostrapped and tested for regressions on i386 GNU/Linux.  No
problems found.

Okay to commit?

	* dwarf2out.c (reg_loc_descriptor): Don't generate DW_OP_regx
	in a location expression when reg_number() is unable to provide
	a suitable mapping.

Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.406
diff -u -p -r1.406 dwarf2out.c
--- gcc/dwarf2out.c	6 Mar 2003 10:23:46 -0000	1.406
+++ gcc/dwarf2out.c	6 Mar 2003 21:02:29 -0000
@@ -8175,7 +8201,14 @@ reg_loc_descriptor (rtl)
   reg = reg_number (rtl);
   regs = (*targetm.dwarf_register_span) (rtl);
 
-  if (HARD_REGNO_NREGS (reg, GET_MODE (rtl)) > 1
+  if (reg == (unsigned int) -1)
+    {
+      /* Some implementations of DBX_REGISTER_NUMBER (which is called
+	 from reg_number()) use -1 to indicate that there is no mapping
+	 for a given register.  */
+      return 0;
+    }
+  else if (HARD_REGNO_NREGS (reg, GET_MODE (rtl)) > 1
       || regs)
     return multiple_reg_loc_descriptor (rtl, regs);
   else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]