PIPS
print.c
Go to the documentation of this file.
1 /*
2 
3  $Id: print.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 /* functions to print a call graph
28  *
29  * They should be called by pipsmake
30  *
31  * Lei Zhou, February 91
32  * Modification:
33  * - Callgraph prints only callees, nothing else.
34  * January 93
35  * - GO: Decoration of callgraphs, with some analyze results
36  * June 95
37  *
38  */
39 #include <stdio.h>
40 #include <string.h>
41 
42 #include "linear.h"
43 #include "genC.h"
44 #include "misc.h"
45 
46 #include "ri.h"
47 #include "ri-util.h"
48 
49 #include "callgraph.h"
50 
51 /** Print callees for debugging purpose */
53 {
54  list l = callees_callees(c);
55 
56  MAP(STRING, mn, {
57  printf("%s\n", mn);
58  }, l);
59 }
60 
61 /*
62  * This function prints out any graph that contains callees only
63  */
65  const string module_name,
66  text (*module_to_text)(const string))
67 {
68  bool success = false;
70 
72  pips_debug(1, "===%s===\n", module_name);
73  success = module_to_callgraph(mod, module_to_text);
74  debug_off();
75 
76  return success;
77 }
78 
79 /*
80  * Print callgraph with no decoration
81  */
82 bool print_call_graph(const string module_name)
83 {
84  bool success = false;
86  return success;
87 }
#define CALLGRAPH_DEBUG_LEVEL
void print_callees(callees c)
functions to print a call graph
Definition: print.c:52
bool print_decorated_call_graph(const string module_name, text(*module_to_text)(const string))
Definition: print.c:64
bool print_call_graph(const string module_name)
Definition: print.c:82
bool module_to_callgraph(entity module, text(*module_to_text)(const string))
Definition: callgraph.c:270
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
#define STRING(x)
Definition: genC.h:87
bool success
Definition: gpips-local.h:59
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define debug_off()
Definition: misc-local.h:160
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
#define callees_callees(x)
Definition: ri.h:675
int printf()
The structure used to build lists in NewGen.
Definition: newgen_list.h:41