OSDN Git Service

* dump.c (dequeue_and_dump): Improve support for dumping THUNK_DECLs.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Sep 1999 19:00:46 +0000 (19:00 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Sep 1999 19:00:46 +0000 (19:00 +0000)
* ir.texi: Document THUNK_DECLs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29709 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/dump.c
gcc/cp/ir.texi

index 56d78d4..7a70093 100644 (file)
@@ -1,5 +1,8 @@
 1999-09-29  Mark Mitchell  <mark@codesourcery.com>
 
+       * dump.c (dequeue_and_dump): Improve support for dumping THUNK_DECLs.
+       * ir.texi: Document THUNK_DECLs.
+
        * cp-tree.h (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Move here from pt.c.
        (TMPL_ARGS_DEPTH, TMPL_ARGS_LEVEL, SET_TMPL_ARGS_LEVEL): Likewise.
        (TMPL_ARG, SET_TMPL_ARG, NUM_TMPL_ARGS, TMPL_PARMS_DEPTH): Likewise.
index 64d1d21..845a467 100644 (file)
@@ -600,6 +600,7 @@ dequeue_and_dump (di)
       break;
 
     case FUNCTION_DECL:
+    case THUNK_DECL:
       if (dump_children_p)
        {
          queue_and_dump_index (di, "scpe", DECL_REAL_CONTEXT (t), 0);
@@ -610,18 +611,26 @@ dequeue_and_dump (di)
        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));
+      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 4e5396e..a198fc9 100644 (file)
@@ -733,6 +733,8 @@ FIXME: Talk about @code{TYPE_NONCOPIED_PARTS}.
 @tindex NAMESPACE_DECL
 @tindex RESULT_DECL
 @tindex TEMPLATE_DECL
+@tindex THUNK_DECL
+@findex THUNK_DELTA
 @tindex USING_DECL
 @findex DECL_INITIAL
 @findex DECL_SIZE
@@ -855,6 +857,21 @@ can safely ignore @code{TEMPLATE_DECL}s, but should examine
 @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.
@@ -870,7 +887,8 @@ Back-ends can safely ignore these nodes.
 @cindex function
 @tindex FUNCTION_DECL
 @tindex OVERLOAD
-@findex OVL_
+@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.