From e677a9d463e8a39f5779e73f409f156afefb95dd Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 9 Jun 2015 17:53:24 +0000 Subject: [PATCH] gcc-plugin.h: Move decls to plugin.h and include it. * gcc-plugin.h: Move decls to plugin.h and include it. * plugin.h: Relocate decls from gcc-plugin.h * ggc-page.c: Include required header files. * passes.c: Likewise. * cgraphunit.c: Likewise. From-SVN: r224293 --- gcc/ChangeLog | 8 +++ gcc/cgraphunit.c | 3 ++ gcc/gcc-plugin.h | 135 +--------------------------------------------- gcc/ggc-page.c | 1 + gcc/passes.c | 3 ++ gcc/plugin.h | 136 ++++++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 151 insertions(+), 135 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 27b6cd219d1..09fc9311bd5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-06-09 Andrew MacLeod + + * gcc-plugin.h: Move decls to plugin.h and include it. + * plugin.h: Relocate decls from gcc-plugin.h + * ggc-page.c: Include required header files. + * passes.c: Likewise. + * cgraphunit.c: Likewise. + 2015-06-09 Tom de Vries * tree-stdarg.c (expand_ifn_va_arg_1): Handle location. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 81261613679..3aadf28dd31 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -176,6 +176,9 @@ along with GCC; see the file COPYING3. If not see #include "input.h" #include "function.h" #include "basic-block.h" +#include "dominance.h" +#include "cfgcleanup.h" +#include "cfg.h" #include "tree-ssa-alias.h" #include "internal-fn.h" #include "gimple-fold.h" diff --git a/gcc/gcc-plugin.h b/gcc/gcc-plugin.h index e6205eb08c6..bad508e0931 100644 --- a/gcc/gcc-plugin.h +++ b/gcc/gcc-plugin.h @@ -27,7 +27,6 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" -#include "highlev-plugin-common.h" #include "tm.h" #include "hard-reg-set.h" #include "input.h" @@ -49,138 +48,6 @@ along with GCC; see the file COPYING3. If not see #include "tree-core.h" #include "fold-const.h" #include "tree-check.h" - -/* Event names. */ -enum plugin_event -{ -# define DEFEVENT(NAME) NAME, -# include "plugin.def" -# undef DEFEVENT - PLUGIN_EVENT_FIRST_DYNAMIC -}; - -/* All globals declared here have C linkage to reduce link compatibility - issues with implementation language choice and mangling. */ -#ifdef __cplusplus -extern "C" { -#endif - -extern const char **plugin_event_name; - -struct plugin_argument -{ - char *key; /* key of the argument. */ - char *value; /* value is optional and can be NULL. */ -}; - -/* Additional information about the plugin. Used by --help and --version. */ - -struct plugin_info -{ - const char *version; - const char *help; -}; - -/* Represents the gcc version. Used to avoid using an incompatible plugin. */ - -struct plugin_gcc_version -{ - const char *basever; - const char *datestamp; - const char *devphase; - const char *revision; - const char *configuration_arguments; -}; - -/* Object that keeps track of the plugin name and its arguments. */ -struct plugin_name_args -{ - char *base_name; /* Short name of the plugin (filename without - .so suffix). */ - const char *full_name; /* Path to the plugin as specified with - -fplugin=. */ - int argc; /* Number of arguments specified with - -fplugin-arg-... */ - struct plugin_argument *argv; /* Array of ARGC key-value pairs. */ - const char *version; /* Version string provided by plugin. */ - const char *help; /* Help string provided by plugin. */ -}; - -/* The default version check. Compares every field in VERSION. */ - -extern bool plugin_default_version_check (struct plugin_gcc_version *, - struct plugin_gcc_version *); - -/* Function type for the plugin initialization routine. Each plugin module - should define this as an externally-visible function with name - "plugin_init." - - PLUGIN_INFO - plugin invocation information. - VERSION - the plugin_gcc_version symbol of GCC. - - Returns 0 if initialization finishes successfully. */ - -typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info, - struct plugin_gcc_version *version); - -/* Declaration for "plugin_init" function so that it doesn't need to be - duplicated in every plugin. */ -extern int plugin_init (struct plugin_name_args *plugin_info, - struct plugin_gcc_version *version); - -/* Function type for a plugin callback routine. - - GCC_DATA - event-specific data provided by GCC - USER_DATA - plugin-specific data provided by the plugin */ - -typedef void (*plugin_callback_func) (void *gcc_data, void *user_data); - -/* Called from the plugin's initialization code. Register a single callback. - This function can be called multiple times. - - PLUGIN_NAME - display name for this plugin - EVENT - which event the callback is for - CALLBACK - the callback to be called at the event - USER_DATA - plugin-provided data. -*/ - -/* Number of event ids / names registered so far. */ - -extern int get_event_last (void); - -int get_named_event_id (const char *name, enum insert_option insert); - -/* This is also called without a callback routine for the - PLUGIN_PASS_MANAGER_SETUP, PLUGIN_INFO and PLUGIN_REGISTER_GGC_ROOTS - pseudo-events, with a specific user_data. - */ - -extern void register_callback (const char *plugin_name, - int event, - plugin_callback_func callback, - void *user_data); - -extern int unregister_callback (const char *plugin_name, int event); - - -/* Retrieve the plugin directory name, as returned by the - -fprint-file-name=plugin argument to the gcc program, which is the - -iplugindir program argument to cc1. */ -extern const char* default_plugin_dir_name (void); - -#ifdef __cplusplus -} -#endif - -/* In case the C++ compiler does name mangling for globals, declare - plugin_is_GPL_compatible extern "C" so that a later definition - in a plugin file will have this linkage. */ -#ifdef __cplusplus -extern "C" { -#endif -extern int plugin_is_GPL_compatible; -#ifdef __cplusplus -} -#endif +#include "plugin.h" #endif /* GCC_PLUGIN_H */ diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 42098d89340..f5f09733833 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see #include "cgraph.h" #include "cfgloop.h" #include "plugin.h" +#include "predict.h" #include "basic-block.h" /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a diff --git a/gcc/passes.c b/gcc/passes.c index 339c5f0287f..d3ffe33540b 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -94,6 +94,9 @@ along with GCC; see the file COPYING3. If not see #include "tree-pretty-print.h" /* for dump_function_header */ #include "context.h" #include "pass_manager.h" +#include "dominance.h" +#include "cfg.h" +#include "cfgrtl.h" #include "tree-ssa-live.h" /* For remove_unused_locals. */ #include "tree-cfgcleanup.h" diff --git a/gcc/plugin.h b/gcc/plugin.h index 5ddca565903..d8a2a72a18c 100644 --- a/gcc/plugin.h +++ b/gcc/plugin.h @@ -20,7 +20,141 @@ along with GCC; see the file COPYING3. If not see #ifndef PLUGIN_H #define PLUGIN_H -#include "gcc-plugin.h" +#include "highlev-plugin-common.h" + +/* Event names. */ +enum plugin_event +{ +# define DEFEVENT(NAME) NAME, +# include "plugin.def" +# undef DEFEVENT + PLUGIN_EVENT_FIRST_DYNAMIC +}; + +/* All globals declared here have C linkage to reduce link compatibility + issues with implementation language choice and mangling. */ +#ifdef __cplusplus +extern "C" { +#endif + +extern const char **plugin_event_name; + +struct plugin_argument +{ + char *key; /* key of the argument. */ + char *value; /* value is optional and can be NULL. */ +}; + +/* Additional information about the plugin. Used by --help and --version. */ + +struct plugin_info +{ + const char *version; + const char *help; +}; + +/* Represents the gcc version. Used to avoid using an incompatible plugin. */ + +struct plugin_gcc_version +{ + const char *basever; + const char *datestamp; + const char *devphase; + const char *revision; + const char *configuration_arguments; +}; + +/* Object that keeps track of the plugin name and its arguments. */ +struct plugin_name_args +{ + char *base_name; /* Short name of the plugin (filename without + .so suffix). */ + const char *full_name; /* Path to the plugin as specified with + -fplugin=. */ + int argc; /* Number of arguments specified with + -fplugin-arg-... */ + struct plugin_argument *argv; /* Array of ARGC key-value pairs. */ + const char *version; /* Version string provided by plugin. */ + const char *help; /* Help string provided by plugin. */ +}; + +/* The default version check. Compares every field in VERSION. */ + +extern bool plugin_default_version_check (struct plugin_gcc_version *, + struct plugin_gcc_version *); + +/* Function type for the plugin initialization routine. Each plugin module + should define this as an externally-visible function with name + "plugin_init." + + PLUGIN_INFO - plugin invocation information. + VERSION - the plugin_gcc_version symbol of GCC. + + Returns 0 if initialization finishes successfully. */ + +typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version); + +/* Declaration for "plugin_init" function so that it doesn't need to be + duplicated in every plugin. */ +extern int plugin_init (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version); + +/* Function type for a plugin callback routine. + + GCC_DATA - event-specific data provided by GCC + USER_DATA - plugin-specific data provided by the plugin */ + +typedef void (*plugin_callback_func) (void *gcc_data, void *user_data); + +/* Called from the plugin's initialization code. Register a single callback. + This function can be called multiple times. + + PLUGIN_NAME - display name for this plugin + EVENT - which event the callback is for + CALLBACK - the callback to be called at the event + USER_DATA - plugin-provided data. +*/ + +/* Number of event ids / names registered so far. */ + +extern int get_event_last (void); + +int get_named_event_id (const char *name, enum insert_option insert); + +/* This is also called without a callback routine for the + PLUGIN_PASS_MANAGER_SETUP, PLUGIN_INFO and PLUGIN_REGISTER_GGC_ROOTS + pseudo-events, with a specific user_data. + */ + +extern void register_callback (const char *plugin_name, + int event, + plugin_callback_func callback, + void *user_data); + +extern int unregister_callback (const char *plugin_name, int event); + + +/* Retrieve the plugin directory name, as returned by the + -fprint-file-name=plugin argument to the gcc program, which is the + -iplugindir program argument to cc1. */ +extern const char* default_plugin_dir_name (void); + +#ifdef __cplusplus +} +#endif + +/* In case the C++ compiler does name mangling for globals, declare + plugin_is_GPL_compatible extern "C" so that a later definition + in a plugin file will have this linkage. */ +#ifdef __cplusplus +extern "C" { +#endif +extern int plugin_is_GPL_compatible; +#ifdef __cplusplus +} +#endif + struct attribute_spec; struct scoped_attributes; -- 2.30.2