diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-11-09 01:50:43 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-11-09 01:50:43 +0200 |
commit | dc1a81526099095b12ef6edb655cf1a773dfa983 (patch) | |
tree | 17defadb706683a3a59ee41428200ee66d91d34b /src/cflow.h | |
parent | 4d75955e833201c4f1d0219d48676521aeee1afa (diff) | |
download | cflow-dc1a81526099095b12ef6edb655cf1a773dfa983.tar.gz cflow-dc1a81526099095b12ef6edb655cf1a773dfa983.tar.bz2 |
Speed-up recursive call detection.
* src/depmap.c: New file.
* src/Makefile.am: Add depmap.c.
* src/cflow.h (struct symbol.ord): New member.
(collect_symbols): Change signature. All callers
updated.
(collect_functions): New proto.
(symbol_is_function): New proto.
(cflow_depmap_t): New data type.
(depmap_alloc, depmap_set)
(depmap_isset, depmap_tc): New prototypes.
* src/output.c (symbol_is_function): New function.
(scan_tree): Remove.
(tree_output): Use depmap to find out recursive calls.
* src/symbol.c (static_func_list): New list.
(static_free): Add static functions to static_func_list.
(collect_symbols): Return size_t. Take additional number
of slots in the 3rd argument.
(collect_functions): New function.
Diffstat (limited to 'src/cflow.h')
-rw-r--r-- | src/cflow.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cflow.h b/src/cflow.h index d933750..2593398 100644 --- a/src/cflow.h +++ b/src/cflow.h @@ -117,6 +117,7 @@ struct symbol { variables */ int recursive; /* Is the function recursive */ + size_t ord; /* ordinal number */ struct linked_list *caller; /* List of callers */ struct linked_list *callee; /* List of callees */ }; @@ -172,7 +173,8 @@ void delete_autos(int level); void delete_statics(void); void delete_parms(int level); void move_parms(int level); -int collect_symbols(Symbol ***, int (*sel)()); +size_t collect_symbols(Symbol ***, int (*sel)(), size_t rescnt); +size_t collect_functions(Symbol ***return_sym); struct linked_list *linked_list_create(linked_list_free_data_fp fun); void linked_list_destroy(struct linked_list **plist); void linked_list_append(struct linked_list **plist, void *data); @@ -198,6 +200,7 @@ void newline(void); void print_level(int lev, int last); int globals_only(void); int include_symbol(Symbol *sym); +int symbol_is_function(Symbol *sym); void sourcerc(int *, char ***); @@ -233,3 +236,9 @@ int posix_output_handler(cflow_output_command cmd, FILE *outfile, int line, void *data, void *handler_data); + +typedef struct cflow_depmap *cflow_depmap_t; +cflow_depmap_t depmap_alloc(size_t count); +void depmap_set(cflow_depmap_t dmap, size_t row, size_t col); +int depmap_isset(cflow_depmap_t dmap, size_t row, size_t col); +void depmap_tc(cflow_depmap_t dmap); |