This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: plugin event for C frontend trees
On Fri, Dec 18, 2009 at 3:06 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> IMHO this should be a language independent hook. ?Thus please
> change it to PLUGIN_PRE_GENERICIZE and adjust the c++ frontend
> to use that as well.
>
> Richard.
Hi, here is a new patch as you requested.
Brian
gcc/ChangeLog
2009-12-18 Brian Hackett <bhackett1024@gmail.com>
* plugin.def: Rename pre-genericize event.
* plugin.c (register_callback, invoke_plugin_callbacks): Same.
* c-decl.c (finish_function): Invoke callbacks on above event.
gcc/cp/ChangeLog
2009-12-18 Brian Hackett <bhackett1024@gmail.com>
* decl.c (finish_function): Rename pre-genericize event.
Index: gcc/plugin.def
===================================================================
--- gcc/plugin.def (revision 155348)
+++ gcc/plugin.def (working copy)
@@ -27,8 +27,8 @@ DEFEVENT (PLUGIN_FINISH_TYPE)
/* Useful for summary processing. */
DEFEVENT (PLUGIN_FINISH_UNIT)
-/* Allows to see low level AST in C++ FE. */
-DEFEVENT (PLUGIN_CXX_CP_PRE_GENERICIZE)
+/* Allows to see low level AST in C and C++ frontends. */
+DEFEVENT (PLUGIN_PRE_GENERICIZE)
/* Called before GCC exits. */
DEFEVENT (PLUGIN_FINISH)
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c (revision 155348)
+++ gcc/cp/decl.c (working copy)
@@ -12560,7 +12560,7 @@ finish_function (int flags)
if (!processing_template_decl)
{
struct language_function *f = DECL_SAVED_FUNCTION_DATA (fndecl);
- invoke_plugin_callbacks (PLUGIN_CXX_CP_PRE_GENERICIZE, fndecl);
+ invoke_plugin_callbacks (PLUGIN_PRE_GENERICIZE, fndecl);
cp_genericize (fndecl);
/* Clear out the bits we don't need. */
f->x_current_class_ptr = NULL;
Index: gcc/c-decl.c
===================================================================
--- gcc/c-decl.c (revision 155348)
+++ gcc/c-decl.c (working copy)
@@ -8052,6 +8052,7 @@ finish_function (void)
{
if (!decl_function_context (fndecl))
{
+ invoke_plugin_callbacks (PLUGIN_PRE_GENERICIZE, fndecl);
c_genericize (fndecl);
/* ??? Objc emits functions after finalizing the compilation unit.
Index: gcc/plugin.c
===================================================================
--- gcc/plugin.c (revision 155348)
+++ gcc/plugin.c (working copy)
@@ -402,7 +402,7 @@ register_callback (const char *plugin_na
case PLUGIN_FINISH_TYPE:
case PLUGIN_START_UNIT:
case PLUGIN_FINISH_UNIT:
- case PLUGIN_CXX_CP_PRE_GENERICIZE:
+ case PLUGIN_PRE_GENERICIZE:
case PLUGIN_GGC_START:
case PLUGIN_GGC_MARKING:
case PLUGIN_GGC_END:
@@ -483,7 +483,7 @@ invoke_plugin_callbacks (int event, void
case PLUGIN_FINISH_TYPE:
case PLUGIN_START_UNIT:
case PLUGIN_FINISH_UNIT:
- case PLUGIN_CXX_CP_PRE_GENERICIZE:
+ case PLUGIN_PRE_GENERICIZE:
case PLUGIN_ATTRIBUTES:
case PLUGIN_PRAGMAS:
case PLUGIN_FINISH: