6 # include "irsimpletype.h"
7 # include "heapanal/heapanal.h"
9 /* boilerplate stuff: */
19 * Class: firmjni_Heapanal
23 void Java_firmjni_Heapanal_initAnal (JNIEnv *env, jclass clazz)
25 /* from interprete.c: */
30 * Class: firmjni_Heapanal
34 void Java_firmjni_Heapanal_deInitAnal (JNIEnv *env, jclass clazz)
40 * Class: firmjni_Heapanal
44 void Java_firmjni_Heapanal_analHeap__I (JNIEnv *env, jclass clazz, jint fMethod)
46 ha_analyse_heap((entity *) fMethod, 0);
50 * Class: firmjni_Heapanal
54 void Java_firmjni_Heapanal_analHeap__ (JNIEnv *env, jclass clazz)
59 fprintf (stdout, "Hello, Heap!\n");
61 fprintf (stdout, "Ajacs Boilerplate:\n");
63 entity **free_methods = 0;
66 /* replace static constant fields by constants
67 @@@ This corrects some code that is invalid Firm!!!
68 Execute before irg_vrfy(). */
70 /* opt_load_const_static(); */
72 /* dump graphs as they come out of the front end */
74 dump_all_types (suffix);
75 dump_class_hierarchy (true, suffix);
76 dump_all_ir_graphs(dump_ir_block_graph, suffix);
77 dump_all_ir_graphs(dump_ir_block_graph_w_types, suffix);
78 dump_all_ir_graphs(dump_cfg, suffix);
80 /* verify constructed graphs */
81 for (i = 0; i < get_irp_n_irgs(); i++)
82 irg_vrfy(get_irp_irg(i));
84 /* verify something */
89 * test loop construction intraprocedural
91 for (i = 0; i < get_irp_n_irgs(); i++) {
92 construct_backedges(get_irp_irg(i));
95 dump_loop_information();
96 dump_ir_block_graph(get_irp_irg(i), "-1.2-intra-loop");
97 dont_dump_loop_information();
98 dump_loop_tree(get_irp_irg(i), "-1.2-intra");
102 DDMG (get_irp_main_irg ());
103 assert(get_irp_main_irg());
104 assert(get_irg_entity(get_irp_main_irg()));
107 /** Do interprocedural optimizations **/
108 /* Analysis that builds the call graph and finds the free methods,
109 i.e. methods that are dereferenced.
110 Optimizes polymorphic calls.*/
111 cgana(&arr_len, &free_methods, 0);
112 /* Remove methods that are never called. */
113 /* gc_irgs(arr_len, free_methods); */
114 /* Build the interprocedural dataflow representation */
115 cg_construct(arr_len, free_methods);
117 /* Test construction of interprocedural loop information */
118 /* construct_ip_backedges(); */
120 dump_loop_information();
121 dump_all_cg_block_graph("-1.2-inter-loop");
122 dont_dump_loop_information();
123 dump_loop_tree(get_irp_main_irg(), "-1.2-inter");
126 fprintf (stdout, "HA:\n");
127 DDMG (get_irp_main_irg ());
129 set_max_chi_height(8); /* change ad lib */
130 set_initial_context_depth(4); /* change as needed */
131 ha_analyse_heap(get_irg_entity(get_irp_main_irg()), 1);
133 /* Remove the interprocedural dataflow representation */
137 /* verify optimized graphs */
138 for (i = 0; i < get_irp_n_irgs(); i++) {
139 irg_vrfy(get_irp_irg(i));
146 set_opt_dump_abstvals (1);
150 fprintf (stdout, "Bye, Heap!\n");
157 * Revision 1.4 2004/08/14 10:09:52 goetz
158 * adapted to new semantics
160 * Revision 1.3 2004/04/30 09:00:01 goetz
161 * added configure support for heap analyses
163 * Revision 1.2 2004/04/29 13:59:11 liekweg
164 * Removed C++-Style comments --flo
166 * Revision 1.1 2004/04/29 12:11:36 liekweg
167 * Moved ... to aux --flo
169 * Revision 1.1 2004/04/27 12:41:31 liekweg
170 * Fixed ir/ana/irouts.c ir/ir/ircons.h ir/ir/irdump.c --flo
171 * Added aux/Heapanal.c aux/Heapanal.java --flo