+2014-10-13 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/rs6000/rs6000.h (DBX_REGISTER_NUMBER): Pass format argument
+ to rs6000_dbx_register_number.
+ (DWARF_FRAME_REGNUM): Redefine as identity map.
+ (DWARF2_FRAME_REG_OUT): Call rs6000_dbx_register_number.
+ * config/rs6000/rs6000-protos.h (rs6000_dbx_register_number): Update.
+ * config/rs6000/rs6000.c (rs6000_dbx_register_number): Add format
+ argument to handle .debug_frame and .eh_frame directly. Always
+ translate SPE high register numbers. Add special treatment for CR,
+ but only in .debug_frame. Respect RS6000_USE_DWARF_NUMBERING.
+
+ * config/rs6000/sysv.h (DBX_REGISTER_NUMBER): Do not undefine.
+ * config/rs6000/freebsd.h (DBX_REGISTER_NUMBER): Remove.
+ (RS6000_USE_DWARF_NUMBERING): Define.
+ * config/rs6000/freebsd64.h (DBX_REGISTER_NUMBER): Remove.
+ (RS6000_USE_DWARF_NUMBERING): Define.
+ * config/rs6000/netbsd.h (DBX_REGISTER_NUMBER): Remove.
+ (RS6000_USE_DWARF_NUMBERING): Define.
+ * config/rs6000/lynx.h (DBX_REGISTER_NUMBER): Remove.
+ (RS6000_USE_DWARF_NUMBERING): Define.
+ * config/rs6000/aix.h (RS6000_USE_DWARF_NUMBERING): Define.
+ * config/rs6000/darwin.h (RS6000_USE_DWARF_NUMBERING): Define.
+
2014-10-13 Evgeny Stupachenko <evstupac@gmail.com>
* config/i386/i386.c (ix86_address_cost): Lower cost for
/* Static stack checking is supported by means of probes. */
#define STACK_CHECK_STATIC_BUILTIN 1
+
+/* Use standard DWARF numbering for DWARF debugging information. */
+#define RS6000_USE_DWARF_NUMBERING
+
/* So far, there is no rs6000_fold_builtin, if one is introduced, then
this will need to be modified similar to the x86 case. */
#define TARGET_FOLD_BUILTIN SUBTARGET_FOLD_BUILTIN
+
+/* Use standard DWARF numbering for DWARF debugging information. */
+#define RS6000_USE_DWARF_NUMBERING
+
#define RELOCATABLE_NEEDS_FIXUP \
(rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
-#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
+/* Use standard DWARF numbering for DWARF debugging information. */
+#define RS6000_USE_DWARF_NUMBERING
#define POWERPC_FREEBSD
/* The default value isn't sufficient in 64-bit mode. */
#define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
-#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
+/* Use standard DWARF numbering for DWARF debugging information. */
+#define RS6000_USE_DWARF_NUMBERING
/* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */
#undef ADJUST_FIELD_ALIGN
#undef HAVE_AS_TLS
#define HAVE_AS_TLS 0
-#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
+/* Use standard DWARF numbering for DWARF debugging information. */
+#define RS6000_USE_DWARF_NUMBERING
#ifdef CRT_BEGIN
/* This function is part of crtbegin*.o which is at the beginning of
{ "netbsd_endfile_spec", NETBSD_ENDFILE_SPEC },
-#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
+/* Use standard DWARF numbering for DWARF debugging information. */
+#define RS6000_USE_DWARF_NUMBERING
+
extern alias_set_type get_TOC_alias_set (void);
extern void rs6000_emit_prologue (void);
extern void rs6000_emit_load_toc_table (int);
-extern unsigned int rs6000_dbx_register_number (unsigned int);
+extern unsigned int rs6000_dbx_register_number (unsigned int, unsigned int);
extern void rs6000_emit_epilogue (int);
extern void rs6000_emit_eh_reg_restore (rtx, rtx);
extern const char * output_isel (rtx *);
}
}
-/* Map internal gcc register numbers to DWARF2 register numbers. */
+/* Map internal gcc register numbers to debug format register numbers.
+ FORMAT specifies the type of debug register number to use:
+ 0 -- debug information, except for frame-related sections
+ 1 -- DWARF .debug_frame section
+ 2 -- DWARF .eh_frame section */
unsigned int
-rs6000_dbx_register_number (unsigned int regno)
+rs6000_dbx_register_number (unsigned int regno, unsigned int format)
{
- if (regno <= 63 || write_symbols != DWARF2_DEBUG)
+ /* We never use the GCC internal number for SPE high registers.
+ Those are mapped to the 1200..1231 range for all debug formats. */
+ if (SPE_HIGH_REGNO_P (regno))
+ return regno - FIRST_SPE_HIGH_REGNO + 1200;
+
+ /* Except for the above, we use the internal number for non-DWARF
+ debug information, and also for .eh_frame. */
+ if ((format == 0 && write_symbols != DWARF2_DEBUG) || format == 2)
+ return regno;
+
+ /* On some platforms, we use the standard DWARF register
+ numbering for .debug_info and .debug_frame. */
+#ifdef RS6000_USE_DWARF_NUMBERING
+ if (regno <= 63)
return regno;
if (regno == LR_REGNO)
return 108;
if (regno == CTR_REGNO)
return 109;
+ /* Special handling for CR for .debug_frame: rs6000_emit_prologue has
+ translated any combination of CR2, CR3, CR4 saves to a save of CR2.
+ The actual code emitted saves the whole of CR, so we map CR2_REGNO
+ to the DWARF reg for CR. */
+ if (format == 1 && regno == CR2_REGNO)
+ return 64;
if (CR_REGNO_P (regno))
return regno - CR0_REGNO + 86;
if (regno == CA_REGNO)
return 99;
if (regno == SPEFSCR_REGNO)
return 612;
- if (SPE_HIGH_REGNO_P (regno))
- return regno - FIRST_SPE_HIGH_REGNO + 1200;
+#endif
return regno;
}
((r) >= 1200 ? ((r) - 1200 + (DWARF_FRAME_REGISTERS - 32)) : (r))
/* Use standard DWARF numbering for DWARF debugging information. */
-#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
+#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number ((REGNO), 0)
/* Use gcc hard register numbering for eh_frame. */
-#define DWARF_FRAME_REGNUM(REGNO) \
- (SPE_HIGH_REGNO_P (REGNO) ? ((REGNO) - FIRST_SPE_HIGH_REGNO + 1200) : (REGNO))
+#define DWARF_FRAME_REGNUM(REGNO) (REGNO)
/* Map register numbers held in the call frame info that gcc has
collected using DWARF_FRAME_REGNUM to those that should be output in
- .debug_frame and .eh_frame. We continue to use gcc hard reg numbers
- for .eh_frame, but use the numbers mandated by the various ABIs for
- .debug_frame. rs6000_emit_prologue has translated any combination of
- CR2, CR3, CR4 saves to a save of CR2. The actual code emitted saves
- the whole of CR, so we map CR2_REGNO to the DWARF reg for CR. */
-#define DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) \
- ((FOR_EH) ? (REGNO) \
- : (REGNO) == CR2_REGNO ? 64 \
- : DBX_REGISTER_NUMBER (REGNO))
+ .debug_frame and .eh_frame. */
+#define DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) \
+ rs6000_dbx_register_number ((REGNO), (FOR_EH)? 2 : 1)
/* 1 for registers that have pervasive standard uses
and are not available for the register allocator.
/* This target uses the sysv4.opt file. */
#define TARGET_USES_SYSV4_OPT 1
-#undef DBX_REGISTER_NUMBER