diff mbox

Add target macro to override DWARF2 frame register size

Message ID 6D39441BF12EF246A7ABCE6654B0235320ECBF87@LEMAIL01.le.imgtec.org
State New
Headers show

Commit Message

Matthew Fortune Aug. 1, 2014, 1:31 p.m. UTC
This patch adds a target macro to allow a backend to override the size
of a dwarf frame register.  This is already supported to some extent
by allowing the HARD_REGNO_CALL_PART_CLOBBERED to reduce the size of
a specific register to only that which is saved.  However, for the
new MIPS O32 FP64 ABI extension I need more control.

The standard MIPS O32 ABI has 32-bit floating point-registers which
are saved as pairs to form 64-bit values.  The FP64 extension widens
all floating-point registers to 64-bit but only saves the even numbered
registers thus not increasing the callee-saved state.  In order to
support interlinking between the standard O32 ABI and the extension I
must keep the layout of the frame information the same.  The dwarf
frame registers are therefore re-interpreted to refer to the low and
high parts of even numbered 64-bit registers rather than 32 32-bit
registers.  To achieve this I must artificially reduce the size of the
frame registers for the widened 64-bit registers down to 32-bit but
cannot use the HARD_REGNO_CALL_PART_CLOBBERED macro to achieve this.

Thanks,
Matthew

gcc/
	* dwarf2cfi (DWARF_REG_MODE): Define with default implementation.
	(expand_builtin_init_dwarf_reg_sizes): Use DWARF_REG_MODE.
	* doc/tm.texi.in (DWARF_REG_MODE): Document.
	* doc/tm.texi: Regenerate.
---
 gcc/doc/tm.texi.in | 9 +++++++++
 gcc/dwarf2cfi.c    | 5 +++++
 2 files changed, 14 insertions(+)

Comments

Steven Bosscher Aug. 1, 2014, 3:04 p.m. UTC | #1
On Fri, Aug 1, 2014 at 3:31 PM, Matthew Fortune wrote:
> This patch adds a target macro

Please don't add target macros. Add a hook if you must, but we're
supposed to remove target macros, not add new ones :-)

Ciao!
Steven
diff mbox

Patch

diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index dd72b98..71799f7 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -2809,6 +2809,12 @@  in DWARF 2 debug information.  The default is zero.  A different value
 may reduce the size of debug information on some ports.
 @end defmac
 
+@defmac DWARF_REG_MODE (@var{N}, @var{mode})
+If defined, a C expression whose value is a mode that should be used
+to represent the @var{N}th DWARF frame register.  By default this is
+the same @var{mode} as the hard register it relates to.
+@end defmac
+
 @node Exception Handling
 @subsection Exception Handling Support
 @cindex exception handling
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 85cfb60..163db5d 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -252,6 +252,10 @@  init_return_column_size (enum machine_mode mode, rtx mem, unsigned int c)
 		  gen_int_mode (size, mode));
 }
 
+#ifndef DWARF_REG_MODE
+#define DWARF_REG_MODE(REGNO, MODE) (MODE)
+#endif
+
 /* Generate code to initialize the register size table.  */
 
 void
@@ -276,6 +280,7 @@  expand_builtin_init_dwarf_reg_sizes (tree address)
 
 	  if (HARD_REGNO_CALL_PART_CLOBBERED (i, save_mode))
 	    save_mode = choose_hard_reg_mode (i, 1, true);
+	  save_mode = DWARF_REG_MODE (i, save_mode);
 	  if (dnum == DWARF_FRAME_RETURN_COLUMN)
 	    {
 	      if (save_mode == VOIDmode)