diff mbox

[PTX] Fix CFA breakage

Message ID 565A3837.8090002@acm.org
State New
Headers show

Commit Message

Nathan Sidwell Nov. 28, 2015, 11:26 p.m. UTC
The recent patch to tree-nested.c:
2015-11-26  Pierre-Marie de Rodat  <derodat@adacore.com>

	PR debug/53927
	* tree-nested.c (finalize_nesting_tree_1): Append a field to
	hold the frame base address.
	* dwarf2out.c (gen_subprogram_die): Generate for
	DW_AT_static_link a location description that computes the value
	of this field.

broke PTX, as it tried to use argp for the CFA.  Fixed thusly.  Also tidied up a 
few bits of nvptx.h while I was there.

nathan

Comments

Eric Botcazou Nov. 29, 2015, 9:03 a.m. UTC | #1
> The recent patch to tree-nested.c:
> 2015-11-26  Pierre-Marie de Rodat  <derodat@adacore.com>
> 
> 	PR debug/53927
> 	* tree-nested.c (finalize_nesting_tree_1): Append a field to
> 	hold the frame base address.
> 	* dwarf2out.c (gen_subprogram_die): Generate for
> 	DW_AT_static_link a location description that computes the value
> 	of this field.
> 
> broke PTX, as it tried to use argp for the CFA.

That's a misleading description, the patch makes use of BUILT_IN_DWARF_CFA, 
which is the canonical way of retrieving the CFA.  I'm not sure how it can
break a port whose handling of the CFA was not already (partially) broken.
IOW did __builtin_dwarf_cfa () really work for PTX before your patch?
Nathan Sidwell Nov. 29, 2015, 2:20 p.m. UTC | #2
On 11/29/15 04:03, Eric Botcazou wrote:
>> The recent patch to tree-nested.c:
>> 2015-11-26  Pierre-Marie de Rodat  <derodat@adacore.com>
>>
>> 	PR debug/53927
>> 	* tree-nested.c (finalize_nesting_tree_1): Append a field to
>> 	hold the frame base address.
>> 	* dwarf2out.c (gen_subprogram_die): Generate for
>> 	DW_AT_static_link a location description that computes the value
>> 	of this field.
>>
>> broke PTX, as it tried to use argp for the CFA.
>
> That's a misleading description,

You're correct.  'Exposed an existing defect ..' would have been better, but the 
practical upshot was that tests started failing.
diff mbox

Patch

2015-11-28  Nathan Sidwell  <nathan@acm.org>

	* config/nvptx/nvptx.h (FIRST_PARM_OFFSET): Add void cast.
	(FRAME_POINTER_CFA_OFFSET): Define.
	(struct nvptx_args): Use 'tree' type.
	(INIT_CUMULATIVE_ARGS): Remove unnecessary do...while.

Index: gcc/config/nvptx/nvptx.h
===================================================================
--- gcc/config/nvptx/nvptx.h	(revision 231037)
+++ gcc/config/nvptx/nvptx.h	(working copy)
@@ -166,14 +166,16 @@  enum reg_class
 #define OUTGOING_ARG_POINTER_REGNUM 11
 #define OUTGOING_STATIC_CHAIN_REGNUM 10
 
-#define FIRST_PARM_OFFSET(FNDECL) 0
+#define FIRST_PARM_OFFSET(FNDECL) ((void)(FNDECL), 0)
 #define PUSH_ARGS_REVERSED 1
-
 #define ACCUMULATE_OUTGOING_ARGS 1
 
+/* Avoid using the argument pointer for frame-related things.  */
+#define FRAME_POINTER_CFA_OFFSET(FNDECL) ((void)(FNDECL), 0)
+
 #ifdef HOST_WIDE_INT
 struct nvptx_args {
-  union tree_node *fntype;
+  tree fntype;
   /* Number of arguments passed in registers so far.  */
   int count;
   /* Offset into the stdarg area so far.  */
@@ -184,7 +186,7 @@  struct nvptx_args {
 #define CUMULATIVE_ARGS struct nvptx_args
 
 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
-  do { (CUM).fntype = (FNTYPE); (CUM).count = 0; (CUM).off = 0; } while (0)
+  ((CUM).fntype = (FNTYPE), (CUM).count = 0, (CUM).off = 0, (void)0)
 
 #define FUNCTION_ARG_REGNO_P(r) 0