PATCH: Revise dwarf2out.c's Comments

Jeffrey Oldham oldham@codesourcery.com
Mon Feb 5 21:00:00 GMT 2001


Jason Merrill, Mark Mitchell, and I discussed recent comments added to
dwarf2out.c to assist users of dwarf2out_frame_debug_expr.  We revised
them.

Thanks for Jason's and Mark's improvements.  I am responsible for all
mistakes.

2001-02-05  Jeffrey Oldham  <oldham@codesourcery.com>

        * dwarf2out.c: Revise DWARF2 Abbreviation Glossary comments.
        (dwarf2out_frame_debug_expr): Revise introductory comments to add
        a high-level description.

Tested on       i686-pc-linux-gnu by compiling dwarf2out.c
                No source code was changed so no bootstrap or
                regression test performed.
Approved by     Mark Mitchell (mark@codesourcery.com)

Thanks,
Jeffrey D. Oldham
oldham@codesourcery.com
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.239
diff -c -p -r1.239 dwarf2out.c
*** dwarf2out.c	2001/02/04 22:43:58	1.239
--- dwarf2out.c	2001/02/06 03:48:46
*************** Boston, MA 02111-1307, USA.  */
*** 57,68 ****
  
  /* DWARF2 Abbreviation Glossary:
     CFA = Canonical Frame Address
! 	   stack address identifying a stack call frame; its value is
! 	   the value of the stack pointer just before the call to the
! 	   current function
!    CFI = Canonical Frame Instruction
!            information describing entries in a stack call frame, e.g.,
! 	   CIE and FDE
     CIE = Common Information Entry
  	   information describing information common to one or more FDEs
     DIE = Debugging Information Entry
--- 57,68 ----
  
  /* DWARF2 Abbreviation Glossary:
     CFA = Canonical Frame Address
! 	   an abstract idea representing a fixed stack address
! 	   identifying a stack call frame.  The CFA register and
! 	   offset, whose value may change, keeps track of its value at
! 	   runtime.
!    CFI = Call Frame Instruction
! 	   an instruction for the DWARF2 abstract machine
     CIE = Common Information Entry
  	   information describing information common to one or more FDEs
     DIE = Debugging Information Entry
*************** dw_cfa_location cfa_temp;
*** 1283,1292 ****
     cfa, cfa_store, and cfa_temp.reg.  We describe these rules so
     users need not read the source code.
  
    Invariants / Summaries of Rules
  
!   cfa	       current register used to calculate the DWARF2 canonical
! 	       frame address register and offset
    cfa_store    register used by prologue code to save things to the stack
  	       cfa_store.offset is the offset from the value of
  	       cfa_store.reg to the actual CFA
--- 1283,1316 ----
     cfa, cfa_store, and cfa_temp.reg.  We describe these rules so
     users need not read the source code.
  
+   The High-Level Picture
+ 
+   Changes in the register we use to calculate the CFA: Currently we
+   assume that if you copy the CFA register into another register, we
+   should take the other one as the new CFA register; this seems to
+   work pretty well.  If it's wrong for some target, it's simple
+   enough not to set RTX_FRAME_RELATED_P on the insn in question.
+ 
+   Changes in the register we use for saving registers to the stack:
+   This is usually SP, but not always.  Again, we deduce that if you
+   copy SP into another register (and SP is not the CFA register),
+   then the new register is the one we will be using for register
+   saves.  This also seems to work.
+ 
+   Register saves: There's not much guesswork about this one; if
+   RTX_FRAME_RELATED_P is set on an insn which modifies memory, it's a
+   register save, and the register used to calculate the destination
+   had better be the one we think we're using for this purpose.
+ 
+   Except: If the register being saved is the CFA register, and the
+   offset is non-zero, we are saving the CFA, so we assume we have to
+   use DW_CFA_def_cfa_expression.  If the offset is 0, we assume that
+   the intent is to save the value of SP from the previous frame.
+ 
    Invariants / Summaries of Rules
  
!   cfa	       current rule for calculating the CFA.  It usually
! 	       consists of a register and an offset.
    cfa_store    register used by prologue code to save things to the stack
  	       cfa_store.offset is the offset from the value of
  	       cfa_store.reg to the actual CFA
*************** dw_cfa_location cfa_temp;
*** 1307,1315 ****
    Rule 5:      Create a new register cfa_store used to save items to the
  	       stack.
  
!   Rules 10-13: Save a register to the stack.  Record the location in
! 	       cfa_store.offset.  Define offset as the difference of
! 	       the original location and cfa_store's location.
  
    The Rules
  
--- 1331,1339 ----
    Rule 5:      Create a new register cfa_store used to save items to the
  	       stack.
  
!   Rules 10-13: Save a register to the stack.  Define offset as the
! 	       difference of the original location and cfa_store's
! 	       location.
  
    The Rules
  


More information about the Gcc-patches mailing list