Mercurial > cospy
comparison src/cospy.c @ 4:8855f7d934ae
Get name of functions before exceuting all_passes
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 08 Sep 2010 17:46:29 +0800 |
parents | 92347d3a3bf3 |
children | a32f4bd19eda |
comparison
equal
deleted
inserted
replaced
3:92347d3a3bf3 | 4:8855f7d934ae |
---|---|
1 #include "gcc-plugin.h" | 1 #include "gcc-plugin.h" |
2 #include "plugin-version.h" | 2 #include "plugin-version.h" |
3 #include "system.h" | |
4 #include "coretypes.h" | |
5 #include "tree-pass.h" | |
6 #include "tree.h" | |
7 #include "gimple.h" | |
8 #include "cgraph.h" | |
3 #include <stdio.h> | 9 #include <stdio.h> |
4 | 10 |
5 int plugin_is_GPL_compatible; | 11 int plugin_is_GPL_compatible; |
6 | 12 |
13 static void | |
14 handle_all_passes(void *gcc_data, void *user_data) { | |
15 tree decl; | |
16 | |
17 decl = cfun->decl; | |
18 printf("decl %x\n", decl); | |
19 printf(" %s\n", current_function_name()); | |
20 } | |
21 | |
7 int | 22 int |
8 plugin_init(struct plugin_name_args *plugin_info, | 23 plugin_init(struct plugin_name_args *plugin_info, |
9 struct plugin_gcc_version *version) { | 24 struct plugin_gcc_version *version) { |
25 struct cgraph_node_hook_list *hook; | |
26 | |
10 if (!plugin_default_version_check (version, &gcc_version)) | 27 if (!plugin_default_version_check (version, &gcc_version)) |
11 return 1; | 28 return 1; |
12 printf("Initialize plugin %s\n", plugin_info->base_name); | 29 printf("Initialize plugin %s\n", plugin_info->base_name); |
30 | |
31 register_callback(plugin_info->base_name, PLUGIN_ALL_PASSES_START, | |
32 handle_all_passes, NULL); | |
13 return 0; | 33 return 0; |
14 } | 34 } |