6 # include "irsimpletype.h"
7 # include "src/heapanal.h"
8 # include "src/interprete.h"
11 #include "libfirm/irvrfy.h"
12 #include "libfirm/trvrfy.h"
13 #include "libfirm/irdump.h"
20 * Class: firmjni_Heapanal
24 void Java_firmjni_Heapanal_initAnal (JNIEnv *env, jclass clazz)
31 * Class: firmjni_Heapanal
35 void Java_firmjni_Heapanal_deInitAnal (JNIEnv *env, jclass clazz)
41 * Class: firmjni_Heapanal
45 void Java_firmjni_Heapanal_analHeap__I (JNIEnv *env, jclass clazz, jint fMethod)
47 ha_analyse_heap((entity *) fMethod, 0);
51 * Class: firmjni_Heapanal
55 void Java_firmjni_Heapanal_analHeap__ (JNIEnv *env, jclass clazz)
60 fprintf (stdout, "Hello, Heap!\n");
62 fprintf (stdout, "Ajacs Boilerplate:\n");
64 entity **free_methods = 0;
67 /* replace static constant fields by constants
68 @@@ This corrects some code that is invalid Firm!!!
69 Execute before irg_vrfy(). */
71 // opt_load_const_static();
73 /* dump graphs as they come out of the front end */
74 dump_file_suffix = "-fe";
76 dump_class_hierarchy (true);
77 dump_all_ir_graphs(dump_ir_block_graph);
78 dump_all_ir_graphs(dump_ir_block_graph_w_types);
79 dump_all_ir_graphs(dump_cfg);
81 /* verify constructed graphs */
82 for (i = 0; i < get_irp_n_irgs(); i++)
83 irg_vrfy(get_irp_irg(i));
85 /* verify something */
90 * test loop construction intraprocedural
92 for (i = 0; i < get_irp_n_irgs(); i++) {
93 construct_backedges(get_irp_irg(i));
96 dump_loop_information();
97 dump_file_suffix = "-1.2-intra-loop";
98 dump_ir_block_graph(get_irp_irg(i));
99 dont_dump_loop_information();
100 dump_loop_tree(get_irp_irg(i), "-1.2-intra");
104 DDMG (get_irp_main_irg ());
105 assert(get_irp_main_irg());
106 assert(get_irg_ent(get_irp_main_irg()));
109 /** Do interprocedural optimizations **/
110 /* Analysis that builds the call graph and finds the free methods,
111 i.e. methods that are dereferenced.
112 Optimizes polymorphic calls.*/
113 cgana(&arr_len, &free_methods);
114 /* Remove methods that are never called. */
115 // gc_irgs(arr_len, free_methods);
116 /* Build the interprocedural dataflow representation */
117 cg_construct(arr_len, free_methods);
119 /* Test construction of interprocedural loop information */
120 // construct_ip_backedges();
122 dump_loop_information();
123 dump_file_suffix = "-1.2-inter-loop";
124 dump_all_cg_block_graph();
125 dont_dump_loop_information();
126 dump_loop_tree(get_irp_main_irg(), "-1.2-inter");
129 fprintf (stdout, "HA:\n");
130 DDMG (get_irp_main_irg ());
132 set_max_chi_height(8); /* change ad lib */
133 set_initial_context_depth(4); /* change as needed */
134 ha_analyse_heap(get_irg_ent(get_irp_main_irg()), 1);
136 /* Remove the interprocedural dataflow representation */
140 /* verify optimized graphs */
141 for (i = 0; i < get_irp_n_irgs(); i++) {
142 irg_vrfy(get_irp_irg(i));
149 set_opt_dump_abstvals (1);
153 fprintf (stdout, "Bye, Heap!\n");
160 * Revision 1.1 2004/04/29 12:11:36 liekweg
161 * Moved ... to aux --flo
163 * Revision 1.1 2004/04/27 12:41:31 liekweg
164 * Fixed ir/ana/irouts.c ir/ir/ircons.h ir/ir/irdump.c --flo
165 * Added aux/Heapanal.c aux/Heapanal.java --flo