This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
dwarf2out POST_insns patch
- From: Andrew Macleod <amacleod at cygnus dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 27 Feb 2002 16:57:37 -0800
- Subject: dwarf2out POST_insns patch
The stormy16 port doesn't have any PRE_INC, PRE_DEC or PRE_MODIFY insns,
it only has the POST_ variations. When generating dwarf2 frame
information, we miss generating the DW_CFA_GNU_args_size opcode whenever
there is a stack push or pop for parameters. (and also a DW_CFA_def_cfa_offset
if the CFA is being tracked with SP.)
This patch modifies stack_adjust_offset to recognize either PRE_ or POST_
insns. Since this routine is only called on non-frame related instruction,
we aren't worried about where or what we are saving, only what the
stack adjustment is during the instruction. That lets us treat
PRE_ and POST_ the same within this function.
This has been built and bootstrapped on x86 (for what thats worth) and verified
to fix the problem on a stormy16 port.
Is this OK to check into mainline?
Andrew
* dwarf2out.c (stack_adjust_offset): Add support for POST_INC, POST_DEC,
and POST_MODIFY.
Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/dwarf2out.c,v
retrieving revision 1.170
diff -c -p -r1.170 dwarf2out.c
*** gcc/dwarf2out.c 2001/10/22 08:35:00 1.170
--- gcc/dwarf2out.c 2002/02/25 17:41:08
*************** stack_adjust_offset (pattern)
*** 900,933 ****
return 0;
offset = INTVAL (XEXP (src, 1));
}
else if (GET_CODE (dest) == MEM)
{
/* (set (mem (pre_dec (reg sp))) (foo)) */
src = XEXP (dest, 0);
code = GET_CODE (src);
! if (! (code == PRE_DEC || code == PRE_INC
! || code == PRE_MODIFY)
! || XEXP (src, 0) != stack_pointer_rtx)
! return 0;
! if (code == PRE_MODIFY)
! {
! rtx val = XEXP (XEXP (src, 1), 1);
! /* We handle only adjustments by constant amount. */
! if (GET_CODE (XEXP (src, 1)) != PLUS ||
! GET_CODE (val) != CONST_INT)
! abort();
! offset = -INTVAL (val);
}
- else offset = GET_MODE_SIZE (GET_MODE (dest));
}
else
return 0;
-
- if (code == PLUS || code == PRE_INC)
- offset = -offset;
return offset;
}
--- 900,953 ----
return 0;
offset = INTVAL (XEXP (src, 1));
+ if (code == PLUS)
+ offset = -offset;
}
else if (GET_CODE (dest) == MEM)
{
/* (set (mem (pre_dec (reg sp))) (foo)) */
src = XEXP (dest, 0);
code = GET_CODE (src);
+ switch (code)
+ {
+ case PRE_MODIFY:
+ case POST_MODIFY:
+ if (XEXP (src, 0) == stack_pointer_rtx)
+ {
+ rtx val = XEXP (XEXP (src, 1), 1);
+ /* We handle only adjustments by constant amount. */
+ if (GET_CODE (XEXP (src, 1)) != PLUS ||
+ GET_CODE (val) != CONST_INT)
+ abort();
+ offset = -INTVAL (val);
+ break;
+ }
+ return 0;
! case PRE_DEC:
! case POST_DEC:
! if (XEXP (src, 0) == stack_pointer_rtx)
! {
! offset = GET_MODE_SIZE (GET_MODE (dest));
! break;
! }
! return 0;
! case PRE_INC:
! case POST_INC:
! if (XEXP (src, 0) == stack_pointer_rtx)
! {
! offset = -GET_MODE_SIZE (GET_MODE (dest));
! break;
! }
! return 0;
!
! default:
! return 0;
}
}
else
return 0;
return offset;
}