From e9e7f1810975cff7ce1fe93b1179c8dad7665f17 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 29 Sep 1999 19:00:46 +0000 Subject: [PATCH] dump.c (dequeue_and_dump): Improve support for dumping THUNK_DECLs. * dump.c (dequeue_and_dump): Improve support for dumping THUNK_DECLs. * ir.texi: Document THUNK_DECLs. From-SVN: r29709 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/dump.c | 33 +++++++++++++++++++++------------ gcc/cp/ir.texi | 20 +++++++++++++++++++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 56d78d4..7a70093 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 1999-09-29 Mark Mitchell + * 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. diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index 64d1d21..845a467 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -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: diff --git a/gcc/cp/ir.texi b/gcc/cp/ir.texi index 4e5396e..a198fc9 100644 --- a/gcc/cp/ir.texi +++ b/gcc/cp/ir.texi @@ -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. -- 2.7.4