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 
28 /* Name : print.c
29  * Package : prgm_mapping
30  * Author : Alexis Platonoff
31  * Date : septembre 1993
32  *
33  * Historic :
34  * - 23 sept 93, creation, AP
35  *
36  * Documents:
37  * Comments : This file contains the functions used for printing the data
38  * structures used for prgm_mapping.
39  */
40 
41 /* Ansi includes */
42 #include <stdio.h>
43 
44 /* Newgen includes */
45 #include "genC.h"
46 
47 /* C3 includes */
48 #include "boolean.h"
49 #include "arithmetique.h"
50 #include "vecteur.h"
51 #include "contrainte.h"
52 #include "ray_dte.h"
53 #include "sommet.h"
54 #include "sg.h"
55 #include "sc.h"
56 #include "polyedre.h"
57 #include "union.h"
58 #include "matrice.h"
59 #include "matrix.h"
60 
61 /* Pips includes */
62 #include "ri.h"
63 #include "ri-util.h"
64 #include "constants.h"
65 #include "misc.h"
66 #include "graph.h"
67 #include "paf_ri.h"
68 #include "text.h"
69 #include "text-util.h"
70 #include "misc.h"
71 #include "paf-util.h"
72 
73 /* Macro functions */
74 
75 /* Global variables */
76 
77 /* Internal variables */
78 
79 /* Local defines */
82 
83 
84 /* ======================================================================== */
85 void fprint_plc(fp, obj)
86 FILE *fp;
87 plc obj;
88 {
89  placement func;
90  list funcs, dims, d;
91  int stmt;
92 
93  fprintf(fp, "\nPROGRAM MAPPING :\n================= \n");
94 
95  for(funcs = plc_placements(obj); funcs != NIL; funcs = CDR(funcs)) {
96  func = PLACEMENT(CAR(funcs));
97  stmt = placement_statement(func);
98  dims = placement_dims(func);
99 
100  /* Mod by AP, oct 6th 95: the number of the instruction is the
101  vertex number minus BASE_NODE_NUMBER. */
102  fprintf(fp, "Ins_%d :", stmt-BASE_NODE_NUMBER);
103 
104  for(d = dims; d != NIL; d = CDR(d)) {
106  fprintf(fp, "%s", expression_to_string(exp));
107  if(CDR(d) == NIL)
108  fprintf(fp, "\n");
109  else
110  fprintf(fp, " , ");
111  }
112  }
113  fprintf(fp, "\n");
114 }
115 
116 
117 /* ======================================================================== */
119 FILE *fp;
120 graph g;
122 {
123 
124  list l;
125 
126  /* For each node of the data flow graph we print its prototype. */
127  for(l = graph_vertices(g); l != NIL; l = CDR(l))
128  {
129  vertex v = VERTEX(CAR(l));
131 
132  Ppolynome pp_proto = (Ppolynome) hash_get(StmtToProto, (char *) stmt);
133 
134  /* Print */
135  fprintf(fp, "ins_%d: ", stmt);
137  fprintf(fp, "\n");
138  }
139 }
140 
141 
142 /* ======================================================================== */
144 FILE *fp;
145 graph g;
147 {
148  Ppolynome pp_dist;
149  list l, su_l, df_l;
150 
151  for(l = graph_vertices(g); l != NIL; l = CDR(l)) {
152  vertex v = VERTEX(CAR(l));
153 
154  fprintf(fp, "source stmt: %d\n", vertex_int_stmt(v));
155 
156  su_l = vertex_successors(v);
157 
158  for( ; su_l != NIL; su_l = CDR(su_l)) {
159  successor su = SUCCESSOR(CAR(su_l));
161 
163 
164  for( ; df_l != NIL; df_l = CDR(df_l)) {
165  dataflow df = DATAFLOW(CAR(df_l));
166 
167  fprint_dataflow(fp, sink_stmt, df);
168 
169  pp_dist = (Ppolynome) hash_get(DtfToDist, (char *) df);
170 
171  fprintf(fp, "DF Dist:");
173  fprintf(fp, "\n");
174  }
175  }
176  }
177 }
178 
179 
180 /* ======================================================================== */
181 void plc_fprint_dfs(fp, df_l, DtfToStmt, DtfToWgh)
182 FILE *fp;
183 list df_l;
184 hash_table DtfToWgh, DtfToStmt;
185 {
186  list l = df_l;
187 
188  fprintf(fp, "Listes triee des flots de donnees :\n");
189 
190  for( ; l != NIL; l = CDR(l))
191  {
192  dataflow df = DATAFLOW(CAR(l));
193  fprintf(fp, "Poids %d ***", (int) hash_get(DtfToWgh, (char *) df));
194  fprint_dataflow(fp, (int) hash_get(DtfToStmt, (char *) df), df);
195  }
196  fprintf(fp, "\n");
197 }
198 
199 
200 /* ======================================================================== */
201 /*
202  * void fprint_pla_pp_dims(fp, one_placement)
203  */
204 void fprint_pla_pp_dims(fp, one_placement)
205 FILE *fp;
206 placement one_placement;
207 {
208  list plc_dims = placement_dims(one_placement);
209  int count = 1;
210 
211  fprintf(fp, "\nBroadcast Mapping for %d :\n",
212  placement_statement(one_placement));
213 
214  for(; !ENDP(plc_dims); POP(plc_dims), count++) {
215  Ppolynome crt_pp = (Ppolynome) CHUNK(CAR(plc_dims));
216 
217  fprintf(fp, "Dim %d :", count);
219  fprintf(fp, "\n");
220  }
221 }
222 
223 
224 /* ======================================================================== */
225 /*
226  * void fprint_plc_pp_dims(fp, one_plc)
227  */
228 void fprint_plc_pp_dims(fp, one_plc)
229 FILE *fp;
230 plc one_plc;
231 {
232  list pla_l = plc_placements(one_plc);
233 
234  fprintf(fp, "\nBROADCAST PROGRAM MAPPING :\n===========================\n");
235 
236  for(; !ENDP(pla_l); POP(pla_l)) {
237  placement crt_pla = PLACEMENT(CAR(pla_l));
238  fprint_pla_pp_dims(fp, crt_pla);
239  }
240 }
241 
static int count
Definition: SDG.c:519
static int sink_stmt
Current source node.
Definition: adg_read_paf.c:160
#define CHUNK(x)
Definition: genC.h:90
#define successor_vertex(x)
Definition: graph.h:118
#define successor_arc_label(x)
Definition: graph.h:116
#define vertex_vertex_label(x)
Definition: graph.h:152
#define vertex_successors(x)
Definition: graph.h:154
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define graph_vertices(x)
Definition: graph.h:82
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
#define BASE_NODE_NUMBER
dfg_arc_label arc_label
Name : print.c Package : paf-util Author : Alexis Platonoff Date : july 1993.
Definition: print.c:71
bool pu_is_inferior_var(Variable v1 __attribute__((unused)), Variable v2 __attribute__((unused)))
===========================================================================
Definition: print.c:432
dfg_vertex_label vertex_label
Definition: print.c:72
void fprint_dataflow(FILE *fp, int stmt, dataflow df)
===========================================================================
Definition: print.c:229
const char * pu_variable_name(Variable v)
package mapping : Alexis Platonoff, april 1993
Definition: print.c:421
int vertex_int_stmt(vertex)
===========================================================================
Definition: utils.c:866
#define plc_placements(x)
Definition: paf_ri.h:557
#define DATAFLOW(x)
DATAFLOW.
Definition: paf_ri.h:308
#define placement_dims(x)
Definition: paf_ri.h:525
#define dfg_arc_label_dataflows(x)
Definition: paf_ri.h:378
#define PLACEMENT(x)
PLACEMENT.
Definition: paf_ri.h:493
#define dfg_vertex_label_statement(x)
Definition: paf_ri.h:413
#define placement_statement(x)
Definition: paf_ri.h:523
void polynome_fprint(FILE *fd, Ppolynome pp, char *(*variable_name)(Variable), int *is_inferior_var)
void polynome_fprint(FILE* fd, Ppolynome pp, char* (*variable_name)(), bool (*is_inferior_var)()) Out...
Definition: pnome-io.c:173
struct Spolynome * Ppolynome
string expression_to_string(expression e)
Definition: expression.c:77
void fprint_plc(FILE *fp, plc obj)
========================================================================
Definition: print.c:85
void plc_fprint_dfs(FILE *fp, list df_l, hash_table DtfToStmt, hash_table DtfToWgh)
========================================================================
Definition: print.c:181
void fprint_pla_pp_dims(FILE *fp, placement one_placement)
========================================================================
Definition: print.c:204
void plc_fprint_distance(FILE *fp, graph g, hash_table DtfToDist)
========================================================================
Definition: print.c:143
void plc_fprint_proto(FILE *fp, graph g, hash_table StmtToProto)
========================================================================
Definition: print.c:118
void fprint_plc_pp_dims(FILE *fp, plc one_plc)
========================================================================
Definition: print.c:228
hash_table DtfToDist
Mapping from a dataflow to its sink statement.
Definition: prgm_mapping.c:104
hash_table DtfToWgh
Mapping from a dataflow to its distance.
Definition: prgm_mapping.c:105
hash_table StmtToProto
Mapping from a dataflow to its weight.
Definition: prgm_mapping.c:106
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: statement.c:54
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207