PIPS
debug-util.c File Reference
#include "defines-local.h"
#include "pipsdbm.h"
#include "workspace-util.h"
#include "prettyprint.h"
+ Include dependency graph for debug-util.c:

Go to the source code of this file.

Functions

void print_align (align a)
 this is a set of functions to help hpfc debugging More...
 
void print_alignment (alignment a)
 
void print_aligns (void)
 
void print_distributes (void)
 
void print_distribute (distribute d)
 
void print_distribution (distribution d)
 
void print_hpf_dir (void)
 
void print_templates (void)
 
void print_processors (void)
 
void print_distributed_arrays (void)
 
void hpfc_print_common (FILE *file, entity module, entity common)
 
void hpfc_print_file (string file_name)
 
void fprint_range (FILE *file, range r)
 
void fprint_lrange (FILE *file, list l)
 
void fprint_message (FILE *file, message m)
 
void fprint_lmessage (FILE *file, list l)
 

Function Documentation

◆ fprint_lmessage()

void fprint_lmessage ( FILE *  file,
list  l 
)
Parameters
fileile

Definition at line 231 of file debug-util.c.

234 {
235  if (ENDP(l))
236  fprintf(file, "message list is empty\n");
237  else
238  MAP(MESSAGE, m, fprint_message(file, m), l);
239 }
void fprint_message(FILE *file, message m)
Definition: debug-util.c:217
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#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 MESSAGE(x)
newgen_message_domain_defined
Definition: message.h:43
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References ENDP, fprint_message(), fprintf(), MAP, and MESSAGE.

Referenced by messages_handling().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fprint_lrange()

void fprint_lrange ( FILE *  file,
list  l 
)
Parameters
fileile

Definition at line 200 of file debug-util.c.

203 {
204  bool firstrange = true;
205 
206  MAP(RANGE, r,
207  {
208  if (!firstrange)
209  (void) fprintf(file, ", ");
210 
211  firstrange = false;
212  fprint_range(file, r);
213  },
214  l);
215 }
void fprint_range(FILE *file, range r)
Definition: debug-util.c:176
#define RANGE(x)
RANGE.
Definition: ri.h:2257

References fprint_range(), fprintf(), MAP, and RANGE.

Referenced by fprint_message().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fprint_message()

void fprint_message ( FILE *  file,
message  m 
)
Parameters
fileile

Definition at line 217 of file debug-util.c.

220 {
221  (void) fprintf(file, "message is array %s(",
223  fprint_lrange(file, message_content(m));
224  (void) fprintf(file, ")\nto\n");
226  (void) fprintf(file, "domain is ");
227  fprint_lrange(file, message_dom(m));
228  (void) fprintf(file, "\n");
229 }
void fprint_lrange(FILE *file, list l)
Definition: debug-util.c:200
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
Definition: io.c:124
char * variable_dump_name(Variable v)
variable_dump_name() returns an unambiguous name for variable v, based on the pointer used to really ...
Definition: variable.c:96
#define message_array(x)
Definition: message.h:75
#define message_dom(x)
Definition: message.h:81
#define message_neighbour(x)
Definition: message.h:79
#define message_content(x)
Definition: message.h:77
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
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89

References entity_local_name(), fprint_lrange(), fprintf(), message_array, message_content, message_dom, message_neighbour, variable_dump_name(), and vect_fprint().

Referenced by atomize_one_message(), and fprint_lmessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fprint_range()

void fprint_range ( FILE *  file,
range  r 
)
Parameters
fileile

Definition at line 176 of file debug-util.c.

179 {
180  int lo, up, in;
181  bool
185 
186  if (blo && bup && bin)
187  {
188  if (in==1)
189  if (lo==up)
190  fprintf(file, "%d", lo);
191  else
192  fprintf(file, "%d:%d", lo, up);
193  else
194  fprintf(file, "%d:%d:%d", lo, up, in);
195  }
196  else
197  fprintf(file, "X");
198 }
bool hpfc_integer_constant_expression_p(expression e, int *pi)
#define range_upper(x)
Definition: ri.h:2290
#define range_increment(x)
Definition: ri.h:2292
#define range_lower(x)
Definition: ri.h:2288

References fprintf(), hpfc_integer_constant_expression_p(), range_increment, range_lower, and range_upper.

Referenced by fprint_lrange().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hpfc_print_common()

void hpfc_print_common ( FILE *  file,
entity  module,
entity  common 
)
Parameters
fileile
moduleodule
commonommon

Definition at line 154 of file debug-util.c.

158 {
159  text t;
160  debug_on("PRETTYPRINT_DEBUG_LEVEL");
161 
162  t = text_common_declaration(common, module);
163  print_text(file, t);
164  free_text(t);
165 
166  debug_off();
167 }
void free_text(text p)
Definition: text.c:74
text text_common_declaration(entity common, entity module)
needed for hpfc
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
static char * module
Definition: pips.c:74
void print_text(FILE *fd, text t)
Definition: print.c:195

References debug_off, debug_on, free_text(), module, print_text(), and text_common_declaration().

Referenced by put_generated_resources_for_common().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hpfc_print_file()

void hpfc_print_file ( string  file_name)
Parameters
file_nameile_name

Definition at line 169 of file debug-util.c.

170 {
171  string dir_name = db_get_current_workspace_directory();
172 
173  safe_system(concatenate("cat ", dir_name, "/", file_name, " >&2", NULL));
174 }
void safe_system(string)
system.c
Definition: system.c:38
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
static string file_name

References concatenate(), db_get_current_workspace_directory(), file_name, and safe_system().

Referenced by put_generated_resources_for_common(), put_generated_resources_for_module(), and put_generated_resources_for_program().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_align()

void print_align ( align  a)

this is a set of functions to help hpfc debugging

debug-util.c

Fabien Coelho, May 1993.

Definition at line 38 of file debug-util.c.

39 {
40  (void) fprintf(stderr, "aligned (%zd dimensions)\n",
43  (void) fprintf(stderr, "to template %s\n\n",
45 }
void print_alignment(alignment a)
Definition: debug-util.c:47
void gen_map(gen_iter_func_t fp, const list l)
Definition: list.c:172
size_t gen_length(const list l)
Definition: list.c:150
#define align_template(x)
Definition: hpf.h:98
#define align_alignment(x)
Definition: hpf.h:96
void(* gen_iter_func_t)(void *)
Definition: newgen_types.h:116
#define entity_name(x)
Definition: ri.h:2790

References align_alignment, align_template, entity_name, fprintf(), gen_length(), gen_map(), and print_alignment().

Referenced by array_synonym_aligned_as(), ComputeNewSizeOfIthDimension(), one_align_directive(), and print_aligns().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_alignment()

void print_alignment ( alignment  a)

Definition at line 47 of file debug-util.c.

48 {
49  (void) fprintf(stderr,
50  "Alignment: arraydim %"PRIdPTR", templatedim %"PRIdPTR",\n",
53 
54  (void) fprintf(stderr,"rate: ");
56  (void) fprintf(stderr,"\nconstant: ");
58  (void) fprintf(stderr,"\n");
59 }
#define alignment_templatedim(x)
Definition: hpf.h:136
#define alignment_constant(x)
Definition: hpf.h:140
#define alignment_rate(x)
Definition: hpf.h:138
#define alignment_arraydim(x)
Definition: hpf.h:134
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58

References alignment_arraydim, alignment_constant, alignment_rate, alignment_templatedim, fprintf(), and print_expression().

Referenced by print_align().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_aligns()

void print_aligns ( void  )

Definition at line 61 of file debug-util.c.

62 {
63  fprintf(stderr,"Aligns:\n");
64  MAP(ENTITY, a,
65  {
66  (void) fprintf(stderr, "of array %s\n", entity_name(a));
68  (void) fprintf(stderr,"\n");
69  },
71 }
void print_align(align a)
this is a set of functions to help hpfc debugging
Definition: debug-util.c:38
align load_hpf_alignment(entity)
list list_of_distributed_arrays(void)
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755

References ENTITY, entity_name, fprintf(), list_of_distributed_arrays(), load_hpf_alignment(), MAP, and print_align().

Referenced by print_hpf_dir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_distribute()

void print_distribute ( distribute  d)

Definition at line 87 of file debug-util.c.

88 {
89  (void) fprintf(stderr,"distributed\n");
90 
92 
93  (void) fprintf(stderr, "to processors %s\n\n",
95 }
void print_distribution(distribution d)
Definition: debug-util.c:97
#define distribute_distribution(x)
Definition: hpf.h:174
#define distribute_processors(x)
Definition: hpf.h:176

References distribute_distribution, distribute_processors, entity_name, fprintf(), gen_map(), and print_distribution().

Referenced by ComputeNewSizeOfIthDimension(), and print_distributes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_distributed_arrays()

void print_distributed_arrays ( void  )

Definition at line 148 of file debug-util.c.

149 {
150  (void) fprintf(stderr,"Distributed Arrays:\n");
152 }
void print_entity_variable(entity e)
print_entity_variable(e)
Definition: entity.c:56

References fprintf(), gen_map(), list_of_distributed_arrays(), and print_entity_variable().

Referenced by print_hpf_dir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_distributes()

void print_distributes ( void  )

Definition at line 73 of file debug-util.c.

74 {
75  fprintf(stderr,"Distributes:\n");
76 
77  MAP(ENTITY, t,
78  {
79  (void) fprintf(stderr, "of template %s\n", entity_name(t));
81  (void) fprintf(stderr,"\n");
82  },
84 
85 }
void print_distribute(distribute d)
Definition: debug-util.c:87
list list_of_templates(void)
distribute load_hpf_distribution(entity)

References ENTITY, entity_name, fprintf(), list_of_templates(), load_hpf_distribution(), MAP, and print_distribute().

Referenced by print_hpf_dir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_distribution()

void print_distribution ( distribution  d)

Definition at line 97 of file debug-util.c.

98 {
99  switch(style_tag(distribution_style(d)))
100  {
101  case is_style_none:
102  (void) fprintf(stderr,"none, ");
103  break;
104  case is_style_block:
105  (void) fprintf(stderr,"BLOCK(");
107  (void) fprintf(stderr,"), ");
108  break;
109  case is_style_cyclic:
110  (void) fprintf(stderr,"CYCLIC(");
112  (void) fprintf(stderr,"), ");
113  break;
114  default:
115  pips_internal_error("unexpected style tag");
116  break;
117  }
118  (void) fprintf(stderr,"\n");
119 }
#define distribution_style(x)
Definition: hpf.h:210
#define style_tag(x)
Definition: hpf.h:258
#define distribution_parameter(x)
Definition: hpf.h:212
@ is_style_cyclic
Definition: hpf.h:239
@ is_style_block
Definition: hpf.h:238
@ is_style_none
Definition: hpf.h:237
#define pips_internal_error
Definition: misc-local.h:149

References distribution_parameter, distribution_style, fprintf(), is_style_block, is_style_cyclic, is_style_none, pips_internal_error, print_expression(), and style_tag.

Referenced by print_distribute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_hpf_dir()

void print_hpf_dir ( void  )

Definition at line 121 of file debug-util.c.

122 {
123  (void) fprintf(stderr,"HPF directives:\n");
124 
125  print_templates();
126  (void) fprintf(stderr,"--------\n");
128  (void) fprintf(stderr,"--------\n");
130  (void) fprintf(stderr,"--------\n");
131  print_aligns();
132  (void) fprintf(stderr,"--------\n");
134 }
void print_processors(void)
Definition: debug-util.c:142
void print_distributes(void)
Definition: debug-util.c:73
void print_distributed_arrays(void)
Definition: debug-util.c:148
void print_aligns(void)
Definition: debug-util.c:61
void print_templates(void)
Definition: debug-util.c:136

References fprintf(), print_aligns(), print_distributed_arrays(), print_distributes(), print_processors(), and print_templates().

Referenced by NormalizeHpfDeclarations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_processors()

void print_processors ( void  )

Definition at line 142 of file debug-util.c.

143 {
144  (void) fprintf(stderr,"Processors:\n");
146 }
list list_of_processors(void)

References fprintf(), gen_map(), list_of_processors(), and print_entity_variable().

Referenced by print_hpf_dir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_templates()

void print_templates ( void  )

Definition at line 136 of file debug-util.c.

137 {
138  (void) fprintf(stderr,"Templates:\n");
140 }

References fprintf(), gen_map(), list_of_templates(), and print_entity_variable().

Referenced by print_hpf_dir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: