PIPS
find_iteration_domain.c File Reference
#include <stdio.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "dg.h"
#include "graph.h"
#include "matrice.h"
#include "tiling.h"
#include "database.h"
#include "text.h"
#include "misc.h"
#include "text-util.h"
#include "ri-util.h"
#include "effects-util.h"
#include "resources.h"
#include "constants.h"
#include "conversion.h"
#include "wp65.h"
+ Include dependency graph for find_iteration_domain.c:

Go to the source code of this file.

Typedefs

typedef dg_arc_label arc_label
 Code Generation for Distributed Memory Machines. More...
 
typedef dg_vertex_label vertex_label
 

Functions

void find_iteration_domain (statement s, Psysteme *sc, Pbase *basis, nested_level, list *list_statement_block, instruction *inst)
 
void compute_iteration_domain (list list_loop_statement, Psysteme *sc, Pbase *basis)
 
void iteration_domain_from_statement (list *list_loop_statement, statement s, int *nested_level, list *blocks, instruction *inst)
 

Typedef Documentation

◆ arc_label

Code Generation for Distributed Memory Machines.

Build the iteration domain and the basis associated to a loop nest

File: find_iteration_domain.c

PUMA, ESPRIT contract 2701 Corinne Ancourt 1994

Definition at line 47 of file find_iteration_domain.c.

◆ vertex_label

Definition at line 48 of file find_iteration_domain.c.

Function Documentation

◆ compute_iteration_domain()

void compute_iteration_domain ( list  list_loop_statement,
Psysteme sc,
Pbase basis 
)

computation of the list of loop indices base_index and of the iteration domain sci

Parameters
list_loop_statementist_loop_statement
scc
basisasis

Definition at line 92 of file find_iteration_domain.c.

96 {
97 
98  Psysteme sci;
99  Pbase base_index = BASE_NULLE;
100 
101  /* computation of the list of loop indices base_index
102  and of the iteration domain sci*/
103 
104  debug(8,"compute_iteration_domain","begin\n");
105 
106  sci = loop_iteration_domaine_to_sc(list_loop_statement, &base_index);
107  sci->base = base_reversal(sci->base);
108  ifdebug(8) { (void) fprintf(stderr,"compute_iteration_domain\n");
109  vect_fprint(stderr,base_index,(string(*)(void*))entity_local_name);
110  }
111  *sc = sci;
112  *basis = base_index;
113  debug(8,"compute_iteration_domain","end\n");
114 }
Pbase base_reversal(Pbase b_in)
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in,...
Definition: base.c:221
Psysteme loop_iteration_domaine_to_sc(list, Pbase *)
loop_iteration_domaine_to_sc.c
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
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
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
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define ifdebug(n)
Definition: sg.c:47
Pbase base
Definition: sc-local.h:75
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
#define BASE_NULLE
MACROS SUR LES BASES.

References Ssysteme::base, BASE_NULLE, base_reversal(), debug(), entity_local_name(), fprintf(), ifdebug, loop_iteration_domaine_to_sc(), and vect_fprint().

Referenced by find_iteration_domain().

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

◆ find_iteration_domain()

void find_iteration_domain ( statement  s,
Psysteme sc,
Pbase basis,
nested_level  ,
list list_statement_block,
instruction inst 
)

Definition at line 66 of file find_iteration_domain.c.

74 {
75  list list_loop_statement=NIL;
76 
77  debug(8, "find_iteration_domain", "begin\n");
78  iteration_domain_from_statement(&list_loop_statement,s,
79  nested_level,
80  list_statement_block,inst);
81  compute_iteration_domain(list_loop_statement,sc,basis);
82  ifdebug(8) {
83  (void) fprintf(stderr,"[find_iteration_domain] initial basis \n");
84  vect_fprint(stderr,*basis,(string(*)(void*))entity_local_name);
85  sc_fprint(stderr,*sc,(string(*)(void*))entity_local_name);
86  }
87  debug(8, "find_iteration_domain", "end\n");
88 }
void compute_iteration_domain(list list_loop_statement, Psysteme *sc, Pbase *basis)
void iteration_domain_from_statement(list *list_loop_statement, statement s, int *nested_level, list *blocks, instruction *inst)
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References compute_iteration_domain(), debug(), entity_local_name(), fprintf(), ifdebug, iteration_domain_from_statement(), NIL, sc_fprint(), and vect_fprint().

Referenced by loop_nest_to_wp65_code().

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

◆ iteration_domain_from_statement()

void iteration_domain_from_statement ( list list_loop_statement,
statement  s,
int nested_level,
list blocks,
instruction inst 
)

case where there is a unique assignment in do-enddo loop nest

Parameters
list_loop_statementist_loop_statement
nested_levelested_level
blockslocks
instnst

Definition at line 116 of file find_iteration_domain.c.

122 {
123  instruction i;
124  cons *b;
125  loop l;
126  debug(8, "iteration_domain_from_statement", "begin\n");
127 
128  i = statement_instruction(s);
129  switch (instruction_tag(i)) {
130 
131  case is_instruction_loop:
132  l = instruction_loop(i);
133  *list_loop_statement = CONS (STATEMENT,s,*list_loop_statement);
134  iteration_domain_from_statement(list_loop_statement,loop_body(l),
135  nested_level,
136  blocks,inst);
137  break;
138 
139  case is_instruction_block: {
140  int nbl = 0;
141  bool simple_block = false;
142  b= instruction_block(i);
143  nbl = gen_length((list) b);
144  simple_block = (nbl==1
145  || (nbl ==2 && continue_statement_p(STATEMENT(CAR(CDR(b))))))
146  ? true : false;
147 
148  if (simple_block && instruction_loop_p(statement_instruction(STATEMENT(CAR(b)))))
149  iteration_domain_from_statement(list_loop_statement,
150  STATEMENT(CAR(b))
151  ,nested_level, blocks,inst);
152  else {
153  *nested_level = gen_length(*list_loop_statement);
154  *inst = i;
155  *blocks = b;
156  }
157 
158  break;
159  }
160  case is_instruction_call: {
161  /* case where there is a unique assignment in do-enddo loop nest*/
162  *nested_level = gen_length(*list_loop_statement);
164  *blocks =CONS(STATEMENT,s,NIL);
165  return;
166  }
167 
168  case is_instruction_test:
169  return;
170 
172  return;
173 
174  case is_instruction_goto:
175  pips_internal_error("unexpected goto in code");
176  default:
177  pips_internal_error("unexpected tag");
178  }
179 
180  debug(8, "search_array_from_statement", "end\n");
181 }
static list blocks
lisp of loops
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
Definition: instruction.c:106
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#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
bool continue_statement_p(statement)
Test if a statement is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python....
Definition: statement.c:203
#define pips_internal_error
Definition: misc-local.h:149
#define true
Definition: newgen_types.h:81
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
#define loop_body(x)
Definition: ri.h:1644
#define instruction_loop_p(x)
Definition: ri.h:1518
#define instruction_loop(x)
Definition: ri.h:1520
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define statement_instruction(x)
Definition: ri.h:2458
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References blocks, CAR, CDR, CONS, continue_statement_p(), debug(), gen_length(), instruction_block, instruction_loop, instruction_loop_p, instruction_tag, is_instruction_block, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, loop_body, make_instruction_block(), NIL, pips_internal_error, STATEMENT, statement_instruction, and true.

Referenced by find_iteration_domain().

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