This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ PATCH for THUNK_DECL dumping/docs



This patch adds dumping and documentation support for THUNK_DECLs.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-09-29  Mark Mitchell  <mark@codesourcery.com>

	* dump.c (dequeue_and_dump): Improve support for dumping THUNK_DECLs.
	* ir.texi: Document THUNK_DECLs.

Index: dump.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/dump.c,v
retrieving revision 1.14
diff -c -p -r1.14 dump.c
*** dump.c	1999/09/25 18:16:08	1.14
--- dump.c	1999/09/29 18:59:45
*************** dequeue_and_dump (di)
*** 600,605 ****
--- 600,606 ----
        break;
  
      case FUNCTION_DECL:
+     case THUNK_DECL:
        if (dump_children_p)
  	{
  	  queue_and_dump_index (di, "scpe", DECL_REAL_CONTEXT (t), 0);
*************** dequeue_and_dump (di)
*** 610,627 ****
  	dump_string(di, "extern");
        else
  	dump_string (di, "static");
!       if (DECL_FUNCTION_MEMBER_P (t))
! 	dump_string (di, "member");
!       if (DECL_CONSTRUCTOR_P (t))
! 	dump_string (di, "constructor");
!       if (DECL_DESTRUCTOR_P (t))
! 	dump_string (di, "destructor");
!       if (DECL_OVERLOADED_OPERATOR_P (t))
! 	dump_string (di, "operator");
!       if (DECL_CONV_FN_P (t))
! 	dump_string (di, "conversion");
!       if (dump_children_p)
! 	dump_child ("body", DECL_SAVED_TREE (t));
        break;
  
      case NAMESPACE_DECL:
--- 611,636 ----
  	dump_string(di, "extern");
        else
  	dump_string (di, "static");
!       if (TREE_CODE (t) == FUNCTION_DECL)
! 	{
! 	  if (DECL_FUNCTION_MEMBER_P (t))
! 	    dump_string (di, "member");
! 	  if (DECL_CONSTRUCTOR_P (t))
! 	    dump_string (di, "constructor");
! 	  if (DECL_DESTRUCTOR_P (t))
! 	    dump_string (di, "destructor");
! 	  if (DECL_OVERLOADED_OPERATOR_P (t))
! 	    dump_string (di, "operator");
! 	  if (DECL_CONV_FN_P (t))
! 	    dump_string (di, "conversion");
! 	  if (dump_children_p)
! 	    dump_child ("body", DECL_SAVED_TREE (t));
! 	}
!       else
! 	{
! 	  dump_int (di, "dlta", THUNK_DELTA (t));
! 	  dump_child ("init", DECL_INITIAL (t));
! 	}
        break;
  
      case NAMESPACE_DECL:
Index: ir.texi
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/ir.texi,v
retrieving revision 1.9
diff -c -p -r1.9 ir.texi
*** ir.texi	1999/09/28 07:40:15	1.9
--- ir.texi	1999/09/29 18:59:48
*************** FIXME: Talk about @code{TYPE_NONCOPIED_P
*** 733,738 ****
--- 733,740 ----
  @tindex NAMESPACE_DECL
  @tindex RESULT_DECL
  @tindex TEMPLATE_DECL
+ @tindex THUNK_DECL
+ @findex THUNK_DELTA
  @tindex USING_DECL
  @findex DECL_INITIAL
  @findex DECL_SIZE
*************** can safely ignore @code{TEMPLATE_DECL}s,
*** 855,860 ****
--- 857,877 ----
  @code{FUNCTION_DECL} nodes on the specializations list just as they
  would ordinary @code{FUNCTION_DECL} nodes.
  
+ @item THUNK_DECL
+ 
+ These nodes represent stub code that adjusts the @code{this} pointer and
+ then jumps to another function.  When the jumped-to function returns,
+ control is transferred directly to the caller, without returning to the
+ thunk.  The first parameter to the thunk is always the @code{this}
+ pointer; the thunk should add @code{THUNK_DELTA} to this value.  (The
+ @code{THUNK_DECL} is an @code{int}, not an @code{INTEGER_CST}.)  Then,
+ the thunk should jump to the location given by @code{DECL_INITIAL}; this
+ will always be an expression for the address of a function.  
+ 
+ You can use @code{DECL_ASSEMBLER_NAME}, @code{TREE_PUBLIC}, and
+ @code{DECL_ARGUMENTS} with a @code{THUNK_DECL}, just as with a
+ @code{FUNCTION_DECL}.
+ 
  @item USING_DECL
  
  Back-ends can safely ignore these nodes.
*************** Back-ends can safely ignore these nodes.
*** 870,876 ****
  @cindex function
  @tindex FUNCTION_DECL
  @tindex OVERLOAD
! @findex OVL_
  
  A function is represented by a @code{FUNCTION_DECL} node.  A set of
  overloaded functions is sometimes represented by a @code{OVERLOAD} node.
--- 887,894 ----
  @cindex function
  @tindex FUNCTION_DECL
  @tindex OVERLOAD
! @findex OVL_CURRENT
! @findex OVL_NEXT
  
  A function is represented by a @code{FUNCTION_DECL} node.  A set of
  overloaded functions is sometimes represented by a @code{OVERLOAD} node.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]