Commit 34c80057 by Alan Modra Committed by Alan Modra

sysv4.h (DWARF2_FRAME_REG_OUT): Define.

	* config/rs6000/sysv4.h (DWARF2_FRAME_REG_OUT): Define.
	* dwarf2out.c (output_cfi): Map regs using DWARF2_FRAME_REG_OUT.
	* doc/tm.texi (DWARF_FRAME_REGNUM, DWARF2_FRAME_REG_OUT): Document.

From-SVN: r76235
parent a4295210
2004-01-21 Alan Modra <amodra@bigpond.net.au>
* config/rs6000/sysv4.h (DWARF2_FRAME_REG_OUT): Define.
* dwarf2out.c (output_cfi): Map regs using DWARF2_FRAME_REG_OUT.
* doc/tm.texi (DWARF_FRAME_REGNUM, DWARF2_FRAME_REG_OUT): Document.
2004-01-20 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2004-01-20 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa-protos.h (compute_frame_size): Use HOST_WIDE_INT for frame sizes. * pa-protos.h (compute_frame_size): Use HOST_WIDE_INT for frame sizes.
......
...@@ -744,6 +744,18 @@ extern int fixuplabelno; ...@@ -744,6 +744,18 @@ extern int fixuplabelno;
#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO) #define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (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))
#define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
#define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
#define TARGET_SECTION_TYPE_FLAGS rs6000_elf_section_type_flags #define TARGET_SECTION_TYPE_FLAGS rs6000_elf_section_type_flags
......
...@@ -3289,6 +3289,26 @@ column number to use instead. ...@@ -3289,6 +3289,26 @@ column number to use instead.
See the PowerPC's SPE target for an example. See the PowerPC's SPE target for an example.
@end defmac @end defmac
@defmac DWARF_FRAME_REGNUM (@var{regno})
Define this macro if the target's representation for dwarf registers
used in .eh_frame or .debug_frame is different from that used in other
debug info sections. Given a gcc hard register number, this macro
should return the .eh_frame register number. The default is
@code{DBX_REGISTER_NUMBER (@var{regno})}.
@end defmac
@defmac DWARF2_FRAME_REG_OUT (@var{regno}, @var{for_eh})
Define this macro to map register numbers held in the call frame info
that gcc has collected using @code{DWARF_FRAME_REGNUM} to those that
should be output in .debug_frame (@code{@var{for_eh}} is zero) and
.eh_frame (@code{@var{for_eh}} is non-zero). The default is to
return @code{@var{regno}}.
@end defmac
@node Elimination @node Elimination
@subsection Eliminating Frame Pointer and Arg Pointer @subsection Eliminating Frame Pointer and Arg Pointer
......
...@@ -1790,11 +1790,19 @@ dw_cfi_oprnd2_desc (enum dwarf_call_frame_info cfi) ...@@ -1790,11 +1790,19 @@ dw_cfi_oprnd2_desc (enum dwarf_call_frame_info cfi)
#if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO) #if defined (DWARF2_DEBUGGING_INFO) || defined (DWARF2_UNWIND_INFO)
/* 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. */
#ifndef DWARF2_FRAME_REG_OUT
#define DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) (REGNO)
#endif
/* Output a Call Frame Information opcode and its operand(s). */ /* Output a Call Frame Information opcode and its operand(s). */
static void static void
output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh) output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh)
{ {
unsigned long r;
if (cfi->dw_cfi_opc == DW_CFA_advance_loc) if (cfi->dw_cfi_opc == DW_CFA_advance_loc)
dw2_asm_output_data (1, (cfi->dw_cfi_opc dw2_asm_output_data (1, (cfi->dw_cfi_opc
| (cfi->dw_cfi_oprnd1.dw_cfi_offset & 0x3f)), | (cfi->dw_cfi_oprnd1.dw_cfi_offset & 0x3f)),
...@@ -1802,17 +1810,17 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh) ...@@ -1802,17 +1810,17 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh)
cfi->dw_cfi_oprnd1.dw_cfi_offset); cfi->dw_cfi_oprnd1.dw_cfi_offset);
else if (cfi->dw_cfi_opc == DW_CFA_offset) else if (cfi->dw_cfi_opc == DW_CFA_offset)
{ {
dw2_asm_output_data (1, (cfi->dw_cfi_opc r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, for_eh);
| (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f)), dw2_asm_output_data (1, (cfi->dw_cfi_opc | (r & 0x3f)),
"DW_CFA_offset, column 0x%lx", "DW_CFA_offset, column 0x%lx", r);
cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset, NULL); dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset, NULL);
} }
else if (cfi->dw_cfi_opc == DW_CFA_restore) else if (cfi->dw_cfi_opc == DW_CFA_restore)
dw2_asm_output_data (1, (cfi->dw_cfi_opc {
| (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f)), r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, for_eh);
"DW_CFA_restore, column 0x%lx", dw2_asm_output_data (1, (cfi->dw_cfi_opc | (r & 0x3f)),
cfi->dw_cfi_oprnd1.dw_cfi_reg_num); "DW_CFA_restore, column 0x%lx", r);
}
else else
{ {
dw2_asm_output_data (1, cfi->dw_cfi_opc, dw2_asm_output_data (1, cfi->dw_cfi_opc,
...@@ -1857,15 +1865,15 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh) ...@@ -1857,15 +1865,15 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh)
case DW_CFA_offset_extended: case DW_CFA_offset_extended:
case DW_CFA_def_cfa: case DW_CFA_def_cfa:
dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, for_eh);
NULL); dw2_asm_output_data_uleb128 (r, NULL);
dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset, NULL); dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset, NULL);
break; break;
case DW_CFA_offset_extended_sf: case DW_CFA_offset_extended_sf:
case DW_CFA_def_cfa_sf: case DW_CFA_def_cfa_sf:
dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, for_eh);
NULL); dw2_asm_output_data_uleb128 (r, NULL);
dw2_asm_output_data_sleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset, NULL); dw2_asm_output_data_sleb128 (cfi->dw_cfi_oprnd2.dw_cfi_offset, NULL);
break; break;
...@@ -1873,15 +1881,15 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh) ...@@ -1873,15 +1881,15 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh)
case DW_CFA_undefined: case DW_CFA_undefined:
case DW_CFA_same_value: case DW_CFA_same_value:
case DW_CFA_def_cfa_register: case DW_CFA_def_cfa_register:
dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, for_eh);
NULL); dw2_asm_output_data_uleb128 (r, NULL);
break; break;
case DW_CFA_register: case DW_CFA_register:
dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, for_eh);
NULL); dw2_asm_output_data_uleb128 (r, NULL);
dw2_asm_output_data_uleb128 (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, for_eh);
NULL); dw2_asm_output_data_uleb128 (r, NULL);
break; break;
case DW_CFA_def_cfa_offset: case DW_CFA_def_cfa_offset:
...@@ -1911,7 +1919,7 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh) ...@@ -1911,7 +1919,7 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh)
} }
} }
/* Output the call frame information used to used to record information /* Output the call frame information used to record information
that relates to calculating the frame pointer, and records the that relates to calculating the frame pointer, and records the
location of saved registers. */ location of saved registers. */
......
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