From: Ulrich Weigand Date: Mon, 13 Oct 2014 17:47:20 +0000 (+0000) Subject: rs6000.h (DBX_REGISTER_NUMBER): Pass format argument to rs6000_dbx_register_number. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3d36d470d88228da1aef65bc90c4d7ff873a701f;p=gcc.git rs6000.h (DBX_REGISTER_NUMBER): Pass format argument to rs6000_dbx_register_number. * 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. From-SVN: r216157 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7dfd1b80bb0..61990be970c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,27 @@ +2014-10-13 Ulrich Weigand + + * 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 * config/i386/i386.c (ix86_address_cost): Lower cost for diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h index 5ab01848643..037ef577a33 100644 --- a/gcc/config/rs6000/aix.h +++ b/gcc/config/rs6000/aix.h @@ -223,3 +223,7 @@ /* 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 + diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 0329f3f621b..06bd853c4c6 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -424,3 +424,7 @@ do { \ /* 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 + diff --git a/gcc/config/rs6000/freebsd.h b/gcc/config/rs6000/freebsd.h index 9293dcabbe7..131b122846b 100644 --- a/gcc/config/rs6000/freebsd.h +++ b/gcc/config/rs6000/freebsd.h @@ -73,6 +73,7 @@ #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 diff --git a/gcc/config/rs6000/freebsd64.h b/gcc/config/rs6000/freebsd64.h index 1f3ef199e86..1a69aea9f86 100644 --- a/gcc/config/rs6000/freebsd64.h +++ b/gcc/config/rs6000/freebsd64.h @@ -362,7 +362,8 @@ extern int dot_symbols; /* 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 diff --git a/gcc/config/rs6000/lynx.h b/gcc/config/rs6000/lynx.h index 6377846cf88..f6652003dbb 100644 --- a/gcc/config/rs6000/lynx.h +++ b/gcc/config/rs6000/lynx.h @@ -99,7 +99,8 @@ #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 diff --git a/gcc/config/rs6000/netbsd.h b/gcc/config/rs6000/netbsd.h index a2be6df105d..7290375fe83 100644 --- a/gcc/config/rs6000/netbsd.h +++ b/gcc/config/rs6000/netbsd.h @@ -87,4 +87,6 @@ { "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 + diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 27f694b4abb..04ddfa9fd93 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -188,7 +188,7 @@ extern int rs6000_trampoline_size (void); 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 *); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index eb9f0c36d95..912fe3d5c87 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -31579,17 +31579,40 @@ rs6000_init_dwarf_reg_sizes_extra (tree address) } } -/* 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) @@ -31604,8 +31627,7 @@ rs6000_dbx_register_number (unsigned int 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; } diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 01699f73ae5..f343d7a4b4a 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -947,23 +947,16 @@ enum data_align { align_abi, align_opt, align_both }; ((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. diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 4344dcd8f18..64c5516e677 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -949,4 +949,3 @@ ncrtn.o%s" /* This target uses the sysv4.opt file. */ #define TARGET_USES_SYSV4_OPT 1 -#undef DBX_REGISTER_NUMBER