This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Dump final -most gimp le (with s sa) using the plugin option
- From: karthik duraisami <kdconstant at hotmail dot com>
- To: <gcc-help at gcc dot gnu dot org>, <gcc at gcc dot gnu dot org>
- Date: Fri, 11 Jun 2010 17:31:17 +0000
- Subject: Dump final -most gimp le (with s sa) using the plugin option
Hi,
I am trying to dump the final-most gimple (in ssa) file. My understanding is that lto encodes GIMPLE IR in the bytestream of the object files and accordingly I invoke PLUGIN_PASS_MANAGER_SETUP to embed my faux dummy pass after 'pass_ipa_lto_finish_out'. Is ssa information available at the 'all_lto_gen_passes' stage?
Also, should I check for other properties (PROP_trees) and should I bother with TODO_cleanup_cfg?
Error message:
cc1: fatal error: pass ‘ipa_lto_gimple_out’ not found but is referenced by new pass ‘gimpleSSA_out’
Any help would be greatly appreciated.
Thank you.
Regards,
Karthik
-----------------------------------####################-----------------------------------
-----------------------------------####################-----------------------------------
#include "gcc-plugin.h"
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tree.h"
#include "intl.h"
#include "tm.h"
#include "gimple.h"
#include "tree-pass.h"
#include <string.h>
int plugin_is_GPL_compatible;
struct ipa_opt_pass_d pass_dump_GSSA =
?{
? {
?? IPA_PASS,
?? "gimpleSSA_out",??????? /* name */
?? NULL,?????????????????????????? /* gate */
?? NULL,?????????????????????????? /* execute */
?? NULL,?????????????????????????? /* sub */
?? NULL,?????????????????????????? /* next */
?? 0,?????????????????????????????????? /* static_pass_number - a nonzero static_pass_number
????????????????????????????????????????????? indicates that the pass is already in the list. */
?? 0,?????????????????????????????????? /* tv_id */
?? PROP_ssa,??????????????????? /* properties_required */
?? 0,?????????????????????????????????? /* properties_provided */
?? 0,?????????????????????????????????? /* properties_destroyed */
?? 0,?????????????????????????????????? /* todo_flags_start */
??? TODO_update_ssa_any
?? | TODO_dump_func????? /* todo_flags_finish */
? },
? NULL,??????????????????????????? /* generate_summary */
? NULL,??????????????????????????? /* write_summary */
? NULL,??????????????????????????? /* read_summary */
? NULL,??????????????????????????? /* function_read_summary */
? NULL,??????????????????????????? /* stmt_fixup */
? 0,??????????????????????????????????? /* TODOs */
? NULL,??????????????????????????? /* function_transform */
? NULL???????????????????????????? /* variable_transform */
?};
int
plugin_init (struct plugin_name_args *plugin_info,
???????????? struct plugin_gcc_version *version)
{
? /* if (!plugin_default_version_check (version, &gcc_version))
??? return 1; */
? struct register_pass_info pass_info;
? const char *plugin_name = plugin_info->base_name;
? int argc = plugin_info->argc;
? struct plugin_argument *argv = plugin_info->argv;
?
? pass_info.pass = &pass_dump_GSSA.pass;
? pass_info.reference_pass_name = "ipa_lto_gimple_out";
? /*Do it for every instance if it is 0. */
? pass_info.ref_pass_instance_number = 0;
? /* This pass can go almost anywhere as long as you're in SSA form */
? pass_info.pos_op = PASS_POS_INSERT_AFTER;
?
? /* Register this new pass with GCC */
? register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL,
???????????????????? &pass_info);
?
? /* Register the user attribute */
? /*register_callback (plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL); */
?
? return 0;
}
-----------------------------------####################-----------------------------------
-----------------------------------####################-----------------------------------
GCC=/usr/local/bin/gcc-4.5
PLUGIN_SOURCE_FILES= plugin_dumpGimpleSSA.c
PLUGIN_OBJECT_FILES= $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES))
GCCPLUGINS_DIR:= $(shell $(GCC) -print-file-name=plugin)
CFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -O2
dumpGimpleSSA_plugin.so: $(PLUGIN_OBJECT_FILES)
??? $(GCC) -shared $^ -o $@
?-----------------------------------####################-----------------------------------
/usr/local/bin/gcc-4.5 -v -O2 -o prova -fdump-tree-all -fplugin=/home/karthik/Temp/dumpGimpleSSA_plugin.so ../../prova.c
?-----------------------------------####################-----------------------------------
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5