summaryrefslogtreecommitdiff
path: root/gcc/plugin.c
diff options
context:
space:
mode:
authorBasile Starynkevitch <basile@starynkevitch.net>2009-05-26 17:33:33 +0000
committerBasile Starynkevitch <bstarynk@gcc.gnu.org>2009-05-26 17:33:33 +0000
commitae2392a94bb89e198642d304d2f04ca67142c006 (patch)
tree878cbdf019958acd271cdf6e396a37afeaf98aa4 /gcc/plugin.c
parent06d9ea4246bae199a43808c323c4ac1e62ff8b07 (diff)
downloadgcc-ae2392a94bb89e198642d304d2f04ca67142c006.tar.gz
plugins.texi (Loading plugins): typo.
2009-05-26 Basile Starynkevitch <basile@starynkevitch.net> * gcc/doc/plugins.texi (Loading plugins): typo. (Plugin callbacks): Documented PLUGIN_INFO, PLUGIN_GGC_START, PLUGIN_GGC_MARKING, PLUGIN_GGC_END, PLUGIN_REGISTER_GGC_ROOTS. (Interacting with the GCC Garbage Collector): Added new section. (Giving information about a plugin): Added new section for PLUGIN_INFO. * gcc/testsuite/gcc.dg/plugin/plugin.exp: Added ggcplug.c test plugin with ggcplug-test-1.c for testing PLUGIN_GGC_MARKING etc... * gcc/testsuite/gcc.dg/plugin/ggcplug-test-1.c: Added new file. * gcc/testsuite/gcc.dg/plugin/ggcplug.c: Added new file. * gcc/ggc.h (ggc_register_root_tab): Added declaration. * gcc/gcc-plugin.h (PLUGIN_GGC_START, PLUGIN_GGC_MARKING) (PLUGIN_GGC_END, PLUGIN_REGISTER_GGC_ROOTS): Added new events. (register_callback): Improved comment in declaration. * gcc/ggc-common.c (const_ggc_root_tab_t) Added new typedef for vectors. (extra_root_vec) Added static variable for dynamic roots registration. (ggc_register_root_tab) Added new routine. (ggc_mark_roots) Added iteration inside extra_root_vec, and invoke PLUGIN_GGC_MARKING event. * gcc/ggc-zone.c: Include plugin.h. (ggc_collect): Invoke PLUGIN_GGC_START & PLUGIN_GGC_END events. * gcc/ggc-page.c: Include plugin.h. (ggc_collect): Invoke PLUGIN_GGC_START & PLUGIN_GGC_END events. * gcc/plugin.c (plugin_event_name): added names of PLUGIN_GGC_START, PLUGIN_GGC_MARKING, PLUGIN_GGC_END, PLUGIN_REGISTER_GGC_ROOTS (register_callback): check lack of callbacks for pseudo-events. Added handling of PLUGIN_REGISTER_GGC_ROOTS, PLUGIN_GGC_START, PLUGIN_GGC_MARKING, PLUGIN_GGC_END. (invoke_plugin_callbacks): Handle PLUGIN_GGC_START, PLUGIN_GGC_MARKING, PLUGIN_GGC_END, PLUGIN_REGISTER_GGC_ROOTS. * gcc/Makefile.in (ggc-common.o, ggc-zone.o, ggc-page.o): Added dependency on plugin.h. (plugin.o): Added dependency on ggc.h... From-SVN: r147878
Diffstat (limited to 'gcc/plugin.c')
-rw-r--r--gcc/plugin.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/plugin.c b/gcc/plugin.c
index 6cee526cf76..0b5515e4907 100644
--- a/gcc/plugin.c
+++ b/gcc/plugin.c
@@ -38,6 +38,8 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "plugin.h"
#include "timevar.h"
+#include "ggc.h"
+
#ifdef ENABLE_PLUGIN
#include "plugin-version.h"
#endif
@@ -51,6 +53,10 @@ const char *plugin_event_name[] =
"PLUGIN_CXX_CP_PRE_GENERICIZE",
"PLUGIN_FINISH",
"PLUGIN_INFO",
+ "PLUGIN_GGC_START",
+ "PLUGIN_GGC_MARKING",
+ "PLUGIN_GGC_END",
+ "PLUGIN_REGISTER_GGC_ROOTS",
"PLUGIN_EVENT_LAST"
};
@@ -472,14 +478,23 @@ register_callback (const char *plugin_name,
switch (event)
{
case PLUGIN_PASS_MANAGER_SETUP:
+ gcc_assert (!callback);
register_pass (plugin_name, (struct plugin_pass *) user_data);
break;
case PLUGIN_INFO:
+ gcc_assert (!callback);
register_plugin_info (plugin_name, (struct plugin_info *) user_data);
break;
+ case PLUGIN_REGISTER_GGC_ROOTS:
+ gcc_assert (!callback);
+ ggc_register_root_tab ((const struct ggc_root_tab*) user_data);
+ break;
case PLUGIN_FINISH_TYPE:
case PLUGIN_FINISH_UNIT:
case PLUGIN_CXX_CP_PRE_GENERICIZE:
+ case PLUGIN_GGC_START:
+ case PLUGIN_GGC_MARKING:
+ case PLUGIN_GGC_END:
case PLUGIN_ATTRIBUTES:
case PLUGIN_FINISH:
{
@@ -524,6 +539,9 @@ invoke_plugin_callbacks (enum plugin_event event, void *gcc_data)
case PLUGIN_CXX_CP_PRE_GENERICIZE:
case PLUGIN_ATTRIBUTES:
case PLUGIN_FINISH:
+ case PLUGIN_GGC_START:
+ case PLUGIN_GGC_MARKING:
+ case PLUGIN_GGC_END:
{
/* Iterate over every callback registered with this event and
call it. */
@@ -535,6 +553,7 @@ invoke_plugin_callbacks (enum plugin_event event, void *gcc_data)
case PLUGIN_PASS_MANAGER_SETUP:
case PLUGIN_EVENT_LAST:
+ case PLUGIN_REGISTER_GGC_ROOTS:
default:
gcc_assert (false);
}