PIPS
prettyprint.c
Go to the documentation of this file.
1 /*
2 
3  $Id: prettyprint.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6  Copyright 2010 HPC Project
7 
8  This file is part of PIPS.
9 
10  PIPS is free software: you can redistribute it and/or modify it
11  under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  any later version.
14 
15  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
16  WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  FITNESS FOR A PARTICULAR PURPOSE.
18 
19  See the GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
23 */
24 
25 #ifdef HAVE_CONFIG_H
26  #include "pips_config.h"
27 #endif
28 
29 #include <stdio.h>
30 #include <string.h>
31 
32 #include "genC.h"
33 #include "misc.h"
34 #include "linear.h"
35 #include "ri.h"
36 #include "ri-util.h"
37 #include "effects.h"
38 #include "effects-util.h"
39 #include "pipsdbm.h"
40 #include "text.h"
41 #include "text-util.h"
42 #include "prettyprint.h"
43 
44 #include "pointer_values.h"
45 
46 text text_pv(entity __attribute__ ((unused)) module, int __attribute__ ((unused)) margin, statement s)
47 {
49 
50  return(text_pointer_values(lpv, "Pointer values:"));
51 }
52 
54 {
55  bool success;
56 
58  db_get_memory_resource(DBR_CODE, module_name, true));
60 
62 
63  list l_in = (*ctxt->db_get_in_pv_func)(module_name);
64  list l_out = (*ctxt->db_get_in_pv_func)(module_name);
65 
67  text t = make_text(NIL);
68  MERGE_TEXTS(t, text_pointer_values(l_in, "IN Pointer values:"));
69  MERGE_TEXTS(t, text_pointer_values(l_out, "OUT Pointer values:"));
72  success = make_text_resource_and_free(module_name, DBR_PRINTED_FILE, ".pv", t);
74 
77  reset_pv();
78  return success;
79 }
80 
81 
83 {
86  reset_pv_context(&ctxt);
87  return success;
88 }
89 
91 {
93 }
94 
96 {
99  reset_pv_context(&ctxt);
100  return(true);
101 }
text make_text(list a)
Definition: text.c:107
text text_pointer_values(list lpv, string header)
Definition: prettyprint.c:571
#define cell_relations_list(x)
Definition: effects.h:549
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
bool success
Definition: gpips-local.h:59
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
static char * module
Definition: pips.c:74
void generic_print_code_gen_kill_pv(char *module_name)
Definition: prettyprint.c:90
text text_pv(entity __attribute__((unused)) module, int __attribute__((unused)) margin, statement s)
Definition: prettyprint.c:46
bool print_code_simple_pointer_values(char *module_name)
Definition: prettyprint.c:82
bool print_code_simple_gen_kill_pointer_values(char *module_name)
Definition: prettyprint.c:95
bool generic_print_code_pv(char *module_name, pv_context *ctxt)
Definition: prettyprint.c:53
pv_context make_simple_pv_context(void)
void set_pv(statement_cell_relations)
cell_relations load_pv(statement)
void reset_pv_context(pv_context *)
void reset_pv(void)
void close_prettyprint()
because some prettyprint functions may be used for debug, so the last hook set by somebody may have s...
Definition: misc.c:242
void init_prettyprint(text(*hook)(entity, int, statement))
checks that the prettyprint hook was actually reset...
Definition: misc.c:231
text text_module(entity, statement)
bool make_text_resource_and_free(const char *, const char *, const char *, text)
Definition: print.c:82
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
static bool __attribute__((unused))
Definition: prettyprint.c:435
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
pv_context is a structure holding the methods to use during pointer values analyses
list(* db_get_in_pv_func)(const char *)
statement_cell_relations(* db_get_pv_func)(const char *)
set to true for an initial module analysis
#define MERGE_TEXTS(r, t)