Commit 493a2be7 authored by Florian Liekweg's avatar Florian Liekweg
Browse files

Removed C++-Style comments --flo

[r2822]
parent dd880b48
......@@ -7,13 +7,13 @@
# include "src/heapanal.h"
# include "src/interprete.h"
// boilerplate stuff:
/* boilerplate stuff: */
#include "libfirm/irvrfy.h"
#include "libfirm/trvrfy.h"
#include "libfirm/irdump.h"
// I/O:
/* I/O: */
# include <stdio.h>
/*
......@@ -23,7 +23,7 @@
*/
void Java_firmjni_Heapanal_initAnal (JNIEnv *env, jclass clazz)
{
// from interprete.c:
/* from interprete.c: */
init_interprete ();
}
......@@ -61,28 +61,28 @@ void Java_firmjni_Heapanal_analHeap__ (JNIEnv *env, jclass clazz)
fprintf (stdout, "Ajacs Boilerplate:\n");
{
entity **free_methods = 0;
int arr_len = 0;
entity **free_methods = 0;
int arr_len = 0;
/* replace static constant fields by constants
@@@ This corrects some code that is invalid Firm!!!
Execute before irg_vrfy(). */
// ???
// opt_load_const_static();
/* ??? */
/* opt_load_const_static(); */
/* dump graphs as they come out of the front end */
dump_file_suffix = "-fe";
dump_all_types ();
dump_class_hierarchy (true);
dump_all_ir_graphs(dump_ir_block_graph);
dump_all_ir_graphs(dump_ir_block_graph_w_types);
dump_all_ir_graphs(dump_cfg);
/* dump graphs as they come out of the front end */
dump_file_suffix = "-fe";
dump_all_types ();
dump_class_hierarchy (true);
dump_all_ir_graphs(dump_ir_block_graph);
dump_all_ir_graphs(dump_ir_block_graph_w_types);
dump_all_ir_graphs(dump_cfg);
/* verify constructed graphs */
for (i = 0; i < get_irp_n_irgs(); i++)
irg_vrfy(get_irp_irg(i));
irg_vrfy(get_irp_irg(i));
/* verify something */
/* verify something */
tr_vrfy();
......@@ -90,20 +90,20 @@ void Java_firmjni_Heapanal_analHeap__ (JNIEnv *env, jclass clazz)
* test loop construction intraprocedural
*/
for (i = 0; i < get_irp_n_irgs(); i++) {
construct_backedges(get_irp_irg(i));
construct_backedges(get_irp_irg(i));
if (1) {
dump_loop_information();
dump_file_suffix = "-1.2-intra-loop";
dump_ir_block_graph(get_irp_irg(i));
dont_dump_loop_information();
dump_loop_tree(get_irp_irg(i), "-1.2-intra");
dump_loop_information();
dump_file_suffix = "-1.2-intra-loop";
dump_ir_block_graph(get_irp_irg(i));
dont_dump_loop_information();
dump_loop_tree(get_irp_irg(i), "-1.2-intra");
}
}
DDMG (get_irp_main_irg ());
assert(get_irp_main_irg());
assert(get_irg_ent(get_irp_main_irg()));
DDMG (get_irp_main_irg ());
assert(get_irp_main_irg());
assert(get_irg_ent(get_irp_main_irg()));
/** Do interprocedural optimizations **/
......@@ -112,43 +112,43 @@ void Java_firmjni_Heapanal_analHeap__ (JNIEnv *env, jclass clazz)
Optimizes polymorphic calls.*/
cgana(&arr_len, &free_methods);
/* Remove methods that are never called. */
// gc_irgs(arr_len, free_methods);
/* gc_irgs(arr_len, free_methods); */
/* Build the interprocedural dataflow representation */
cg_construct(arr_len, free_methods);
/* Test construction of interprocedural loop information */
// construct_ip_backedges();
/* construct_ip_backedges(); */
dump_loop_information();
dump_file_suffix = "-1.2-inter-loop";
dump_all_cg_block_graph();
dont_dump_loop_information();
dump_loop_tree(get_irp_main_irg(), "-1.2-inter");
dump_loop_information();
dump_file_suffix = "-1.2-inter-loop";
dump_all_cg_block_graph();
dont_dump_loop_information();
dump_loop_tree(get_irp_main_irg(), "-1.2-inter");
fprintf (stdout, "HA:\n");
DDMG (get_irp_main_irg ());
fprintf (stdout, "HA:\n");
DDMG (get_irp_main_irg ());
set_max_chi_height(8); /* change ad lib */
set_initial_context_depth(4); /* change as needed */
ha_analyse_heap(get_irg_ent(get_irp_main_irg()), 1);
set_max_chi_height(8); /* change ad lib */
set_initial_context_depth(4); /* change as needed */
ha_analyse_heap(get_irg_ent(get_irp_main_irg()), 1);
/* Remove the interprocedural dataflow representation */
free(free_methods);
cg_destruct();
free(free_methods);
cg_destruct();
/* verify optimized graphs */
for (i = 0; i < get_irp_n_irgs(); i++) {
irg_vrfy(get_irp_irg(i));
}
/* verify optimized graphs */
for (i = 0; i < get_irp_n_irgs(); i++) {
irg_vrfy(get_irp_irg(i));
}
tr_vrfy();
tr_vrfy();
}
set_opt_dump_abstvals (1);
// ToDo: Dump ???
/* ToDo: Dump ??? */
fprintf (stdout, "Bye, Heap!\n");
}
......@@ -157,6 +157,9 @@ void Java_firmjni_Heapanal_analHeap__ (JNIEnv *env, jclass clazz)
/*
* $Log$
* Revision 1.2 2004/04/29 13:59:11 liekweg
* Removed C++-Style comments --flo
*
* Revision 1.1 2004/04/29 12:11:36 liekweg
* Moved ... to aux --flo
*
......
......@@ -53,7 +53,7 @@ typedef struct scc_info {
bool in_stack; /* Marks whether node is on the stack. */
int dfn; /* Depth first search number. */
int uplink; /* dfn number of ancestor. */
// ir_loop *loop; /* Refers to the containing loop. */
/* ir_loop *loop; *//* Refers to the containing loop. */
/*
struct section *section;
xset def;
......@@ -70,56 +70,56 @@ static INLINE scc_info* new_scc_info(void) {
static INLINE void
mark_irn_in_stack (ir_node *n) {
assert(get_irn_link(n));
// to slow
//((scc_info *)get_irn_link(n))->in_stack = true;
/* to slow */
/* ((scc_info *)get_irn_link(n))->in_stack = true; */
((scc_info *)n->link)->in_stack = true;
}
static INLINE void
mark_irn_not_in_stack (ir_node *n) {
assert(get_irn_link(n));
// to slow
//((scc_info *)get_irn_link(n))->in_stack = false;
/* to slow */
/* ((scc_info *)get_irn_link(n))->in_stack = false; */
((scc_info *)n->link)->in_stack = false;
}
static INLINE bool
irn_is_in_stack (ir_node *n) {
assert(get_irn_link(n));
// to slow
//return ((scc_info *)get_irn_link(n))->in_stack;
/* to slow */
/* return ((scc_info *)get_irn_link(n))->in_stack; */
return ((scc_info *)n->link)->in_stack;
}
static INLINE void
set_irn_uplink (ir_node *n, int uplink) {
assert(get_irn_link(n));
// to slow
//((scc_info *)get_irn_link(n))->uplink = uplink;
/* to slow */
/* ((scc_info *)get_irn_link(n))->uplink = uplink; */
((scc_info *)n->link)->uplink = uplink;
}
static INLINE int
get_irn_uplink (ir_node *n) {
assert(get_irn_link(n));
// to slow
//return ((scc_info *)get_irn_link(n))->uplink;
/* from fast to slow */
/* return ((scc_info *)get_irn_link(n))->uplink; */
return ((scc_info *)n->link)->uplink;
}
static INLINE void
set_irn_dfn (ir_node *n, int dfn) {
assert(get_irn_link(n));
// to slow
//((scc_info *)get_irn_link(n))->dfn = dfn;
/* to slow */
/* ((scc_info *)get_irn_link(n))->dfn = dfn; */
((scc_info *)n->link)->dfn = dfn;
}
static INLINE int
get_irn_dfn (ir_node *n) {
assert(get_irn_link(n));
// to slow
//return ((scc_info *)get_irn_link(n))->dfn;
/* to slow */
/* return ((scc_info *)get_irn_link(n))->dfn; */
return ((scc_info *)n->link)->dfn;
}
......@@ -529,8 +529,8 @@ init_node (ir_node *n, void *env) {
The mem is not lost as its on the obstack. */
ir_node *cb = get_Proj_pred(n);
if ((intern_get_irn_op(cb) == op_CallBegin) ||
(intern_get_irn_op(cb) == op_EndReg) ||
(intern_get_irn_op(cb) == op_EndExcept)) {
(intern_get_irn_op(cb) == op_EndReg) ||
(intern_get_irn_op(cb) == op_EndExcept)) {
init_node(cb, NULL);
init_node(get_nodes_Block(cb), NULL);
}
......@@ -637,21 +637,21 @@ find_irg_on_stack (ir_node *n) {
m = stack[i];
/*printf(" Visiting %d ", i); DDMN(m);*/
if (is_ip_cfop(m)) {
current_ir_graph = get_irn_irg(m);
break;
current_ir_graph = get_irn_irg(m);
break;
}
if (intern_get_irn_op(m) == op_Filter) {
/* Find the corresponding ip_cfop */
ir_node *pred = stack[i+1];
int j;
for (j = 0; j < get_Filter_n_cg_preds(m); j++)
if (get_Filter_cg_pred(m, j) == pred) break;
if (j >= get_Filter_n_cg_preds(m))
/* It is a filter we didn't pass as the predecessors are marked. */
continue;
assert(get_Filter_cg_pred(m, j) == pred);
switch_irg(m, j);
break;
/* Find the corresponding ip_cfop */
ir_node *pred = stack[i+1];
int j;
for (j = 0; j < get_Filter_n_cg_preds(m); j++)
if (get_Filter_cg_pred(m, j) == pred) break;
if (j >= get_Filter_n_cg_preds(m))
/* It is a filter we didn't pass as the predecessors are marked. */
continue;
assert(get_Filter_cg_pred(m, j) == pred);
switch_irg(m, j);
break;
}
}
}
......@@ -825,7 +825,7 @@ static void scc (ir_node *n) {
if (is_backedge(n, i)) continue;
m = intern_get_irn_n(n, i); /* get_irn_ip_pred(n, i); */
//if ((!m) || (intern_get_irn_op(m) == op_Unknown)) continue;
/* if ((!m) || (intern_get_irn_op(m) == op_Unknown)) continue; */
scc (m);
if (irn_is_in_stack(m)) {
/* Uplink of m is smaller if n->m is a backedge.
......@@ -868,10 +868,10 @@ static void scc (ir_node *n) {
pop_scc_unmark_visit (n);
/* and recompute it in a better order; and so that it goes into
the new loop. */
// GL @@@ remove experimental stuff rem = find_irg_on_stack(tail);
/* GL @@@ remove experimental stuff rem = find_irg_on_stack(tail); */
scc (tail);
// GL @@@ remove experimental stuff current_ir_graph = rem;
/* GL @@@ remove experimental stuff current_ir_graph = rem; */
assert (irn_visited(n));
#if NO_LOOPS_WITHOUT_HEAD
......
......@@ -95,7 +95,7 @@ static type *find_type_for_Proj(ir_node *n) {
tp = find_pointer_type_to(get_glob_type());
else if (get_Proj_proj(n) == pns_value_arg_base) {
VERBOSE_UNKNOWN_TYPE(("Value arg base proj %ld from Start: unknown type\n", get_irn_node_nr(n)));
tp = unknown_type; //find_pointer_type_to(get....(get_entity_type(get_irg_ent(get_Start_irg(pred)))));
tp = unknown_type; /* find_pointer_type_to(get....(get_entity_type(get_irg_ent(get_Start_irg(pred))))); */
} else {
VERBOSE_UNKNOWN_TYPE(("Proj %ld %ld from Start: unknown type\n", get_Proj_proj(n), get_irn_node_nr(n)));
tp = unknown_type;
......@@ -105,7 +105,7 @@ static type *find_type_for_Proj(ir_node *n) {
/* value args pointer */
if (get_Proj_proj(n) == pncl_value_res_base) {
VERBOSE_UNKNOWN_TYPE(("Value res base Proj %ld from Call: unknown type\n", get_irn_node_nr(n)));
tp = unknown_type; //find_pointer_type_to(get....get_Call_type(pred));
tp = unknown_type; /* find_pointer_type_to(get....get_Call_type(pred)); */
} else {
VERBOSE_UNKNOWN_TYPE(("Proj %ld %ld from Call: unknown type\n", get_Proj_proj(n), get_irn_node_nr(n)));
tp = unknown_type;
......@@ -123,7 +123,7 @@ static type *find_type_for_node(ir_node *n) {
type *tp1 = NULL, *tp2 = NULL;
ir_node *a = NULL, *b = NULL;
//DDMN(n);
/* DDMN(n); */
if (is_unop(n)) {
a = get_unop_op(n);
......@@ -153,8 +153,8 @@ static type *find_type_for_node(ir_node *n) {
type *ana_res_type = get_irn_type(get_Return_res(n, i));
if (ana_res_type == unknown_type) continue;
if (res_type != ana_res_type && "return value has wrong type") {
DDMN(n);
assert(res_type == ana_res_type && "return value has wrong type");
DDMN(n);
assert(res_type == ana_res_type && "return value has wrong type");
}
}
*/
......@@ -206,7 +206,7 @@ static type *find_type_for_node(ir_node *n) {
tp1 = compute_irn_type(get_Phi_pred(n, i));
assert(tp1 != initial_type);
if ((tp1 != phi_cycle_type) && (tp1 != none_type))
break;
break;
}
/* find a second real type */
......@@ -214,18 +214,18 @@ static type *find_type_for_node(ir_node *n) {
for (; (i < n_preds); ++i) {
tp2 = compute_irn_type(get_Phi_pred(n, i));
if ((tp2 == phi_cycle_type) || (tp2 == none_type)) {
tp2 = tp1;
continue;
tp2 = tp1;
continue;
}
if (tp2 != tp1) break;
}
//printf("Types in Phi %s and %s \n", get_type_name(tp1), get_type_name(tp2));
/* printf("Types in Phi %s and %s \n", get_type_name(tp1), get_type_name(tp2)); */
if (tp1 == tp2) { tp = tp1; break; }
VERBOSE_UNKNOWN_TYPE(("Phi %ld with two different types: %s, %s: unknown type.\n", get_irn_node_nr(n),
get_type_name(tp1), get_type_name(tp2)));
get_type_name(tp1), get_type_name(tp2)));
tp = unknown_type;
} break;
case iro_Load: {
......@@ -233,7 +233,7 @@ static type *find_type_for_node(ir_node *n) {
if (intern_get_irn_op(a) == op_Sel)
tp = get_entity_type(get_Sel_entity(a));
else if ((intern_get_irn_op(a) == op_Const) &&
(tarval_is_entity(get_Const_tarval(a))))
(tarval_is_entity(get_Const_tarval(a))))
tp = get_entity_type(tarval_to_entity(get_Const_tarval(a)));
else if (is_pointer_type(compute_irn_type(a))) {
tp = get_pointer_points_to_type(get_irn_type(a));
......@@ -257,21 +257,21 @@ static type *find_type_for_node(ir_node *n) {
/* catch special cases with fallthrough to binop/unop cases in default. */
case iro_Sub: {
if (mode_is_int(intern_get_irn_mode(n)) &&
mode_is_reference(intern_get_irn_mode(a)) &&
mode_is_reference(intern_get_irn_mode(b)) ) {
mode_is_reference(intern_get_irn_mode(a)) &&
mode_is_reference(intern_get_irn_mode(b)) ) {
VERBOSE_UNKNOWN_TYPE(("Sub %ld ptr - ptr = int: unknown type\n", get_irn_node_nr(n)));
tp = unknown_type; break;
}
} /* fall through to Add. */
case iro_Add: {
if (mode_is_reference(intern_get_irn_mode(n)) &&
mode_is_reference(intern_get_irn_mode(a)) &&
mode_is_int(intern_get_irn_mode(b)) ) {
mode_is_reference(intern_get_irn_mode(a)) &&
mode_is_int(intern_get_irn_mode(b)) ) {
tp = tp1; break;
}
if (mode_is_reference(intern_get_irn_mode(n)) &&
mode_is_int(intern_get_irn_mode(a)) &&
mode_is_reference(intern_get_irn_mode(b)) ) {
mode_is_int(intern_get_irn_mode(a)) &&
mode_is_reference(intern_get_irn_mode(b)) ) {
tp = tp2; break;
}
goto default_code;
......@@ -295,15 +295,15 @@ static type *find_type_for_node(ir_node *n) {
if (is_binop(n)) {
if (tp1 == tp2) {
tp = tp1;
break;
tp = tp1;
break;
}
if((tp1 == phi_cycle_type) || (tp2 == phi_cycle_type)) {
tp = phi_cycle_type;
break;
tp = phi_cycle_type;
break;
}
VERBOSE_UNKNOWN_TYPE(("Binop %ld with two different types: %s, %s: unknown type \n", get_irn_node_nr(n),
get_type_name(tp1), get_type_name(tp2)));
get_type_name(tp1), get_type_name(tp2)));
tp = unknown_type;
break;
}
......@@ -312,14 +312,14 @@ static type *find_type_for_node(ir_node *n) {
} break; /* default */
} /* end switch */
//printf (" found %s ", get_type_name(tp)); DDM;
/* printf (" found %s ", get_type_name(tp)); DDM; */
return tp;
}
static type* compute_irn_type(ir_node *n) {
//DDMN(n);
/* DDMN(n); */
type *tp = get_irn_type(n);
......@@ -328,7 +328,7 @@ static type* compute_irn_type(ir_node *n) {
set_irn_type(n, tp);
}
//printf (" found %s ", get_type_name(tp)); DDM;
/* printf (" found %s ", get_type_name(tp)); DDM; */
return tp;
}
......@@ -337,7 +337,7 @@ static void compute_type(ir_node *n, void *env) {
type *tp = get_irn_type(n);
if (tp == phi_cycle_type) {
//printf(" recomputing for phi_cycle_type "); DDMN(n);
/* printf(" recomputing for phi_cycle_type "); DDMN(n); */
set_irn_type(n, initial_type);
}
......
......@@ -65,6 +65,6 @@ void free_simple_type_information(void);
* Not yet implemented, but I guess we want this for iropt, to find the
* type for newly allocated constants.
*/
//type *analyse_irn_type(ir_node *node);
/* type *analyse_irn_type(ir_node *node); */
#endif /* _IRSIMPLETYPE_H_ */
......@@ -45,13 +45,13 @@ typedef struct {
get_firm_walk_link. */
} fw_data;
//@{
/*@{ */
/** Access macros to fw_data structure */
#define FW_GET_DATA_LIST(s) ((s)->list)
#define FW_SET_DATA_LIST(s, t) ((s)->list = (t))
#define FW_GET_DATA_LINK(s) ((s)->link)
#define FW_SET_DATA_LINK(s, t) ((s)->link = (t))
//@}
/*@} */
/** Returns own data struct of the firm walker.
*
......@@ -97,7 +97,7 @@ fw_data *fw_get_data(void *thing)
}
}
break;
default: {} // other kinds of firm nodes
default: {} /* other kinds of firm nodes */
}
return data;
......@@ -135,11 +135,11 @@ void fw_free_data(void *thing)
}
}
break;
default: {} // other kinds of firm nodes
default: {} /* other kinds of firm nodes */
}
}
// documentation in header file
/* documentation in header file */
void set_firm_walk_link(void *thing, void *link)
{
fw_data *data;
......@@ -168,11 +168,11 @@ void set_firm_walk_link(void *thing, void *link)
case k_ir_mode:
set_mode_link(thing, link);
break;
default: {} // other kinds of firm nodes
default: {} /* other kinds of firm nodes */
}
}
// documentation in header file
/* documentation in header file */
void *get_firm_walk_link(void *thing)
{
fw_data *data;
......@@ -227,7 +227,7 @@ void fw_collect_tore(type_or_ent *tore, void *env)
switch (get_kind(tore)) {
case k_entity:
ent = (entity *)tore;
// append entity to list
/* append entity to list */
set_entity_link(ent, NULL);
if (!pmap_contains(entity_map, ent))
pmap_insert(entity_map, ent, env);
......@@ -235,7 +235,7 @@ void fw_collect_tore(type_or_ent *tore, void *env)
case k_type:
tp = (type *)tore;
mode = get_type_mode(tp);
// append type to list
/* append type to list */
set_type_link(tp, NULL);
if (!pmap_contains(type_map, tp))
pmap_insert(type_map, tp, env);
......@@ -345,11 +345,11 @@ void firm_walk_init(firm_walk_flags flags)
pmap_insert(mode_map, mode_b, NULL);
*/
// Collect all types (also unused types) if flag is set
/* Collect all types (also unused types) if flag is set */
if (FW_WITH_ALL_TYPES & flags)
type_walk(fw_collect_tore, NULL, NULL);
// for each ir graph
/* for each ir graph */
for (i = 0; i < get_irp_n_irgs(); i++)
{
ir_graph *irg = get_irp_irg(i);
......@@ -375,7 +375,7 @@ void firm_walk_finalize(void)
pmap_destroy(entity_map);
entity_map = NULL;
// free all collected data from ir graphs and nodes
/* free all collected data from ir graphs and nodes */
for (i = 0; i < get_irp_n_irgs(); i++)
{
ir_graph *irg = get_irp_irg(i);
......@@ -464,12 +464,12 @@ void firm_walk(firm_walk_interface *wif)
irn_list = FW_GET_DATA_LIST(data);
irn_list_len = ARR_LEN(irn_list);
// call block as prefix ir node
/* call block as prefix ir node */
if ((wif->do_node) &&
(wif->flags & FW_DUMP_BLOCK_AS_IRN & !FW_DUMP_IRN_IN_PREFIX))
wif->do_node(block, wif->env);
// do ir nodes in prefix or postfix order?
/* do ir nodes in prefix or postfix order? */
if (wif->flags & FW_DUMP_IRN_IN_PREFIX)
irn_i = irn_list_len-1;
else
......@@ -479,13 +479,13 @@ void firm_walk(firm_walk_interface *wif)
{
if (wif->do_node) wif->do_node((ir_node *)irn_list[irn_i], wif->env);
// do ir nodes in prefix or postfix order?
/* do ir nodes in prefix or postfix order? */
if (wif->flags & FW_DUMP_IRN_IN_PREFIX)
irn_i--;
else
irn_i++;
}
// call block as postfix ir node
/* call block as postfix ir node */
if ((wif->do_node) &&
(wif->flags & (FW_DUMP_BLOCK_AS_IRN | FW_DUMP_IRN_IN_PREFIX)))
wif->do_node(block, wif->env);
......@@ -493,11 +493,11 @@ void firm_walk(firm_walk_interface *wif)
/* wall over all block's ir nodes nested end =============== */
if (wif->do_block_finalize) wif->do_block_finalize(current_ir_graph, wif->env);
} // for each block
} /* for each block */
/* walk over all irg's block nested end ====================== */
} // for each ir graph irg
} /* for each ir graph irg */
if (wif->do_graph_finalize) wif->do_graph_finalize(wif->env);
/** ### ToDo: Dump const_code_irg ?? No! Dump const code with entities, types etc. */
......
......@@ -79,12 +79,12 @@ typedef void firm_walk_type_func(type *tp, void *env);
typedef void firm_walk_entity_func(entity *ent, void *env);
/** Graph callback function definition */
typedef void firm_walk_graph_func(ir_graph *irg, void *env);
//@{
/* @{ */
/** Block callback function definition */
typedef void firm_walk_block_init_func(ir_graph *irg, void *env);
typedef void firm_walk_block_func(ir_node *block, void *env);
typedef void firm_walk_block_finalize_func(ir_graph *irg, void *env);
//@}
/* @} */
/** Node callback function definition */
typedef void firm_walk_node_func (ir_node *irn, void *env);