plugin event for C frontend trees
Brian Hackett
bhackett1024@gmail.com
Fri Dec 18 23:37:00 GMT 2009
Hi, this adds a plugin event PLUGIN_C_PRE_GENERICIZE for accessing the
C frontend trees, analogous to the existing
PLUGIN_CXX_CP_PRE_GENERICIZE for the C++ frontend trees. There didn't
seem to be any way previously to access the C trees from a plugin. (I
don't have a copyright assignment with the FSF, is that necessary for
this patch?). Thanks,
Brian Hackett
2009-12-18 Brian Hackett <bhackett1024@gmail.com>
* plugin.def: Add plugin event for C frontend pre-genericize.
* plugin.c (register_callback, invoke_plugin_callbacks): Same.
* c-decl.c (finish_function): Invoke callbacks on above event.
Index: gcc/plugin.def
===================================================================
--- gcc/plugin.def (revision 155348)
+++ gcc/plugin.def (working copy)
@@ -30,6 +30,9 @@ 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 FE. */
+DEFEVENT (PLUGIN_C_PRE_GENERICIZE)
+
/* Called before GCC exits. */
DEFEVENT (PLUGIN_FINISH)
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_C_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)
@@ -403,6 +403,7 @@ register_callback (const char *plugin_na
case PLUGIN_START_UNIT:
case PLUGIN_FINISH_UNIT:
case PLUGIN_CXX_CP_PRE_GENERICIZE:
+ case PLUGIN_C_PRE_GENERICIZE:
case PLUGIN_GGC_START:
case PLUGIN_GGC_MARKING:
case PLUGIN_GGC_END:
@@ -484,6 +485,7 @@ invoke_plugin_callbacks (int event, void
case PLUGIN_START_UNIT:
case PLUGIN_FINISH_UNIT:
case PLUGIN_CXX_CP_PRE_GENERICIZE:
+ case PLUGIN_C_PRE_GENERICIZE:
case PLUGIN_ATTRIBUTES:
case PLUGIN_PRAGMAS:
case PLUGIN_FINISH:
More information about the Gcc-patches
mailing list