Mercurial > cospy
annotate src/cospy.c @ 18:882a80582a64
Doc on arguments of _walk_code_tree()
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 10 Sep 2010 12:11:52 +0800 |
parents | 2bf246207140 |
children | e1197013c423 |
rev | line source |
---|---|
0 | 1 #include "gcc-plugin.h" |
2 #include "plugin-version.h" | |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
3 #include "system.h" |
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
4 #include "coretypes.h" |
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
5 #include "tree-pass.h" |
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
6 #include "tree.h" |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
7 #include "tree-iterator.h" |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
8 #include "gimple.h" |
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
9 #include "cgraph.h" |
0 | 10 #include <stdio.h> |
11 | |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
12 /* This is required for GCC plugin, or it is can not be loaded */ |
0 | 13 int plugin_is_GPL_compatible; |
14 | |
7 | 15 /*! \brief Parse a tree of type and return respective string. |
16 * | |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
17 * The struncture of a pointer type |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
18 * - pointer:pointer_type |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
19 * - type:*_type |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
20 * - name:type_decl |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
21 * - name:identifier |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
22 * |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
23 * For a constant type, it is flaged as a readonly. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
24 * |
7 | 25 * \return a string for the type. It must be free through ggc_free(). |
26 */ | |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
27 static char * |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
28 parse_type(tree type_node) { |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
29 tree type_v; |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
30 tree *pointers; |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
31 tree type_decl, type_name; |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
32 int ptr_lvl = 0; |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
33 int const_cnt = 0; |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
34 char *type_str; |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
35 const char *base_type_name; |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
36 int type_str_len; |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
37 int str_i, ptr_i; |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
38 |
7 | 39 /* Collect pointers */ |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
40 type_v = type_node; |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
41 while(TREE_CODE(type_v) == POINTER_TYPE) { |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
42 if(TREE_READONLY(type_v)) |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
43 const_cnt++; |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
44 type_v = TREE_TYPE(type_v); |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
45 ptr_lvl++; |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
46 } |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
47 |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
48 pointers = (tree *)ggc_alloc(sizeof(tree) * ptr_lvl); |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
49 type_v = type_node; |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
50 for(ptr_i = 0; ptr_i < ptr_lvl; ptr_i++) { |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
51 pointers[ptr_i] = type_v; |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
52 type_v = TREE_TYPE(type_v); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
53 } |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
54 |
7 | 55 /* Get name of base type */ |
56 type_decl = TYPE_NAME(type_v); | |
57 type_name = DECL_NAME(type_decl); | |
58 base_type_name = IDENTIFIER_POINTER(type_name); | |
59 | |
60 /* Compute total length of string of full type */ | |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
61 type_str_len = ptr_lvl + strlen(base_type_name) + |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
62 const_cnt * 5; /* "const" */ |
7 | 63 if(TREE_READONLY(type_v)) |
64 type_str_len += 6; /* "const " */ | |
65 type_str = (char *)ggc_alloc(type_str_len + 1); | |
66 | |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
67 /* base type and constant modification */ |
7 | 68 type_str[0] = 0; |
69 if(TREE_READONLY(type_v)) | |
70 strcpy(type_str, "const "); | |
71 strcat(type_str, base_type_name); | |
72 | |
73 /* Add pointers and const modifications after base type */ | |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
74 str_i = strlen(type_str); |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
75 for(ptr_i = ptr_lvl - 1; ptr_i >= 0; ptr_i--) { |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
76 type_v = pointers[ptr_i]; |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
77 type_str[str_i++] = '*'; |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
78 if(TREE_READONLY(type_v)) { |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
79 strcpy(type_str + str_i, "const"); |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
80 str_i += 5; |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
81 } |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
82 } |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
83 type_str[str_i] = 0; |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
84 |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
85 ggc_free(pointers); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
86 |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
87 return type_str; |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
88 } |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
89 |
8
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
90 /*! \brief Show functions that called by a specified function. |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
91 * |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
92 * \param cgn is cgraph_node of a function. |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
93 */ |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
94 static void |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
95 show_callees(struct cgraph_node *cgn) { |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
96 struct cgraph_edge *edge; |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
97 struct cgraph_node *callee_cgn; |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
98 tree callee, callee_name; |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
99 |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
100 /* Follow edges to called functions */ |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
101 edge = cgn->callees; |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
102 while(edge) { |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
103 callee_cgn = edge->callee; |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
104 callee = callee_cgn->decl; |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
105 callee_name = DECL_NAME(callee); |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
106 |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
107 printf(" call %s\n", IDENTIFIER_POINTER(callee_name)); |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
108 |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
109 edge = edge->next_callee; |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
110 } |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
111 } |
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
112 |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
113 /*! \defgroup tree_travel Tree traveling and manipulation tools. |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
114 * @{ |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
115 */ |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
116 typedef struct _stmt_link { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
117 tree stmt; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
118 struct _stmt_link *parent; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
119 } stmt_link; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
120 |
14
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
121 /*! \brief Trival tree of GIMPLE code with a callback. |
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
122 * |
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
123 * walk_code_free() would call the function given by cb with |
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
124 * expression and data as arguments. The cb is called only for the |
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
125 * node with tree code value given by accept_code. |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
126 * |
17
2bf246207140
Doc for visit argument of _walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
16
diff
changeset
|
127 * This fuction is also used to clean visited flag of nodes in a tree. |
2bf246207140
Doc for visit argument of _walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
16
diff
changeset
|
128 * Parameter visit is true for doing normal traveling. Visit is false |
2bf246207140
Doc for visit argument of _walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
16
diff
changeset
|
129 * for doing cleaning. |
2bf246207140
Doc for visit argument of _walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
16
diff
changeset
|
130 * |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
131 * \param accept_code is tree code of nodes that calling cb for or -1 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
132 * to call cb for every node. |
18
882a80582a64
Doc on arguments of _walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
17
diff
changeset
|
133 * \param cb is callback that you want to use for visiting selected nodes. |
882a80582a64
Doc on arguments of _walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
17
diff
changeset
|
134 * \param data is user data passed to cb. |
882a80582a64
Doc on arguments of _walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
17
diff
changeset
|
135 * \param parent is a link node to parent and ancestors. |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
136 * \param visit is true for traveling and false for cleaning. |
14
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
137 */ |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
138 static void |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
139 _walk_code_tree(tree expr, int accept_code, |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
140 void (*cb)(tree, void *, stmt_link *), void *data, |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
141 stmt_link *parent, bool visit) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
142 stmt_link me = {expr, parent}; |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
143 int code; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
144 tree child; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
145 int i, sz; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
146 tree_stmt_iterator stmt_itr; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
147 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
148 if(expr == NULL) |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
149 return; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
150 |
16
3808a6ffc881
Fix logical bug walk_code_tree() and duplicate function calls
Thinker K.F. Li <thinker@codemud.net>
parents:
15
diff
changeset
|
151 if(visit && TREE_VISITED(expr)) |
3808a6ffc881
Fix logical bug walk_code_tree() and duplicate function calls
Thinker K.F. Li <thinker@codemud.net>
parents:
15
diff
changeset
|
152 return; |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
153 TREE_VISITED(expr) = visit; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
154 |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
155 code = TREE_CODE(expr); |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
156 |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
157 if(cb && (accept_code == -1 || code == accept_code)) |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
158 cb(expr, data, parent); |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
159 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
160 switch(code) { |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
161 case ERROR_MARK: /* 0 */ |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
162 case IDENTIFIER_NODE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
163 case TREE_LIST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
164 case TREE_VEC: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
165 case BLOCK: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
166 case OFFSET_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
167 case ENUMERAL_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
168 case BOOLEAN_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
169 case INTEGER_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
170 case REAL_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
171 case POINTER_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
172 case FIXED_POINT_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
173 case REFERENCE_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
174 case COMPLEX_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
175 case VECTOR_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
176 case ARRAY_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
177 case RECORD_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
178 case UNION_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
179 case QUAL_UNION_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
180 case VOID_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
181 case FUNCTION_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
182 case METHOD_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
183 case LANG_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
184 case INTEGER_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
185 case REAL_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
186 case FIXED_CST: /* 25 */ |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
187 case COMPLEX_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
188 case VECTOR_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
189 case STRING_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
190 case FUNCTION_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
191 case LABEL_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
192 case FIELD_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
193 case VAR_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
194 case CONST_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
195 case PARM_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
196 case TYPE_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
197 case RESULT_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
198 case DEBUG_EXPR_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
199 case NAMESPACE_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
200 case IMPORTED_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
201 case TRANSLATION_UNIT_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
202 case COMPONENT_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
203 case BIT_FIELD_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
204 case REALPART_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
205 case IMAGPART_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
206 case ARRAY_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
207 case ARRAY_RANGE_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
208 case INDIRECT_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
209 case ALIGN_INDIRECT_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
210 case MISALIGNED_INDIRECT_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
211 case OBJ_TYPE_REF: /* 50 */ |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
212 case CONSTRUCTOR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
213 case COMPOUND_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
214 case MODIFY_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
215 case INIT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
216 case TARGET_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
217 case COND_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
218 case VEC_COND_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
219 sz = TREE_OPERAND_LENGTH(expr); |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
220 for(i = 0; i < sz; i++) { |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
221 child = TREE_OPERAND(expr, i); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
222 _walk_code_tree(child, accept_code, cb, data, &me, visit); |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
223 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
224 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
225 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
226 case BIND_EXPR: |
14
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
227 /* See BIND_EXPR in tree.def */ |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
228 child = BIND_EXPR_BODY(expr); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
229 _walk_code_tree(child, accept_code, cb, data, &me, visit); |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
230 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
231 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
232 case CALL_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
233 case WITH_CLEANUP_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
234 case CLEANUP_POINT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
235 case PLACEHOLDER_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
236 case PLUS_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
237 case MINUS_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
238 case MULT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
239 case POINTER_PLUS_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
240 case TRUNC_DIV_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
241 case CEIL_DIV_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
242 case FLOOR_DIV_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
243 case ROUND_DIV_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
244 case TRUNC_MOD_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
245 case CEIL_MOD_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
246 case FLOOR_MOD_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
247 case ROUND_MOD_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
248 case RDIV_EXPR: /* 75 */ |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
249 case EXACT_DIV_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
250 case FIX_TRUNC_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
251 case FLOAT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
252 case NEGATE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
253 case MIN_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
254 case MAX_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
255 case ABS_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
256 case LSHIFT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
257 case RSHIFT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
258 case LROTATE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
259 case RROTATE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
260 case BIT_IOR_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
261 case BIT_XOR_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
262 case BIT_AND_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
263 case BIT_NOT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
264 case TRUTH_ANDIF_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
265 case TRUTH_ORIF_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
266 case TRUTH_AND_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
267 case TRUTH_OR_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
268 case TRUTH_XOR_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
269 case TRUTH_NOT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
270 case LT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
271 case LE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
272 case GT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
273 case GE_EXPR: /* 100 */ |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
274 case EQ_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
275 case NE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
276 case UNORDERED_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
277 case ORDERED_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
278 case UNLT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
279 case UNLE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
280 case UNGT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
281 case UNGE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
282 case UNEQ_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
283 case LTGT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
284 case RANGE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
285 case PAREN_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
286 case CONVERT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
287 case ADDR_SPACE_CONVERT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
288 case FIXED_CONVERT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
289 case NOP_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
290 case NON_LVALUE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
291 case VIEW_CONVERT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
292 case COMPOUND_LITERAL_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
293 case SAVE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
294 case ADDR_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
295 case FDESC_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
296 case COMPLEX_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
297 case CONJ_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
298 case PREDECREMENT_EXPR: /* 125 */ |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
299 case PREINCREMENT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
300 case POSTDECREMENT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
301 case POSTINCREMENT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
302 case VA_ARG_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
303 case TRY_CATCH_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
304 case TRY_FINALLY_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
305 case DECL_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
306 case LABEL_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
307 case GOTO_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
308 case RETURN_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
309 case EXIT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
310 case LOOP_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
311 case SWITCH_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
312 case CASE_LABEL_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
313 case ASM_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
314 case SSA_NAME: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
315 case CATCH_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
316 case EH_FILTER_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
317 case SCEV_KNOWN: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
318 case SCEV_NOT_KNOWN: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
319 case POLYNOMIAL_CHREC: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
320 sz = TREE_OPERAND_LENGTH(expr); |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
321 for(i = 0; i < sz; i++) { |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
322 child = TREE_OPERAND(expr, i); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
323 _walk_code_tree(child, accept_code, cb, data, &me, visit); |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
324 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
325 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
326 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
327 case STATEMENT_LIST: |
14
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
328 /* See STATEMENT_LIST in tree.def of GCC */ |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
329 for(stmt_itr = tsi_start(expr); |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
330 !tsi_end_p(stmt_itr); |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
331 tsi_next(&stmt_itr)) { |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
332 child = tsi_stmt(stmt_itr); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
333 _walk_code_tree(child, accept_code, cb, data, &me, visit); |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
334 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
335 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
336 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
337 case ASSERT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
338 case TREE_BINFO: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
339 case WITH_SIZE_EXPR: /* 150 */ |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
340 case REALIGN_LOAD_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
341 case TARGET_MEM_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
342 case OMP_PARALLEL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
343 case OMP_TASK: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
344 case OMP_FOR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
345 case OMP_SECTIONS: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
346 case OMP_SINGLE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
347 case OMP_SECTION: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
348 case OMP_MASTER: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
349 case OMP_ORDERED: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
350 case OMP_CRITICAL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
351 case OMP_ATOMIC: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
352 case OMP_CLAUSE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
353 case REDUC_MAX_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
354 case REDUC_MIN_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
355 case REDUC_PLUS_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
356 case DOT_PROD_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
357 case WIDEN_SUM_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
358 case WIDEN_MULT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
359 case VEC_LSHIFT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
360 case VEC_RSHIFT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
361 case VEC_WIDEN_MULT_HI_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
362 case VEC_WIDEN_MULT_LO_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
363 case VEC_UNPACK_HI_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
364 case VEC_UNPACK_LO_EXPR: /* 175 */ |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
365 case VEC_UNPACK_FLOAT_HI_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
366 case VEC_UNPACK_FLOAT_LO_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
367 case VEC_PACK_TRUNC_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
368 case VEC_PACK_SAT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
369 case VEC_PACK_FIX_TRUNC_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
370 case VEC_EXTRACT_EVEN_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
371 case VEC_EXTRACT_ODD_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
372 case VEC_INTERLEAVE_HIGH_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
373 case VEC_INTERLEAVE_LOW_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
374 case PREDICT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
375 case OPTIMIZATION_NODE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
376 case TARGET_OPTION_NODE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
377 sz = TREE_OPERAND_LENGTH(expr); |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
378 for(i = 0; i < sz; i++) { |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
379 child = TREE_OPERAND(expr, i); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
380 _walk_code_tree(child, accept_code, cb, data, &me, visit); |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
381 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
382 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
383 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
384 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
385 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
386 static void |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
387 walk_code_tree(tree expr, int accept_code, |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
388 void (*cb)(tree, void *, stmt_link *), void *data) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
389 _walk_code_tree(expr, accept_code, cb, data, NULL, true); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
390 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
391 /* cleaning visited flag for every node */ |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
392 _walk_code_tree(expr, -1, NULL, NULL, NULL, false); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
393 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
394 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
395 static void |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
396 tree_insert_before_stmt(tree new_node, tree old_node, tree parent) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
397 tree_stmt_iterator itr; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
398 tree visit; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
399 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
400 for(itr = tsi_start(parent); !tsi_end_p(itr); tsi_next(&itr)) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
401 visit = tsi_stmt(itr); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
402 if(visit == old_node) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
403 tsi_link_before(&itr, new_node, TSI_SAME_STMT); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
404 TREE_VISITED(new_node) = true; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
405 break; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
406 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
407 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
408 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
409 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
410 static void |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
411 tree_insert_before_arg(tree new_node, tree old_node, tree parent) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
412 tree visit; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
413 tree compound; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
414 int len; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
415 int i; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
416 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
417 len = TREE_OPERAND_LENGTH(parent); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
418 for(i = 0; i < len; i++) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
419 visit = TREE_OPERAND(parent, i); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
420 if(visit == old_node) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
421 compound = build2(COMPOUND_EXPR, TREE_TYPE(old_node), |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
422 new_node, old_node); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
423 TREE_VISITED(compound) = true; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
424 TREE_OPERAND(parent, i) = compound; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
425 break; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
426 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
427 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
428 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
429 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
430 /*! \brief Insert a new node before an old node under a parent. |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
431 * |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
432 * \param new_node is the node to be inserted. |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
433 * \param old_node is the node where the new one being inserted before. |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
434 * \param parent is the parent node of old_node. |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
435 */ |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
436 static void |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
437 tree_insert_before(tree new_node, tree old_node, tree parent) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
438 int pcode; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
439 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
440 pcode = TREE_CODE(parent); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
441 if(pcode == STATEMENT_LIST) |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
442 tree_insert_before_stmt(new_node, old_node, parent); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
443 else |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
444 tree_insert_before_arg(new_node, old_node, parent); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
445 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
446 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
447 /* @} */ |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
448 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
449 /*! \brief Called for found CALL_EXPR in a tree when trevaling. |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
450 */ |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
451 static void |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
452 found_call(tree expr, void *data, stmt_link *parent_link) { |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
453 tree addr; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
454 tree fn, fn_name; |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
455 tree parent = parent_link->stmt; |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
456 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
457 addr = TREE_OPERAND(expr, 1); |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
458 fn = TREE_OPERAND(addr, 0); |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
459 fn_name = DECL_NAME(fn); |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
460 |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
461 printf(" CALL %s:%s:%d from a %d\n", |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
462 IDENTIFIER_POINTER(fn_name), |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
463 EXPR_FILENAME(expr), |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
464 EXPR_LINENO(expr), |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
465 TREE_CODE(parent)); |
16
3808a6ffc881
Fix logical bug walk_code_tree() and duplicate function calls
Thinker K.F. Li <thinker@codemud.net>
parents:
15
diff
changeset
|
466 |
3808a6ffc881
Fix logical bug walk_code_tree() and duplicate function calls
Thinker K.F. Li <thinker@codemud.net>
parents:
15
diff
changeset
|
467 /* Do a function call twice */ |
3808a6ffc881
Fix logical bug walk_code_tree() and duplicate function calls
Thinker K.F. Li <thinker@codemud.net>
parents:
15
diff
changeset
|
468 tree_insert_before(expr, expr, parent); |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
469 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
470 |
10 | 471 /*! \brief Find all call expression in a code block. |
12
6fdb0cfdc2a7
More information about GIMPLE
Thinker K.F. Li <thinker@codemud.net>
parents:
11
diff
changeset
|
472 * |
6fdb0cfdc2a7
More information about GIMPLE
Thinker K.F. Li <thinker@codemud.net>
parents:
11
diff
changeset
|
473 * This function find CALL_EXPR in body of a function that represented |
6fdb0cfdc2a7
More information about GIMPLE
Thinker K.F. Li <thinker@codemud.net>
parents:
11
diff
changeset
|
474 * as a GIMPE tree. See gcc/tree.def and gcc/c-gimplify.c of GCC for |
6fdb0cfdc2a7
More information about GIMPLE
Thinker K.F. Li <thinker@codemud.net>
parents:
11
diff
changeset
|
475 * more information of tree code of GIMPLE. |
10 | 476 */ |
477 static void | |
478 find_call_expr(tree fn) { | |
11
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
479 tree bind, body; |
10 | 480 |
12
6fdb0cfdc2a7
More information about GIMPLE
Thinker K.F. Li <thinker@codemud.net>
parents:
11
diff
changeset
|
481 bind = DECL_SAVED_TREE(fn); /* BIND_EXPR */ |
11
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
482 body = BIND_EXPR_BODY(bind); |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
483 walk_code_tree(body, CALL_EXPR, found_call, NULL); |
10 | 484 } |
485 | |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
486 /*! \brief This function is called before running all_passes. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
487 * |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
488 * all_passes is a list of optimization passes of GCC. See |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
489 * init_optimization_passes() in gcc/passes.c of GCC. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
490 * |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
491 * This function is called for every function. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
492 */ |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
493 static void |
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
494 handle_all_passes(void *gcc_data, void *user_data) { |
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
495 tree decl; |
8
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
496 struct cgraph_node *cgn; |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
497 |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
498 /* |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
499 * GCC uses cgraph_node to save information of functions and |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
500 * relationships between functions (a.k.a call graphy). |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
501 */ |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
502 decl = cfun->decl; |
8
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
503 cgn = cgraph_node(decl); |
10 | 504 |
8
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
505 printf("%s:%d:%s\n", current_function_name(), |
5
a32f4bd19eda
Show line number and source file after function name
Thinker K.F. Li <thinker@codemud.net>
parents:
4
diff
changeset
|
506 DECL_SOURCE_LINE(decl), |
a32f4bd19eda
Show line number and source file after function name
Thinker K.F. Li <thinker@codemud.net>
parents:
4
diff
changeset
|
507 DECL_SOURCE_FILE(decl)); |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
508 |
8
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
509 show_callees(cgn); |
11
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
510 } |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
511 |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
512 /*! \brief Called before every optimization pass. |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
513 */ |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
514 static void |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
515 handle_every_pass(void *gcc_data, void *user_data) { |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
516 #if 0 |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
517 printf("PASS %s (type=%x)\n", current_pass->name, current_pass->type); |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
518 #endif |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
519 } |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
520 |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
521 /*! \brief Callback before any optimization pass. |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
522 * |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
523 * It supposed to get function body in GIMPLE statements. If we don't |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
524 * do this, here, it, GIMPLE statements, would be destroyed by |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
525 * optimization passes. |
12
6fdb0cfdc2a7
More information about GIMPLE
Thinker K.F. Li <thinker@codemud.net>
parents:
11
diff
changeset
|
526 |
11
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
527 */ |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
528 static void |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
529 handle_pre_genericize(void *gcc_data, void *user_data) { |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
530 tree fndecl; |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
531 /* for arguments */ |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
532 tree arg, arg_name; |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
533 tree arg_type; |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
534 char *arg_type_str; |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
535 |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
536 fndecl = cfun->decl; |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
537 |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
538 printf("%s:%d:%s\n", current_function_name(), |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
539 DECL_SOURCE_LINE(fndecl), |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
540 DECL_SOURCE_FILE(fndecl)); |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
541 |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
542 /* |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
543 * Parse and show arguments of the function. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
544 */ |
11
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
545 arg = DECL_ARGUMENTS(fndecl); |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
546 while(arg) { |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
547 /* |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
548 * The structure of an argument. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
549 * - parm |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
550 * - name:identifier |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
551 * - type:type |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
552 * - name:type_decl |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
553 * - name:identifier |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
554 */ |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
555 arg_name = DECL_NAME(arg); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
556 arg_type = TREE_TYPE(arg); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
557 arg_type_str = parse_type(arg_type); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
558 printf(" %s:%s\n", |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
559 IDENTIFIER_POINTER(arg_name), |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
560 arg_type_str); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
561 ggc_free(arg_type_str); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
562 arg = TREE_CHAIN(arg); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
563 } |
11
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
564 |
10 | 565 find_call_expr(fndecl); |
566 } | |
567 | |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
568 /*! \brief Initialize function for the plugin. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
569 */ |
0 | 570 int |
571 plugin_init(struct plugin_name_args *plugin_info, | |
572 struct plugin_gcc_version *version) { | |
573 if (!plugin_default_version_check (version, &gcc_version)) | |
574 return 1; | |
575 printf("Initialize plugin %s\n", plugin_info->base_name); | |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
576 |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
577 /* |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
578 * Register a callback called before running passes in all_passes. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
579 */ |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
580 register_callback(plugin_info->base_name, PLUGIN_ALL_PASSES_START, |
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
581 handle_all_passes, NULL); |
10 | 582 |
583 register_callback(plugin_info->base_name, PLUGIN_PASS_EXECUTION, | |
584 handle_every_pass, NULL); | |
585 | |
586 /* | |
587 * Call handle_pre_genericize before genericize a function. | |
588 * | |
589 * This callback is run before any optimization pass. It is just | |
590 * after finishing (parsing) a function. | |
591 */ | |
592 register_callback(plugin_info->base_name, PLUGIN_PRE_GENERICIZE, | |
593 handle_pre_genericize, NULL); | |
0 | 594 return 0; |
595 } | |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
596 |