From 63eda4e17ebee2a6ab7520d0559ddac0223607d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Fri, 15 Apr 2005 12:24:34 +0000 Subject: [PATCH] Changed comments, removed compiler warnings, removed debug outputs. [r5701] --- firmjni/Makefile.in | 2 +- ir/adt/pset.h | 12 ++++++------ ir/ana/irscc.c | 1 - ir/ana/trouts.h | 27 ++++++++++++++++----------- ir/ir/ircgcons.h | 2 +- ir/ir/irnode.h | 6 +++++- ir/opt/funccall.h | 6 ++++-- ir/opt/ldstopt.c | 24 ++++++++++++++++++------ ir/stat/stat_dmp.c | 2 +- 9 files changed, 52 insertions(+), 30 deletions(-) diff --git a/firmjni/Makefile.in b/firmjni/Makefile.in index 2c2fb7337..62a0af8ec 100644 --- a/firmjni/Makefile.in +++ b/firmjni/Makefile.in @@ -1,4 +1,4 @@ - +# # Project: libFIRM # File name: firmjni/Makefile.in # Purpose: diff --git a/ir/adt/pset.h b/ir/adt/pset.h index 10549e815..4b95fe881 100644 --- a/ir/adt/pset.h +++ b/ir/adt/pset.h @@ -39,13 +39,13 @@ typedef struct pset pset; /* * Define some convenience macros using the predefined hash function. */ -#define pset_insert_ptr(set,key) pset_insert(set, key, HASH_PTR(key)) +#define pset_insert_ptr(set,key) pset_insert(set, key, HASH_PTR(key)) #define pset_hinsert_ptr(set,key) pset_hinsert(set, key, HASH_PTR(key)) -#define pset_remove_ptr(set,key) pset_remove(set, key, HASH_PTR(key)) -#define pset_find_ptr(set,key) pset_find(set, key, HASH_PTR(key)) -#define pset_new_ptr(slots) new_pset(pset_default_ptr_cmp, slots) -#define pset_new_ptr_default() pset_new_ptr(64) -void pset_insert_pset_ptr(pset *target, pset *src); /* Insertss all elements of src in target. */ +#define pset_remove_ptr(set,key) pset_remove(set, key, HASH_PTR(key)) +#define pset_find_ptr(set,key) pset_find(set, key, HASH_PTR(key)) +#define pset_new_ptr(slots) new_pset(pset_default_ptr_cmp, slots) +#define pset_new_ptr_default() pset_new_ptr(64) +void pset_insert_pset_ptr(pset *target, pset *src); /* Inserts all elements of src in target. */ /** The entry of a pset, representing an element pointer in the set and it's meta-information */ diff --git a/ir/ana/irscc.c b/ir/ana/irscc.c index 33dd08fd8..2ebd79099 100644 --- a/ir/ana/irscc.c +++ b/ir/ana/irscc.c @@ -916,7 +916,6 @@ is_outermost_loop(ir_loop *l) { * The core algorithm. * *-----------------------------------------------------------*/ - static void scc (ir_node *n) { int i; if (irn_visited(n)) return; diff --git a/ir/ana/trouts.h b/ir/ana/trouts.h index 3fc8585bf..c04775863 100644 --- a/ir/ana/trouts.h +++ b/ir/ana/trouts.h @@ -35,20 +35,21 @@ #include "entity.h" #include "irnode.h" +/*-----------------------------------------------------------------*/ +/* Accessing the trout datastructures. */ +/* These routines only work properly if firm is in state */ +/* trouts_consistent or trouts_inconsistent. */ +/*-----------------------------------------------------------------*/ -/*------------------------------------------------------------------*/ -/* Accessing the trout datastructures. */ -/* These routines only work properly if firm is in state */ -/* trouts_consistent or trouts_inconsistent. */ -/*------------------------------------------------------------------*/ - +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* entities */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /** Number of Load/Store nodes that possibly access this entity. */ int get_entity_n_accesses(entity *ent); /** Load/Store node that possibly access this entity. */ ir_node *get_entity_access(entity *ent, int pos); - /** Number of references to an entity, in form of SymConst/Sel. * Including references from constant entities and the like. */ int get_entity_n_references(entity *ent); @@ -56,6 +57,9 @@ int get_entity_n_references(entity *ent); * Including references from constants. */ ir_node *get_entity_reference(entity *ent, int pos); +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* types */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /** Number of Alloc nodes that create an instance of this type. */ int get_type_n_allocs(type *tp); @@ -72,9 +76,10 @@ int get_class_n_upcasts(type *clss); int get_class_n_downcasts(type *clss); /* Access all pointer types that point to tp. */ -int get_type_n_pointertypes_to(type *tp); +int get_type_n_pointertypes_to(type *tp); type *get_type_pointertype_to(type *tp, int pos); +/* @@@ TODO: compute all entities that use a type. */ /*------------------------------------------------------------------*/ /* Building and Removing the trout datastructure */ @@ -82,7 +87,8 @@ type *get_type_pointertype_to(type *tp, int pos); /** The state of the tr_out datastructure. * - * We reuse the enum of irouts. */ + * We reuse the enum of irouts. + * @see irouts.h. */ irg_outs_state get_trouts_state(void); void set_trouts_inconsistent(void); @@ -107,8 +113,7 @@ void set_trouts_inconsistent(void); * type --> entity of this type. @@@ to be implemented. * * Sets trout state to outs_consistent. - * - * @todo @@@ We need a flag that signs the consistency of the out information. */ + */ void compute_trouts(void); /** Free trout data. */ diff --git a/ir/ir/ircgcons.h b/ir/ir/ircgcons.h index d4f6e2d32..84c195f3b 100644 --- a/ir/ir/ircgcons.h +++ b/ir/ir/ircgcons.h @@ -24,7 +24,7 @@ */ typedef enum { ip_view_no, /**< The interprocedural view is not constructed. There are no - view specific nodes (EndReg, Filter....) in any graph. */ + view specific nodes (EndReg, Filter, Break ...) in any graph. */ ip_view_valid, /**< The interprocedural view is valid. */ ip_view_invalid /**< The interprocedural view is invalid. Specific nodes are all still in the representation, but the graph is no more complete. */ diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index c00e98274..13e393dac 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -999,7 +999,11 @@ void dump_irn(ir_node *n); /** Output the firm kind of the node */ #define DDMK(X) printf("%s(l.%i) %s: %p\n", __MYFUNC__, __LINE__, print_firm_kind(X), (void *)(X)); /** Output information about a node */ -#define DDMN(X) printf("%s(l.%i) %s%s: %ld (%p)\n", __MYFUNC__, __LINE__, get_irn_opname(X), get_mode_name(get_irn_mode(X)), get_irn_node_nr(X), (void *)(X)) + +/*#define DDMN(X) printf("%s(l.%i) %s%s: %ld (%p)\n", __MYFUNC__, __LINE__, get_irn_opname(X), get_mode_name(get_irn_mode(X)), get_irn_node_nr(X), (void *)(X))*/ +int dump_node_opcode(FILE *F, ir_node *n); +#define DDMN(X) do { printf("%s(l.%i) ", __MYFUNC__, __LINE__); dump_node_opcode(stdout, X); printf(": %ld (%p)\n", get_irn_node_nr(X), (void *)(X)); } while (0) + /** Output information about a node and its block */ #define DDMNB(X) printf("%s%s: %ld (in block %ld)\n", get_irn_opname(X), get_mode_name(get_irn_mode(X)), get_irn_node_nr(X), get_irn_node_nr(get_nodes_block(X))) /** Output information about a type */ diff --git a/ir/opt/funccall.h b/ir/opt/funccall.h index 3d11eb7e7..c5c709f32 100644 --- a/ir/opt/funccall.h +++ b/ir/opt/funccall.h @@ -22,18 +22,20 @@ /** * Optimize function calls by handling real functions. * - * This optimization first detects all "real fucntions", ie + * This optimization first detects all "real functions", i.e., * IR graphs that neither read nor write memory (and hence did * not create exceptions, as these use memory in Firm). * * The result of calls to such functions depends only on its - * arguments, hence those calls are not anymore pinned. + * arguments, hence those calls are no more pinned. * * This is a rather strong criteria, so do not expect that a * lot of functions will be found. Moreover, all of them might * already be inlined if inlining is activated. * Anyway, it might be good for handling builtin's or pseudo-graphs, * even if the later read/write memory (but we know how). + * + * If callee information is valid, we also optimize polymorphic Calls. */ void optimize_funccalls(void); diff --git a/ir/opt/ldstopt.c b/ir/opt/ldstopt.c index e1ec07ad3..663ff5fd3 100644 --- a/ir/opt/ldstopt.c +++ b/ir/opt/ldstopt.c @@ -315,7 +315,7 @@ static compound_graph_path *rec_get_accessed_path(ir_node *ptr, int depth) { if (get_irn_op(ptr) == op_SymConst) { assert(get_SymConst_kind(ptr) == symconst_addr_ent); root = get_SymConst_entity(ptr); - res = depth == 0 ? NULL : new_compound_graph_path(get_entity_type(root), depth); + res = (depth == 0) ? NULL : new_compound_graph_path(get_entity_type(root), depth); } else { assert(get_irn_op(ptr) == op_Sel); @@ -466,12 +466,12 @@ static int optimize_load(ir_node *load) } else if (variability_constant == get_entity_variability(ent)) { compound_graph_path *path; - + /* printf(">>>>>>>>>>>>> Found access to constant entity %s in function %s\n", get_entity_name(ent), get_entity_name(get_irg_entity(current_ir_graph))); printf(" load: "); DDMN(load); printf(" ptr: "); DDMN(ptr); - + */ path = get_accessed_path(ptr); if (path) { ir_node *c; @@ -479,13 +479,13 @@ static int optimize_load(ir_node *load) assert(is_proper_compound_graph_path(path, get_compound_graph_path_length(path)-1)); c = get_compound_ent_value_by_path(ent, path); - printf(" cons: "); DDMN(c); + /* printf(" cons: "); DDMN(c); */ if (info->projs[pn_Load_M]) exchange(info->projs[pn_Load_M], mem); if (info->projs[pn_Load_res]) exchange(info->projs[pn_Load_res], copy_const_value(c)); - + /* { int j; for (j = 0; j < get_compound_graph_path_length(path); ++j) { @@ -496,8 +496,20 @@ static int optimize_load(ir_node *load) } printf("\n"); } - } else + */ + } else { + /* We can not determine a correct access path. E.g., in jack, we load + a byte from an object to generate an exception. Happens in test program + Reflectiontest. + printf(">>>>>>>>>>>>> Found access to constant entity %s in function %s\n", get_entity_name(ent), + get_entity_name(get_irg_entity(current_ir_graph))); + printf(" load: "); DDMN(load); + printf(" ptr: "); DDMN(ptr); + if (get_irn_op(ptr) == op_SymConst && + get_SymConst_kind(ptr) == symconst_addr_ent) { printf(" "); DDMEO(get_SymConst_entity(ptr)); } printf("cannot optimize.\n"); + */ + } } /* we changed the irg, but try further */ diff --git a/ir/stat/stat_dmp.c b/ir/stat/stat_dmp.c index b03bb182a..214088824 100644 --- a/ir/stat/stat_dmp.c +++ b/ir/stat/stat_dmp.c @@ -142,7 +142,7 @@ static void simple_dump_graph(dumper_t *dmp, graph_entry_t *entry) } else { if (entry->ent) - fprintf(dmp->f, "\nEntity %s, Irg %p", get_entity_name(entry->ent), (void *)entry->irg); + fprintf(dmp->f, "\nEntity %s, Irg %p", get_entity_ld_name(entry->ent), (void *)entry->irg); else fprintf(dmp->f, "\nIrg %p", (void *)entry->irg); } -- 2.20.1