Mercurial > cospy
annotate src/cospy.c @ 17:2bf246207140
Doc for visit argument of _walk_code_tree()
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 10 Sep 2010 12:07:47 +0800 |
parents | 3808a6ffc881 |
children | 882a80582a64 |
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. |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
133 * \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
|
134 */ |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
135 static void |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
136 _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
|
137 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
|
138 stmt_link *parent, bool visit) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
139 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
|
140 int code; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
141 tree child; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
142 int i, sz; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
143 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
|
144 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
145 if(expr == NULL) |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
146 return; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
147 |
16
3808a6ffc881
Fix logical bug walk_code_tree() and duplicate function calls
Thinker K.F. Li <thinker@codemud.net>
parents:
15
diff
changeset
|
148 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
|
149 return; |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
150 TREE_VISITED(expr) = visit; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
151 |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
152 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
|
153 |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
154 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
|
155 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
|
156 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
157 switch(code) { |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
158 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
|
159 case IDENTIFIER_NODE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
160 case TREE_LIST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
161 case TREE_VEC: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
162 case BLOCK: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
163 case OFFSET_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
164 case ENUMERAL_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
165 case BOOLEAN_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
166 case INTEGER_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
167 case REAL_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
168 case POINTER_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
169 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
|
170 case REFERENCE_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
171 case COMPLEX_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
172 case VECTOR_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
173 case ARRAY_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
174 case RECORD_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
175 case UNION_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
176 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
|
177 case VOID_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
178 case FUNCTION_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
179 case METHOD_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
180 case LANG_TYPE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
181 case INTEGER_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
182 case REAL_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
183 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
|
184 case COMPLEX_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
185 case VECTOR_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
186 case STRING_CST: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
187 case FUNCTION_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
188 case LABEL_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
189 case FIELD_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
190 case VAR_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
191 case CONST_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
192 case PARM_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
193 case TYPE_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
194 case RESULT_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
195 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
|
196 case NAMESPACE_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
197 case IMPORTED_DECL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
198 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
|
199 case COMPONENT_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
200 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
|
201 case REALPART_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
202 case IMAGPART_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
203 case ARRAY_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
204 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
|
205 case INDIRECT_REF: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
206 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
|
207 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
|
208 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
|
209 case CONSTRUCTOR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
210 case COMPOUND_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
211 case MODIFY_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
212 case INIT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
213 case TARGET_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
214 case COND_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
215 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
|
216 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
|
217 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
|
218 child = TREE_OPERAND(expr, i); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
219 _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
|
220 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
221 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
222 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
223 case BIND_EXPR: |
14
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
224 /* 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
|
225 child = BIND_EXPR_BODY(expr); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
226 _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
|
227 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
228 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
229 case CALL_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
230 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
|
231 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
|
232 case PLACEHOLDER_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
233 case PLUS_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
234 case MINUS_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
235 case MULT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
236 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
|
237 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
|
238 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
|
239 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
|
240 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
|
241 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
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 case FLOAT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
249 case NEGATE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
250 case MIN_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
251 case MAX_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
252 case ABS_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
253 case LSHIFT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
254 case RSHIFT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
255 case LROTATE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
256 case RROTATE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
257 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
|
258 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
|
259 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
|
260 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
|
261 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
|
262 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
|
263 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
|
264 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
|
265 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
|
266 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
|
267 case LT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
268 case LE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
269 case GT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
270 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
|
271 case EQ_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
272 case NE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
273 case UNORDERED_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
274 case ORDERED_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
275 case UNLT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
276 case UNLE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
277 case UNGT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
278 case UNGE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
279 case UNEQ_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
280 case LTGT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
281 case RANGE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
282 case PAREN_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
283 case CONVERT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
284 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
|
285 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
|
286 case NOP_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
287 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
|
288 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
|
289 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
|
290 case SAVE_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
291 case ADDR_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
292 case FDESC_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
293 case COMPLEX_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
294 case CONJ_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
295 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
|
296 case PREINCREMENT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
297 case POSTDECREMENT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
298 case POSTINCREMENT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
299 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
|
300 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
|
301 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
|
302 case DECL_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
303 case LABEL_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
304 case GOTO_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
305 case RETURN_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
306 case EXIT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
307 case LOOP_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
308 case SWITCH_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
309 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
|
310 case ASM_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
311 case SSA_NAME: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
312 case CATCH_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
313 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
|
314 case SCEV_KNOWN: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
315 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
|
316 case POLYNOMIAL_CHREC: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
317 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
|
318 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
|
319 child = TREE_OPERAND(expr, i); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
320 _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
|
321 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
322 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
323 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
324 case STATEMENT_LIST: |
14
566b62a49462
More information about walk_code_tree()
Thinker K.F. Li <thinker@codemud.net>
parents:
13
diff
changeset
|
325 /* 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
|
326 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
|
327 !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
|
328 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
|
329 child = tsi_stmt(stmt_itr); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
330 _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
|
331 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
332 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
333 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
334 case ASSERT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
335 case TREE_BINFO: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
336 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
|
337 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
|
338 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
|
339 case OMP_PARALLEL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
340 case OMP_TASK: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
341 case OMP_FOR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
342 case OMP_SECTIONS: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
343 case OMP_SINGLE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
344 case OMP_SECTION: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
345 case OMP_MASTER: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
346 case OMP_ORDERED: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
347 case OMP_CRITICAL: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
348 case OMP_ATOMIC: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
349 case OMP_CLAUSE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
350 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
|
351 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
|
352 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
|
353 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
|
354 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
|
355 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
|
356 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
|
357 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
|
358 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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 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
|
364 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
|
365 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
|
366 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
|
367 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
|
368 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
|
369 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
|
370 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
|
371 case PREDICT_EXPR: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
372 case OPTIMIZATION_NODE: |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
373 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
|
374 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
|
375 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
|
376 child = TREE_OPERAND(expr, i); |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
377 _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
|
378 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
379 break; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
380 } |
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 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
383 static void |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
384 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
|
385 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
|
386 _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
|
387 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
388 /* cleaning visited flag for every node */ |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
389 _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
|
390 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
391 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
392 static void |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
393 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
|
394 tree_stmt_iterator itr; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
395 tree visit; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
396 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
397 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
|
398 visit = tsi_stmt(itr); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
399 if(visit == old_node) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
400 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
|
401 TREE_VISITED(new_node) = true; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
402 break; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
403 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
404 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
405 } |
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 static void |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
408 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
|
409 tree visit; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
410 tree compound; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
411 int len; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
412 int i; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
413 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
414 len = TREE_OPERAND_LENGTH(parent); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
415 for(i = 0; i < len; i++) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
416 visit = TREE_OPERAND(parent, i); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
417 if(visit == old_node) { |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
418 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
|
419 new_node, old_node); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
420 TREE_VISITED(compound) = true; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
421 TREE_OPERAND(parent, i) = compound; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
422 break; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
423 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
424 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
425 } |
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 /*! \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
|
428 * |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
429 * \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
|
430 * \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
|
431 * \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
|
432 */ |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
433 static void |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
434 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
|
435 int pcode; |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
436 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
437 pcode = TREE_CODE(parent); |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
438 if(pcode == STATEMENT_LIST) |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
439 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
|
440 else |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
441 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
|
442 } |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
443 |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
444 /* @} */ |
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 /*! \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
|
447 */ |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
448 static void |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
449 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
|
450 tree addr; |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
451 tree fn, fn_name; |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
452 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
|
453 |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
454 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
|
455 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
|
456 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
|
457 |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
458 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
|
459 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
|
460 EXPR_FILENAME(expr), |
15
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
461 EXPR_LINENO(expr), |
cf0d24827624
Tree traveling and manipulation functions
Thinker K.F. Li <thinker@codemud.net>
parents:
14
diff
changeset
|
462 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
|
463 |
3808a6ffc881
Fix logical bug walk_code_tree() and duplicate function calls
Thinker K.F. Li <thinker@codemud.net>
parents:
15
diff
changeset
|
464 /* 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
|
465 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
|
466 } |
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
467 |
10 | 468 /*! \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
|
469 * |
6fdb0cfdc2a7
More information about GIMPLE
Thinker K.F. Li <thinker@codemud.net>
parents:
11
diff
changeset
|
470 * 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
|
471 * 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
|
472 * more information of tree code of GIMPLE. |
10 | 473 */ |
474 static void | |
475 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
|
476 tree bind, body; |
10 | 477 |
12
6fdb0cfdc2a7
More information about GIMPLE
Thinker K.F. Li <thinker@codemud.net>
parents:
11
diff
changeset
|
478 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
|
479 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
|
480 walk_code_tree(body, CALL_EXPR, found_call, NULL); |
10 | 481 } |
482 | |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
483 /*! \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
|
484 * |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
485 * 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
|
486 * 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
|
487 * |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
488 * 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
|
489 */ |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
490 static void |
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
491 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
|
492 tree decl; |
8
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
493 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
|
494 |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
495 /* |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
496 * 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
|
497 * 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
|
498 */ |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
499 decl = cfun->decl; |
8
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
500 cgn = cgraph_node(decl); |
10 | 501 |
8
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
502 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
|
503 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
|
504 DECL_SOURCE_FILE(decl)); |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
505 |
8
5502f175d348
Show functions being called
Thinker K.F. Li <thinker@codemud.net>
parents:
7
diff
changeset
|
506 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
|
507 } |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
508 |
bf14d3ed008e
Move code of show arguments from before all_pass to before genericize
Thinker K.F. Li <thinker@codemud.net>
parents:
10
diff
changeset
|
509 /*! \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
|
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 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
|
512 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
|
513 #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
|
514 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
|
515 #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
|
516 } |
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 |
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 /*! \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
|
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 * 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
|
521 * 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
|
522 * optimization passes. |
12
6fdb0cfdc2a7
More information about GIMPLE
Thinker K.F. Li <thinker@codemud.net>
parents:
11
diff
changeset
|
523 |
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
|
524 */ |
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 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
|
526 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
|
527 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
|
528 /* 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
|
529 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
|
530 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
|
531 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
|
532 |
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 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
|
534 |
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 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
|
536 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
|
537 DECL_SOURCE_FILE(fndecl)); |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
538 |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
539 /* |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
540 * 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
|
541 */ |
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
|
542 arg = DECL_ARGUMENTS(fndecl); |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
543 while(arg) { |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
544 /* |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
545 * The structure of an argument. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
546 * - parm |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
547 * - name:identifier |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
548 * - type:type |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
549 * - name:type_decl |
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 */ |
6
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
552 arg_name = DECL_NAME(arg); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
553 arg_type = TREE_TYPE(arg); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
554 arg_type_str = parse_type(arg_type); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
555 printf(" %s:%s\n", |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
556 IDENTIFIER_POINTER(arg_name), |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
557 arg_type_str); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
558 ggc_free(arg_type_str); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
559 arg = TREE_CHAIN(arg); |
165781cb4cdd
Parase pointers and const type
Thinker K.F. Li <thinker@codemud.net>
parents:
5
diff
changeset
|
560 } |
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
|
561 |
10 | 562 find_call_expr(fndecl); |
563 } | |
564 | |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
565 /*! \brief Initialize function for the plugin. |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
566 */ |
0 | 567 int |
568 plugin_init(struct plugin_name_args *plugin_info, | |
569 struct plugin_gcc_version *version) { | |
570 if (!plugin_default_version_check (version, &gcc_version)) | |
571 return 1; | |
572 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
|
573 |
9
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
574 /* |
958c2366e682
More information about design and consideration
Thinker K.F. Li <thinker@codemud.net>
parents:
8
diff
changeset
|
575 * 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
|
576 */ |
4
8855f7d934ae
Get name of functions before exceuting all_passes
Thinker K.F. Li <thinker@codemud.net>
parents:
3
diff
changeset
|
577 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
|
578 handle_all_passes, NULL); |
10 | 579 |
580 register_callback(plugin_info->base_name, PLUGIN_PASS_EXECUTION, | |
581 handle_every_pass, NULL); | |
582 | |
583 /* | |
584 * Call handle_pre_genericize before genericize a function. | |
585 * | |
586 * This callback is run before any optimization pass. It is just | |
587 * after finishing (parsing) a function. | |
588 */ | |
589 register_callback(plugin_info->base_name, PLUGIN_PRE_GENERICIZE, | |
590 handle_pre_genericize, NULL); | |
0 | 591 return 0; |
592 } | |
13
708921504d6d
Find CALL_EXPR and show information of the call
Thinker K.F. Li <thinker@codemud.net>
parents:
12
diff
changeset
|
593 |