PIPS
terapixify.c File Reference

apply transformations required to generate terapix microcode More...

#include <ctype.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "workspace-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "text.h"
#include "pipsdbm.h"
#include "pipsmake.h"
#include "resources.h"
#include "properties.h"
#include "misc.h"
#include "control.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "alias-classes.h"
#include "effects-convex.h"
#include "expressions.h"
#include "callgraph.h"
#include "text-util.h"
#include "transformations.h"
#include "parser_private.h"
#include "accel-util.h"
+ Include dependency graph for terapixify.c:

Go to the source code of this file.

Data Structures

struct  entity_bool
 
struct  terapix_loop_handler_param
 
struct  context
 
struct  tlo_context_t
 

Macros

#define TERAPIX_PTRARG_PREFIX   "FIFO"
 
#define TERAPIX_LOOPARG_PREFIX   "N"
 
#define TERAPIX_IMAGE_PREFIX   "im"
 
#define TERAPIX_MASK_PREFIX   "ma"
 
#define TERAPIX_REGISTER_PREFIX   "re"
 
#define TERAPIX_ACC   "P"
 

Functions

static bool cannot_terapixify (gen_chunk *elem, bool *can_terapixify)
 terapixify More...
 
static bool can_terapixify_call_p (call c, bool *can_terapixify)
 
static bool can_terapixify_expression_p (expression e, bool *can_terapixify)
 
static void entity_used_in_reference_walker (reference r, struct entity_bool *eb)
 
static void entity_used_in_loop_bound_walker (loop l, struct entity_bool *eb)
 
static bool entity_used_in_loop_bound_p (entity e)
 
static bool terapix_renamed_local_p (const char *s, const char *prefix)
 
static bool terapix_renamed_entity_p (entity e, const char *prefix)
 
static bool terapix_mask_entity_p (entity e)
 
static bool terapix_renamed_p (const char *s)
 
static void do_terapix_argument_handler (entity e, string arg_prefix, size_t *arg_cnt, string ass_prefix, size_t *ass_cnt, bool force)
 
static void terapix_argument_handler (entity e, string arg_prefix, size_t *arg_cnt, string ass_prefix, size_t *ass_cnt)
 
static void force_terapix_argument_handler (entity e, string arg_prefix, size_t *arg_cnt, string ass_prefix, size_t *ass_cnt)
 
static bool terapix_suitable_loop_bound_walker (reference r, bool *suitable)
 
static bool terapix_suitable_loop_bound_p (expression exp)
 
static void terapix_loop_handler (statement sl, terapix_loop_handler_param *p)
 
static int compare_formal_parameters (const void *v0, const void *v1)
 
static void normalize_microcode_parameter_orders (entity module)
 
static void do_terapix_pointer_initialized_from_a_mask_p (call c, context *ctxt)
 
static bool terapix_pointer_initialized_from_a_mask_p (entity e)
 
static void terapix_normalize_tests (call c)
 a test is normalized when it is in the form a>0 More...
 
static void terapixify_loop_purge (statement s, entity e)
 
void normalize_microcode_anotate ()
 terapixify.c More...
 
static void terapix_optimize_accumulator (statement st)
 if only one register is ever written by a sequence of assignment, take advantage of it More...
 
static bool do_terapix_loop_optimizer (call c, tlo_context_t *ctxt)
 
void terapix_loop_optimizer (statement st)
 
static void terapixify_loops (statement s)
 
static void stmt_rm_useless_label_rwt (statement s)
 
bool normalize_microcode (char *module_name)
 
static void do_terapix_warmup_patching (reference r, entity e)
 
static bool do_terapix_warmup (statement top)
 make sure s is of the form decl loop nest More...
 
bool terapix_warmup (const char *module_name)
 
static bool two_addresses_code_generator_split_p (expression e)
 
static void two_addresses_code_generator (statement s)
 
bool generate_two_addresses_code (const string module_name)
 
static void do_terapix_remove_divide (call c)
 
bool terapix_remove_divide (const string module_name)
 

Variables

static entity tw_loop_index
 

Detailed Description

apply transformations required to generate terapix microcode

Author
Serge Guelton serge.nosp@m..gue.nosp@m.lton@.nosp@m.enst.nosp@m.-bret.nosp@m.agne.nosp@m..fr
Date
2009-07-01

Definition in file terapixify.c.

Macro Definition Documentation

◆ TERAPIX_ACC

#define TERAPIX_ACC   "P"

◆ TERAPIX_IMAGE_PREFIX

#define TERAPIX_IMAGE_PREFIX   "im"

Definition at line 130 of file terapixify.c.

◆ TERAPIX_LOOPARG_PREFIX

#define TERAPIX_LOOPARG_PREFIX   "N"

Definition at line 129 of file terapixify.c.

◆ TERAPIX_MASK_PREFIX

#define TERAPIX_MASK_PREFIX   "ma"

Definition at line 131 of file terapixify.c.

◆ TERAPIX_PTRARG_PREFIX

#define TERAPIX_PTRARG_PREFIX   "FIFO"

Definition at line 128 of file terapixify.c.

◆ TERAPIX_REGISTER_PREFIX

#define TERAPIX_REGISTER_PREFIX   "re"

Definition at line 132 of file terapixify.c.

Function Documentation

◆ can_terapixify_call_p()

static bool can_terapixify_call_p ( call  c,
bool can_terapixify 
)
static

Definition at line 75 of file terapixify.c.

76 {
78  {
79  printf("found invalid call to %s\n",entity_user_name(call_function(c)));
80  return *can_terapixify=false;
81  }
82  return true;
83 }
#define call_constant_p(C)
Definition: flint_check.c:51
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487
#define call_function(x)
Definition: ri.h:709
#define value_intrinsic_p(x)
Definition: ri.h:3074
#define entity_initial(x)
Definition: ri.h:2796
int printf()

References call_constant_p, call_function, entity_initial, entity_user_name(), printf(), and value_intrinsic_p.

Referenced by normalize_microcode().

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

◆ can_terapixify_expression_p()

static bool can_terapixify_expression_p ( expression  e,
bool can_terapixify 
)
static

Definition at line 86 of file terapixify.c.

87 {
88  basic b = expression_basic(e);
89  while( basic_pointer_p(b))
91 
92  if(!basic_int_p(b) && ! basic_overloaded_p(b))
93  {
94  list ewords = Words_Expression(e);
95  string estring = words_to_string(ewords);
96  string bstring = basic_to_string(b);
97  printf("found invalid expression %s of basic %s\n",estring, bstring);
98  free(bstring);
99  free(estring);
100  gen_free_list(ewords);
101  return *can_terapixify=false;
102  }
103  return true;
104 }
void free(void *)
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
list Words_Expression(expression obj)
of string
Definition: misc.c:2616
string basic_to_string(basic)
Definition: type.c:87
type ultimate_type(type)
Definition: type.c:3466
basic expression_basic(expression)
Definition: type.c:1115
#define basic_pointer(x)
Definition: ri.h:637
#define basic_int_p(x)
Definition: ri.h:614
#define type_variable(x)
Definition: ri.h:2949
#define basic_pointer_p(x)
Definition: ri.h:635
#define basic_overloaded_p(x)
Definition: ri.h:623
#define variable_basic(x)
Definition: ri.h:3120
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
string words_to_string(cons *lw)
Definition: print.c:211

References basic_int_p, basic_overloaded_p, basic_pointer, basic_pointer_p, basic_to_string(), expression_basic(), free(), gen_free_list(), printf(), type_variable, ultimate_type(), variable_basic, Words_Expression(), and words_to_string().

Referenced by normalize_microcode().

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

◆ cannot_terapixify()

static bool cannot_terapixify ( gen_chunk elem,
bool can_terapixify 
)
static

terapixify

Definition at line 68 of file terapixify.c.

69 {
70  printf("found invalid construct of type %td\n",elem->i);
71  return *can_terapixify=false;
72 }
_int i
Definition: genC.h:62

References gen_chunk::i, and printf().

Referenced by normalize_microcode().

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

◆ compare_formal_parameters()

static int compare_formal_parameters ( const void *  v0,
const void *  v1 
)
static

Definition at line 300 of file terapixify.c.

300  {
301  const entity f0 = *(const entity *)v0,
302  f1=*(const entity *)v1;
307  if(f0==f1) return 0;
310  return 1;
311  else
312  return o0 > o1 ? -1 : 1 ;
313  }
314  else
315  return o0 > o1 ? -1 : 1 ;
316 }
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
entity find_ith_formal_parameter(entity the_fnct, int rank)
This function gives back the ith formal parameter, which is found in the declarations of a call or a ...
Definition: entity.c:1863
#define formal_offset(x)
Definition: ri.h:1408
#define entity_storage(x)
Definition: ri.h:2794
#define storage_formal(x)
Definition: ri.h:2524
#define intptr_t
Definition: stdint.in.h:294
static bool terapix_renamed_entity_p(entity e, const char *prefix)
Definition: terapixify.c:147
#define TERAPIX_LOOPARG_PREFIX
Definition: terapixify.c:129

References entity_storage, find_ith_formal_parameter(), formal_offset, get_current_module_entity(), intptr_t, storage_formal, TERAPIX_LOOPARG_PREFIX, and terapix_renamed_entity_p().

Referenced by normalize_microcode_parameter_orders().

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

◆ do_terapix_argument_handler()

static void do_terapix_argument_handler ( entity  e,
string  arg_prefix,
size_t arg_cnt,
string  ass_prefix,
size_t ass_cnt,
bool  force 
)
static

change parameter name and generate an assignment

we now have FIFOx in ne and will generate an assignment from ne to e we also have to change the storage for e ... and for images, add a dereferencing operator

to respect terapix asm, we also have to change the name of variable e

Definition at line 164 of file terapixify.c.

165 {
166  /* change parameter name and generate an assignment */
167  if(arg_prefix && (force || !terapix_renamed_p(entity_user_name(e))) ) {
168  string new_name;
169  asprintf(&new_name,"%s" MODULE_SEP_STRING "%s%zd",entity_module_name(e),arg_prefix,(*arg_cnt)++);
170  entity ne = make_entity_copy_with_new_name(e,new_name,false);
171  free(new_name);
172 
174  !ENDP(iter);
175  POP(iter))
176  {
177  entity ee = ENTITY(CAR(iter));
178  if(same_entity_p(e,ee)) {
179  CAR(iter).p=(gen_chunkp)ne;
180  }
181  }
182  /* we now have FIFOx in ne and will generate an assignment from ne to e
183  * we also have to change the storage for e ...
184  * and for images, add a dereferencing operator
185  */
188  expression assigned ;
189  if( false && ass_prefix && same_string_p(ass_prefix,TERAPIX_IMAGE_PREFIX))
190  {
191  basic bt = entity_basic(e);
192  type new_type = copy_type(basic_pointer(bt));
194  entity_type(e) = new_type;
197  substitute = entity_to_expression(e);
200  }
201  else
202  assigned = entity_to_expression(ne);
205  }
206 
207  /* to respect terapix asm, we also have to change the name of variable e */
208  if(ass_prefix && (force ||!terapix_renamed_p(entity_user_name(e)))) {
209  string new_name;
210  asprintf(&new_name,"%s" MODULE_SEP_STRING "%s%zd",entity_module_name(e),ass_prefix,(*ass_cnt)++);
211  entity ne = make_entity_copy_with_new_name(e,new_name,false);
213  free(new_name);
215  }
216 }
type copy_type(type p)
TYPE.
Definition: ri.c:2655
void free_expression(expression p)
Definition: ri.c:853
void free_storage(storage p)
Definition: ri.c:2231
void free_type(type p)
Definition: ri.c:2658
void substitute_expression(void *in, expression pattern, expression into)
expression_substitution.c
union gen_chunk * gen_chunkp
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
void replace_entity(void *s, entity old, entity new)
per variable version of replace_entities.
Definition: replace.c:113
#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 CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
statement make_assign_statement(expression, expression)
Definition: statement.c:583
void insert_statement(statement, statement, bool)
This is the normal entry point.
Definition: statement.c:2570
#define asprintf
Definition: misc-local.h:225
#define MODULE_SEP_STRING
Definition: naming-local.h:30
#define same_string_p(s1, s2)
#define DEREFERENCING_OPERATOR_NAME
Definition: ri-util-local.h:93
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
Definition: entity.c:1380
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
entity make_entity_copy_with_new_name(entity e, string global_new_name, bool move_initialization_p)
Create a copy of an entity, with (almost) identical type, storage and initial value if move_initializ...
Definition: entity.c:2463
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
Definition: expression.c:342
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
Definition: variable.c:260
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define code_declarations(x)
Definition: ri.h:784
#define value_code(x)
Definition: ri.h:3067
#define entity_type(x)
Definition: ri.h:2792
#define storage_undefined
Definition: ri.h:2476
static bool terapix_renamed_p(const char *s)
Definition: terapixify.c:154
#define TERAPIX_IMAGE_PREFIX
Definition: terapixify.c:130

References AddEntityToCurrentModule(), asprintf, basic_pointer, CAR, code_declarations, copy_type(), DEREFERENCING_OPERATOR_NAME, entity_bool::e, ENDP, ENTITY, entity_basic(), entity_initial, entity_intrinsic(), entity_module_name(), entity_storage, entity_to_expression(), entity_type, entity_user_name(), free(), free_expression(), free_storage(), free_type(), get_current_module_entity(), get_current_module_statement(), insert_statement(), make_assign_statement(), make_entity_copy_with_new_name(), MakeUnaryCall(), MODULE_SEP_STRING, POP, replace_entity(), same_entity_p(), same_string_p, storage_undefined, substitute_expression(), TERAPIX_IMAGE_PREFIX, terapix_renamed_p(), and value_code.

Referenced by force_terapix_argument_handler(), and terapix_argument_handler().

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

◆ do_terapix_loop_optimizer()

static bool do_terapix_loop_optimizer ( call  c,
tlo_context_t ctxt 
)
static

Definition at line 479 of file terapixify.c.

479  {
485  make_call(
488  )
489  )
490  );
491  ctxt->success=true;
492  gen_recurse_stop(0);
493  }
494  }
495  return true;
496 }
call make_call(entity a1, list a2)
Definition: ri.c:269
syntax make_syntax_call(call _field_)
Definition: ri.c:2500
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
void gen_recurse_stop(void *obj)
Tells the recursion not to go in this object.
Definition: genClib.c:3251
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define ENTITY_DEREFERENCING_P(e)
#define PRE_DECREMENT_OPERATOR_NAME
#define binary_call_lhs(c)
#define PRE_INCREMENT_OPERATOR_NAME
Definition: ri-util-local.h:99
void update_expression_syntax(expression e, syntax s)
frees expression syntax of e and replace it by the new syntax s
Definition: expression.c:3564
bool expression_reference_p(expression e)
Test if an expression is a reference.
Definition: expression.c:528
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
Definition: expression.c:3140
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
entity iterator
Definition: terapixify.c:474
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References binary_call_lhs, call_function, CONS, copy_expression(), ENTITY_DEREFERENCING_P, entity_intrinsic(), exp, EXPRESSION, expression_reference_p(), expression_to_entity(), gen_recurse_stop(), tlo_context_t::iterator, make_call(), make_syntax_call(), NIL, tlo_context_t::plus, PRE_DECREMENT_OPERATOR_NAME, PRE_INCREMENT_OPERATOR_NAME, same_entity_p(), tlo_context_t::success, and update_expression_syntax().

Referenced by terapix_loop_optimizer(), and terapixify_loops().

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

◆ do_terapix_pointer_initialized_from_a_mask_p()

static void do_terapix_pointer_initialized_from_a_mask_p ( call  c,
context ctxt 
)
static

check that lhs only contains reference to mask

Definition at line 327 of file terapixify.c.

327  {
328  entity op = call_function(c);
329  if(ENTITY_ASSIGN_P(op)) {
330  expression lhs = binary_call_lhs(c),
331  rhs = binary_call_rhs(c);
332  if(expression_pointer_p(lhs)) {
334  if(same_entity_p(reference_variable(r),ctxt->ref)) {
335  /* check that lhs only contains reference to mask */
336  set s = get_referenced_entities(rhs);
337  bool only_mask = true,
338  at_least_one_mask = false;
339  SET_FOREACH(entity,e,s) {
340  if(terapix_mask_entity_p(e)) {
341  at_least_one_mask=true;
342  }
343  else
344  only_mask=false;
345  }
346  set_free(s);
347  ctxt->res = only_mask && at_least_one_mask;
348  gen_recurse_stop(0);
349  }
350  }
351  }
352 }
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
Definition: newgen_set.h:78
void set_free(set)
Definition: set.c:332
#define binary_call_rhs(c)
#define ENTITY_ASSIGN_P(e)
set get_referenced_entities(void *elem)
retrieves the set of entities used in elem beware that this entities may be formal parameters,...
Definition: entity.c:3063
bool expression_pointer_p(expression e)
we get the type of the expression by calling expression_to_type() which allocates a new one.
Definition: expression.c:506
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
Definition: expression.c:1832
#define reference_variable(x)
Definition: ri.h:2326
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59
bool res
Definition: terapixify.c:324
entity ref
Definition: terapixify.c:323
static bool terapix_mask_entity_p(entity e)
Definition: terapixify.c:150

References binary_call_lhs, binary_call_rhs, call_function, ENTITY_ASSIGN_P, expression_pointer_p(), expression_reference(), gen_recurse_stop(), get_referenced_entities(), context::ref, reference_variable, context::res, same_entity_p(), SET_FOREACH, set_free(), and terapix_mask_entity_p().

Referenced by terapix_pointer_initialized_from_a_mask_p().

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

◆ do_terapix_remove_divide()

static void do_terapix_remove_divide ( call  c)
static

Definition at line 1011 of file terapixify.c.

1012 {
1013  entity op = call_function(c);
1014  if(ENTITY_DIVIDE_P(op))
1015  {
1016  expression lhs = binary_call_lhs(c);
1017  expression rhs = binary_call_rhs(c);
1019  {
1020  int accuracy = get_int_property("TERAPIX_REMOVE_DIVIDE_ACCURACY");
1021 
1024 
1028  lhs,
1033  int_to_expression(1),
1034  rhs),
1035  int_to_expression(accuracy)
1036  )
1037  ),
1038  int_to_expression(accuracy)
1039  );
1040  }
1041  else
1042  pips_user_error("terapix cannot handle division by a non-constant variable\n");
1043  }
1044 }
int get_int_property(const string)
#define pips_user_error
Definition: misc-local.h:147
#define make_expression_list(stats...)
#define ENTITY_DIVIDE_P(e)
#define LEFT_SHIFT_OPERATOR_NAME
#define DIVIDE_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
#define RIGHT_SHIFT_OPERATOR_NAME
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
bool extended_expression_constant_p(expression exp)
Returns true if the value of the expression does not depend syntactically on the current store.
Definition: expression.c:2461
#define call_arguments(x)
Definition: ri.h:711

References binary_call_lhs, binary_call_rhs, call_arguments, call_function, DIVIDE_OPERATOR_NAME, ENTITY_DIVIDE_P, entity_intrinsic(), extended_expression_constant_p(), gen_free_list(), get_int_property(), int_to_expression(), LEFT_SHIFT_OPERATOR_NAME, make_expression_list, MakeBinaryCall(), MULTIPLY_OPERATOR_NAME, pips_user_error, and RIGHT_SHIFT_OPERATOR_NAME.

Referenced by terapix_remove_divide().

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

◆ do_terapix_warmup()

static bool do_terapix_warmup ( statement  top)
static

make sure s is of the form decl loop nest

and then assume each array is a 2+ dimensional array and make sure there is no constant in the first array index. That's all.

Definition at line 879 of file terapixify.c.

879  {
880  if(statement_block_p(top)) {
882  if(declaration_statement_p(s)) continue;
883  else if(statement_loop_p(s)) {
884  loop l =statement_loop(s);
887  list arrays = NIL;
888  SET_FOREACH(entity, e, re) {
890  type_variable(entity_type(e))))>1) {
891  arrays=CONS(ENTITY,e,arrays);
892  }
893  }
894  set_free(re);
895  FOREACH(ENTITY,e,arrays) {
896  gen_context_recurse(l, e,
898  }
899  gen_free_list(arrays);
900  return true;
901  }
902  else break;
903  }
904  }
905  return false;
906 }
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
Definition: genClib.c:2785
size_t gen_length(const list l)
Definition: list.c:150
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
list statement_block(statement)
Get the list of block statements of a statement sequence.
Definition: statement.c:1338
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374
bool statement_loop_p(statement)
Definition: statement.c:349
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
Definition: statement.c:224
#define statement_block_p(stat)
bool entity_array_p(entity e)
Is e a variable with an array type?
Definition: entity.c:754
#define loop_body(x)
Definition: ri.h:1644
#define reference_domain
newgen_range_domain_defined
Definition: ri.h:338
#define variable_dimensions(x)
Definition: ri.h:3122
#define loop_index(x)
Definition: ri.h:1640
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
static entity tw_loop_index
Definition: terapixify.c:838
static void do_terapix_warmup_patching(reference r, entity e)
Definition: terapixify.c:839

References CONS, declaration_statement_p(), do_terapix_warmup_patching(), ENTITY, entity_array_p(), entity_type, FOREACH, gen_context_recurse, gen_free_list(), gen_length(), gen_true2(), get_referenced_entities(), loop_body, loop_index, NIL, reference_domain, SET_FOREACH, set_free(), STATEMENT, statement_block(), statement_block_p, statement_loop(), statement_loop_p(), tw_loop_index, type_variable, and variable_dimensions.

Referenced by terapix_warmup().

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

◆ do_terapix_warmup_patching()

static void do_terapix_warmup_patching ( reference  r,
entity  e 
)
static

Definition at line 839 of file terapixify.c.

839  {
844  NORMALIZE_EXPRESSION(*index0);
845  normalized n = expression_normalized(*index0);
846  if(normalized_linear_p(n)) {
847  for(Pvecteur piter = normalized_linear(n);
848  !VECTEUR_NUL_P(piter);
849  piter=vecteur_succ(piter)) {
850 
851  if(vecteur_var(piter)!=tw_loop_index) {
852  Value offset = vecteur_val(piter);
853  if(offset!=VALUE_ZERO) {
854  Pvecteur opv = vect_new(vecteur_var(piter),offset);
855  expression eoffset = Pvecteur_to_expression(opv),
856  Eoffset = copy_expression(eoffset);
857  vect_rm(opv);
859  SizeOfDimension(d1),
860  eoffset);
861  *index0=make_op_exp(MINUS_OPERATOR_NAME,*index0,Eoffset);
864  *index1,
865  eoffset);
866  }
867  }
868  }
869  }
870  }
871 }
#define VALUE_ZERO
int Value
static Value offset
Definition: translation.c:283
#define REFCAR(pc)
Get the adress of the first element of a list.
Definition: newgen_list.h:119
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define NORMALIZE_EXPRESSION(e)
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
Definition: expression.c:1825
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
Definition: expression.c:2012
expression SizeOfDimension(dimension)
Definition: size.c:503
#define normalized_linear_p(x)
Definition: ri.h:1779
#define expression_normalized(x)
Definition: ri.h:1249
#define reference_indices(x)
Definition: ri.h:2328
#define normalized_linear(x)
Definition: ri.h:1781
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
#define vecteur_val(v)
#define vecteur_var(v)
#define vecteur_succ(v)
#define VECTEUR_NUL_P(v)
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

References CAR, CDR, copy_expression(), DIMENSION, entity_intrinsic(), entity_type, expression_normalized, make_op_exp(), MakeBinaryCall(), MINUS_OPERATOR_NAME, MULTIPLY_OPERATOR_NAME, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, offset, PLUS_OPERATOR_NAME, Pvecteur_to_expression(), REFCAR, reference_indices, reference_variable, same_entity_p(), SizeOfDimension(), tw_loop_index, type_variable, VALUE_ZERO, variable_dimensions, vect_new(), vect_rm(), VECTEUR_NUL_P, vecteur_succ, vecteur_val, and vecteur_var.

Referenced by do_terapix_warmup().

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

◆ entity_used_in_loop_bound_p()

static bool entity_used_in_loop_bound_p ( entity  e)
static

Definition at line 121 of file terapixify.c.

122 {
123  struct entity_bool eb = { e, false };
125  return eb.b;
126 }
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
entity e
Definition: terapixify.c:106
static void entity_used_in_loop_bound_walker(loop l, struct entity_bool *eb)
Definition: terapixify.c:115

References entity_bool::b, entity_bool::e, entity_used_in_loop_bound_walker(), gen_context_recurse, gen_true2(), get_current_module_statement(), and loop_domain.

Referenced by normalize_microcode().

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

◆ entity_used_in_loop_bound_walker()

static void entity_used_in_loop_bound_walker ( loop  l,
struct entity_bool eb 
)
static

Definition at line 115 of file terapixify.c.

116 {
118 }
#define loop_range(x)
Definition: ri.h:1642
static void entity_used_in_reference_walker(reference r, struct entity_bool *eb)
Definition: terapixify.c:109

References entity_used_in_reference_walker(), gen_context_recurse, gen_true2(), loop_range, and reference_domain.

Referenced by entity_used_in_loop_bound_p().

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

◆ entity_used_in_reference_walker()

static void entity_used_in_reference_walker ( reference  r,
struct entity_bool eb 
)
static

Definition at line 109 of file terapixify.c.

110 {
111  if(same_entity_p(reference_variable(r),eb->e)) eb->b=true;
112 }

References entity_bool::b, entity_bool::e, reference_variable, and same_entity_p().

Referenced by entity_used_in_loop_bound_walker().

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

◆ force_terapix_argument_handler()

static void force_terapix_argument_handler ( entity  e,
string  arg_prefix,
size_t arg_cnt,
string  ass_prefix,
size_t ass_cnt 
)
static

Definition at line 220 of file terapixify.c.

220  {
221  do_terapix_argument_handler(e,arg_prefix,arg_cnt,ass_prefix,ass_cnt,true);
222 }
static void do_terapix_argument_handler(entity e, string arg_prefix, size_t *arg_cnt, string ass_prefix, size_t *ass_cnt, bool force)
Definition: terapixify.c:164

References do_terapix_argument_handler(), and entity_bool::e.

Referenced by normalize_microcode().

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

◆ generate_two_addresses_code()

bool generate_two_addresses_code ( const string  module_name)

prelude

validate

ostlude

Parameters
module_nameodule_name

Definition at line 991 of file terapixify.c.

992 {
993  /* prelude */
999 
1000  /* validate */
1003 
1004  /*postlude*/
1008  return true;
1009 }
void set_cumulated_rw_effects(statement_effects)
void reset_cumulated_rw_effects(void)
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
void set_conflict_testing_properties()
conflicts.c
Definition: conflicts.c:68
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
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
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 DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
static void two_addresses_code_generator(statement s)
Definition: terapixify.c:948

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, gen_recurse, gen_true(), get_current_module_statement(), module_name(), module_name_to_entity(), module_reorder(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), set_conflict_testing_properties(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), statement_domain, and two_addresses_code_generator().

+ Here is the call graph for this function:

◆ normalize_microcode()

bool normalize_microcode ( char *  module_name)

prelude

checks

make sure

  • only do loops remain
  • no call to external functions
  • no float / double etc

unroll some loops with constant trip count

reorder some loops

detect initial array sizes

now, try to guess the goal of the parameters

  • parameters are 32 bits signed integers (TODO)
  • read-only arrays might be mask, but can also be images (depend of their size ?)
  • written arrays must be images
  • integer are loop parameters
  • others are not allowed

reserve some register for internal use

it's a pointer

a rom array with only one element, outlining and isolate_statement where too smart :)

pips bonus step: the consistency

rename all declared entities using terasm convention

need a copy otherwise goes in infinite loop

it's a pointer

it's an int

reorder arguments to match terapix conventions

loops in terasm iterate over a given parameter, in the form DO I=1:N I is hidden to the user and N must be a parameter

normalize test

try some simple optimizations

validate

ostlude

Parameters
module_nameodule_name

Definition at line 626 of file terapixify.c.

627 {
628  bool can_terapixify =true;
629  /* prelude */
633 
634  /* checks */
635 
636  /* make sure
637  * - only do loops remain
638  * - no call to external functions
639  * - no float / double etc
640  */
646  NULL);
647 
648  /* unroll some loops with constant trip count */
651 
652  /* reorder some loops */
654 
655 
656  /* detect initial array sizes */
658 
659  /* now, try to guess the goal of the parameters
660  * - parameters are 32 bits signed integers (TODO)
661  * - read-only arrays might be mask, but can also be images (depend of their size ?)
662  * - written arrays must be images
663  * - integer are loop parameters
664  * - others are not allowed
665  */
666  size_t nb_fifo = 1;
667  size_t nb_lu = 1;
668  size_t nb_ptr = 1;
669  size_t nb_ma = 1;
670  size_t nb_re = 5;/* reserve some register for internal use */
672  {
673  if(!entity_area_p(e))
674  {
676  basic vb = variable_basic(v);
677  if(formal_parameter_p(e))
678  {
679  if( basic_pointer_p(vb) ) /* it's a pointer */
680  {
681  string prefix = NULL;
684  if( strstr(entity_user_name(e),get_string_property("GROUP_CONSTANTS_HOLDER")) ) {
685  printf("%s seems a mask\n",entity_user_name(e));
687  }
688  else {
689  printf("%s seems an image\n",entity_user_name(e));
691  }
693  }
694  else if( entity_used_in_loop_bound_p(e) )
695  {
696  printf("%s belongs to a loop bound\n",entity_user_name(e));
697  //terapix_argument_handler(e,TERAPIX_LOOPARG_PREFIX,&nb_lu,NULL,NULL);
698  }
699  /* a rom array with only one element, outlining and isolate_statement where too smart :) */
700  else if ( strstr(entity_user_name(e),get_string_property("GROUP_CONSTANTS_HOLDER")) &&
701  entity_scalar_p(e)) {
702 
706  NIL,
707  NIL
708  )
709  );
710  expression repl = MakeUnaryCall(
713  );
716  e,
717  repl);
718  free_expression(repl);
719  /* pips bonus step: the consistency */
720  intptr_t i=1,
723  if(i++==offset) {
724  dummy d = parameter_dummy(p);
725  if(dummy_identifier_p(d))
726  {
727  entity di = dummy_identifier(d);
731  NIL,
732  NIL
733  )
734  );
735  }
739  NIL,
740  NIL
741  )
742  );
743  break;
744  }
745  }
747  list callers_statement = callers_to_statements(callers);
748  list call_sites = callers_to_call_sites(callers_statement,get_current_module_entity());
749  pips_assert("only one caller here\n",
750  !ENDP(call_sites) && ENDP(CDR(call_sites)));
751  list args = call_arguments(CALL(CAR(call_sites)));
752  for(intptr_t i=1;i<offset;i++) POP(args);
753  expression *exp = (expression*)REFCAR(args);
754  *exp=
757  *exp
758  );
759 
760 
761  for(list citer=callers,siter=callers_statement;!ENDP(citer);POP(citer),POP(siter))
762  DB_PUT_MEMORY_RESOURCE(DBR_CODE, STRING(CAR(citer)),STATEMENT(CAR(siter)));
764  gen_free_list(callers_statement);
765 
766  printf("%s seems a mask\n",entity_user_name(e));
768  }
769  }
770  else if( basic_pointer_p(vb) ) {
771  terapix_argument_handler(e,NULL,NULL,TERAPIX_IMAGE_PREFIX,&nb_ptr);
772  } else if( entity_scalar_p(e))
774  else
776  }
777  }
778 
779  /* rename all declared entities using terasm convention*/
781  bool stop=true;
782  do {
783  stop=true;
784  /* need a copy otherwise goes in infinite loop */
785  FOREACH(ENTITY,e,tmp)
786  {
787  if(entity_variable_p(e))
788  {
790  if( basic_pointer_p(variable_basic(v)) ) {/* it's a pointer */
793  stop=false;
794  }
795  else
796  terapix_argument_handler(e,NULL,NULL,TERAPIX_IMAGE_PREFIX,&nb_ptr);
797  }
798  else if( basic_int_p(variable_basic(v))) /* it's an int */
800  }
801  }
802  } while(!stop);
803  gen_free_list(tmp);
804 
805  /* reorder arguments to match terapix conventions */
807 
808  /* loops in terasm iterate over a given parameter, in the form DO I=1:N
809  * I is hidden to the user and N must be a parameter */
810  {
813  .cnt=&nb_lu
814  };
816  }
817 
819 
820  /* normalize test */
822 
823  /* try some simple optimizations */
826 
827 
828  /* validate */
831 
832  /*postlude*/
836  return true || can_terapixify;
837 }
type make_type_variable(variable _field_)
Definition: ri.c:2715
basic make_basic_pointer(type _field_)
Definition: ri.c:179
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
bool db_touch_resource(const char *rname, const char *oname)
touch logical time for resource[owner], possibly behind the back of pipsdbm.
Definition: database.c:538
list callers_to_call_sites(list callers_statement, entity called_module)
given a list callers_statement of module statements returns a list of calls to module called_module
Definition: callgraph.c:149
list callers_to_statements(list callers)
given a list callers of module name calling module called module return a list of their body
Definition: callgraph.c:163
bool clean_up_sequences(statement s)
Recursively clean up the statement sequences by fusing them if possible and by removing useless one.
string compilation_unit_of_module(const char *)
The output is undefined if the module is referenced but not defined in the workspace,...
Definition: module.c:350
int dummy
A dummy file, to prevent empty libraries from breaking builds.
Definition: dummy.c:41
char * get_string_property(const char *)
#define STRING(x)
Definition: genC.h:87
const char * get_current_module_name(void)
Get the name of the current module.
Definition: static.c:121
void replace_entity_by_expression(void *s, entity ent, expression exp)
replace all reference to entity ent by expression exp in s.
Definition: replace.c:220
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
Definition: genClib.c:3373
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
@ hash_pointer
Definition: newgen_hash.h:32
#define HASH_DEFAULT_SIZE
Definition: newgen_hash.h:26
static const char * prefix
#define entity_declarations(e)
MISC: newgen shorthands.
#define ADDRESS_OF_OPERATOR_NAME
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
#define module_functional_parameters(func)
bool entity_area_p(entity e)
Definition: area.c:149
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
Definition: variable.c:1113
bool formal_parameter_p(entity)
Definition: variable.c:1489
#define forloop_domain
newgen_extensions_domain_defined
Definition: ri.h:178
#define dummy_identifier(x)
Definition: ri.h:1033
#define expression_domain
newgen_execution_domain_defined
Definition: ri.h:154
#define parameter_dummy(x)
Definition: ri.h:1823
#define parameter_type(x)
Definition: ri.h:1819
#define callees_callees(x)
Definition: ri.h:675
#define call_domain
newgen_callees_domain_defined
Definition: ri.h:58
#define PARAMETER(x)
PARAMETER.
Definition: ri.h:1788
#define whileloop_domain
newgen_variable_domain_defined
Definition: ri.h:466
#define statement_declarations(x)
Definition: ri.h:2460
#define CALL(x)
CALL.
Definition: ri.h:679
#define dummy_identifier_p(x)
Definition: ri.h:1031
#define TERAPIX_MASK_PREFIX
Definition: terapixify.c:131
static bool terapix_pointer_initialized_from_a_mask_p(entity e)
Definition: terapixify.c:354
static bool can_terapixify_expression_p(expression e, bool *can_terapixify)
Definition: terapixify.c:86
static void stmt_rm_useless_label_rwt(statement s)
Definition: terapixify.c:621
static void normalize_microcode_parameter_orders(entity module)
Definition: terapixify.c:318
static void terapix_normalize_tests(call c)
a test is normalized when it is in the form a>0
Definition: terapixify.c:362
void normalize_microcode_anotate()
terapixify.c
Definition: terapixify.c:410
static bool cannot_terapixify(gen_chunk *elem, bool *can_terapixify)
terapixify
Definition: terapixify.c:68
static bool can_terapixify_call_p(call c, bool *can_terapixify)
Definition: terapixify.c:75
static void terapixify_loops(statement s)
Definition: terapixify.c:565
static void terapix_loop_handler(statement sl, terapix_loop_handler_param *p)
Definition: terapixify.c:245
static void terapix_argument_handler(entity e, string arg_prefix, size_t *arg_cnt, string ass_prefix, size_t *ass_cnt)
Definition: terapixify.c:217
#define TERAPIX_PTRARG_PREFIX
Definition: terapixify.c:128
static void terapix_optimize_accumulator(statement st)
if only one register is ever written by a sequence of assignment, take advantage of it
Definition: terapixify.c:442
static void force_terapix_argument_handler(entity e, string arg_prefix, size_t *arg_cnt, string ass_prefix, size_t *ass_cnt)
Definition: terapixify.c:220
#define TERAPIX_REGISTER_PREFIX
Definition: terapixify.c:132
void terapix_loop_optimizer(statement st)
Definition: terapixify.c:498
static bool entity_used_in_loop_bound_p(entity e)
Definition: terapixify.c:121

References ADDRESS_OF_OPERATOR_NAME, basic_int_p, basic_pointer, basic_pointer_p, CALL, call_arguments, call_domain, callees_callees, callers_to_call_sites(), callers_to_statements(), can_terapixify_call_p(), can_terapixify_expression_p(), cannot_terapixify(), CAR, CDR, clean_up_sequences(), compilation_unit_of_module(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, db_touch_resource(), DEREFERENCING_OPERATOR_NAME, dummy_identifier, dummy_identifier_p, ENDP, ENTITY, entity_area_p(), entity_declarations, entity_intrinsic(), entity_scalar_p(), entity_storage, entity_to_expression(), entity_type, entity_used_in_loop_bound_p(), entity_user_name(), entity_variable_p, exp, expression_domain, force_terapix_argument_handler(), FOREACH, forloop_domain, formal_offset, formal_parameter_p(), free_expression(), gen_context_multi_recurse(), gen_context_recurse, gen_copy_seq(), gen_free_list(), gen_null(), gen_recurse, gen_true(), gen_true2(), get_current_module_entity(), get_current_module_name(), get_current_module_statement(), get_string_property(), HASH_DEFAULT_SIZE, hash_pointer, hash_table_make(), terapix_loop_handler_param::ht, intptr_t, make_basic_pointer(), make_type_variable(), make_variable(), MakeUnaryCall(), module_functional_parameters, module_name(), module_name_to_entity(), module_reorder(), NIL, normalize_microcode_anotate(), normalize_microcode_parameter_orders(), offset, PARAMETER, parameter_dummy, parameter_type, pips_assert, POP, prefix, printf(), REFCAR, replace_entity_by_expression(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), STATEMENT, statement_declarations, statement_domain, stmt_rm_useless_label_rwt(), storage_formal, STRING, terapix_argument_handler(), TERAPIX_IMAGE_PREFIX, terapix_loop_handler(), terapix_loop_optimizer(), TERAPIX_MASK_PREFIX, terapix_normalize_tests(), terapix_optimize_accumulator(), terapix_pointer_initialized_from_a_mask_p(), TERAPIX_PTRARG_PREFIX, TERAPIX_REGISTER_PREFIX, terapixify_loops(), type_variable, ultimate_type(), variable_basic, and whileloop_domain.

◆ normalize_microcode_anotate()

void normalize_microcode_anotate ( void  )

terapixify.c

there should be only one caller

Eeny, meeny, miny, moe

get ready for annotation insertion

Definition at line 410 of file terapixify.c.

410  {
412  /* there should be only one caller */
413  string caller = STRING(CAR(callers));
414  /* Eeny, meeny, miny, moe */
416  if(entity_pointer_p(fa)) {
417  const char* fa_name = entity_user_name(fa);
418  entity caller_faname = FindEntityFromUserName(caller,fa_name);
419  if(entity_undefined_p(caller_faname)){
420  string tmp=strdup(fa_name);
421  tmp[strlen(tmp)-1]=0;
422  caller_faname = FindEntityFromUserName(caller,tmp);
423  free(tmp);
424  }
425  pips_assert("parameter found",!entity_undefined_p(caller_faname));
426  /* get ready for annotation insertion */
427  string pragma;
428  asprintf(&pragma,"terapix %s", fa_name);
430  string tmp = pragma;
431  asprintf(&pragma,"%s %d",pragma, dimension_size(d));
432  free(tmp);
433  }
436  pragma,false);
437  }
438  }
439 }
entity FindEntityFromUserName(const char *package, const char *name)
Definition: entity.c:1520
bool entity_pointer_p(entity e)
Definition: entity.c:745
list module_formal_parameters(entity func)
list module_formal_parameters(entity func) input : an entity representing a function.
Definition: module.c:327
void add_pragma_str_to_statement(statement st, const char *s, bool copy_flag)
Add a string as a pragma to a statement.
Definition: pragma.c:425
int dimension_size(dimension)
this function computes the size of a dimension.
Definition: size.c:491
struct _newgen_struct_pragma_ * pragma
Definition: ri.h:295
#define entity_undefined_p(x)
Definition: ri.h:2762
char * strdup()

References add_pragma_str_to_statement(), asprintf, callees_callees, CAR, db_get_memory_resource(), DIMENSION, dimension_size(), entity_pointer_p(), entity_type, entity_undefined_p, entity_user_name(), FindEntityFromUserName(), FOREACH, free(), get_current_module_entity(), get_current_module_name(), get_current_module_statement(), module_formal_parameters(), pips_assert, STATEMENT, statement_block(), strdup(), STRING, type_variable, and variable_dimensions.

Referenced by normalize_microcode().

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

◆ normalize_microcode_parameter_orders()

static void normalize_microcode_parameter_orders ( entity  module)
static

Definition at line 318 of file terapixify.c.

318  {
320 }
void sort_parameters(entity module, gen_cmp_func_t cmp)
change the parameter order for function module using comparison function cmp both compilation unit an...
Definition: callgraph.c:180
static char * module
Definition: pips.c:74
static int compare_formal_parameters(const void *v0, const void *v1)
Definition: terapixify.c:300

References compare_formal_parameters(), module, and sort_parameters().

Referenced by normalize_microcode().

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

◆ stmt_rm_useless_label_rwt()

static void stmt_rm_useless_label_rwt ( statement  s)
static

Definition at line 621 of file terapixify.c.

622 {
624 }
void statement_remove_useless_label(statement, bool *)
remove the label of a statement if the statement is not unstructured.
Definition: statement.c:4275

References statement_remove_useless_label().

Referenced by normalize_microcode().

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

◆ terapix_argument_handler()

static void terapix_argument_handler ( entity  e,
string  arg_prefix,
size_t arg_cnt,
string  ass_prefix,
size_t ass_cnt 
)
static

Definition at line 217 of file terapixify.c.

217  {
218  do_terapix_argument_handler(e,arg_prefix,arg_cnt,ass_prefix,ass_cnt,false);
219 }

References do_terapix_argument_handler(), and entity_bool::e.

Referenced by normalize_microcode().

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

◆ terapix_loop_handler()

static void terapix_loop_handler ( statement  sl,
terapix_loop_handler_param p 
)
static

generate new entity if needed

use the reference , but we must rename it however !

patch loop

save change for futher processing

Definition at line 245 of file terapixify.c.

246 {
247  if(statement_loop_p(sl)){
248  loop l = statement_loop(sl);
249  range r = loop_range(l);
251  entity loop_bound = entity_undefined;
252  if(terapix_suitable_loop_bound_p(nb_iter))
253  {
254  set body_entities = get_referenced_entities(loop_body(l));
255  /* generate new entity if needed */
256  if(expression_reference_p(nb_iter)) /* use the reference , but we must rename it however !*/
257  {
258  loop_bound=reference_variable(expression_reference(nb_iter));
259  string new_name;
261  entity new_loop_bound=make_entity_copy_with_new_name(loop_bound,new_name,false);
263  !ENDP(iter);
264  POP(iter))
265  {
266  entity ee = ENTITY(CAR(iter));
267  if(same_entity_p(loop_bound,ee)) {
268  CAR(iter).p=(gen_chunkp)new_loop_bound;
269  }
270  }
272  loop_bound=new_loop_bound;
273  }
274  else {
275  string new_name;
276  asprintf(&new_name,TERAPIX_LOOPARG_PREFIX "%zd",(*p->cnt)++);
278  value v = entity_initial(loop_bound);
281  value_expression(v)=nb_iter;
282  AddEntityToCurrentModule(loop_bound);
283  free(new_name);
284  }
285 
286  /* patch loop */
289 
290  if(set_belong_p(body_entities,loop_bound))
292 
293 
294  /* save change for futher processing */
295  hash_put(p->ht,loop_bound,nb_iter);
296  }
297  }
298 }
void free_constant(constant p)
Definition: ri.c:362
void do_loop_to_while_loop(statement)
converts a doloop to a while loop, in place
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
bool set_belong_p(const set, const void *)
Definition: set.c:194
@ range_to_nbiter
expression range_to_expression(range r, enum range_to_expression_mode mode)
computes the distance between the lower bound and the upper bound of the range
Definition: eval.c:963
entity make_scalar_integer_entity(const char *, const char *)
Create an integer variable of name "name" in module of name "module_name".
Definition: variable.c:1068
#define value_tag(x)
Definition: ri.h:3064
#define value_constant(x)
Definition: ri.h:3073
#define range_upper(x)
Definition: ri.h:2290
@ is_value_expression
Definition: ri.h:3036
#define entity_undefined
Definition: ri.h:2761
#define value_expression(x)
Definition: ri.h:3082
Psysteme new_loop_bound(Psysteme scn, Pbase base_index)
Psysteme new_loop_bound(Psysteme scn, Pbase base_index) computation of the new iteration space (given...
static bool terapix_suitable_loop_bound_p(expression exp)
Definition: terapixify.c:231

References AddEntityToCurrentModule(), asprintf, CAR, terapix_loop_handler_param::cnt, code_declarations, do_loop_to_while_loop(), ENDP, ENTITY, entity_initial, entity_to_expression(), entity_undefined, expression_reference(), expression_reference_p(), free(), free_constant(), free_expression(), get_current_module_entity(), get_current_module_name(), get_current_module_statement(), get_referenced_entities(), hash_put(), terapix_loop_handler_param::ht, is_value_expression, loop_body, loop_range, make_entity_copy_with_new_name(), make_scalar_integer_entity(), MODULE_SEP_STRING, new_loop_bound(), POP, range_to_expression(), range_to_nbiter, range_upper, reference_variable, replace_entity(), same_entity_p(), set_belong_p(), statement_loop(), statement_loop_p(), TERAPIX_LOOPARG_PREFIX, terapix_suitable_loop_bound_p(), value_code, value_constant, value_expression, and value_tag.

Referenced by normalize_microcode().

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

◆ terapix_loop_optimizer()

void terapix_loop_optimizer ( statement  st)

look for iterators from the end

now try to hide the iteration in a pointer access somewhere

Parameters
stt

Definition at line 498 of file terapixify.c.

498  {
499  if(statement_loop_p(st)) {
500  loop l =statement_loop(st);
501 
502  statement sb = loop_body(l);
505  if(statement_block_p(sb)) {
507  list bblock = gen_nreverse(gen_copy_seq(block));
508  list added = NIL;
509 
510  /* look for iterators from the end */
511  FOREACH(STATEMENT,s,bblock) {
512  if(assignment_statement_p(s)) {
513  call c = statement_call(s);
514  expression lhs = binary_call_lhs(c),
515  rhs = binary_call_rhs(c);
516  if(expression_call_p(rhs)) {
517  call c = expression_call(rhs);
518  entity op = call_function(c);
519  if(ENTITY_PLUS_C_P(op) || ENTITY_MINUS_C_P(op)) {
520  bool plus = ENTITY_PLUS_C_P(op);
521  intptr_t step;
522  if(expression_equal_p(binary_call_lhs(c),lhs) &&
523  expression_integer_value(binary_call_rhs(c),&step)&&step==1) {
524  entity iterator = expression_to_entity(lhs);
525  statement copy = copy_statement(s);
528 
529  gen_remove(&block,s);
530  /* now try to hide the iteration in a pointer access somewhere */
531  tlo_context_t ctxt = {iterator,plus,false };
532  FOREACH(STATEMENT,ss,block) {
533  set re = get_referenced_entities(ss);
534  if(set_belong_p(re,iterator)) {
536  if(ctxt.success) {
537  set_free(re);
538  break;
539  }
540  }
541  set_free(re);
542  }
543  if(!ctxt.success)
545  else
546  free_statement(s);
547  added=CONS(STATEMENT,copy,added);
548  continue;
549  }
550  }
551  }
552  }
553  break;
554  }
556  gen_free_list(bblock);
557  if(!ENDP(added)) {
558  added=gen_nreverse(added);
559  insert_statement(st,make_block_statement(added),true);
560  }
561  }
562  }
563 }
basic make_basic_int(intptr_t _field_)
Definition: ri.c:158
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
void free_statement(statement p)
Definition: ri.c:2189
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
Definition: list.c:685
sequence statement_sequence(statement)
Get the sequence of a statement sequence.
Definition: statement.c:1328
call statement_call(statement)
Get the call of a statement.
Definition: statement.c:1406
bool assignment_statement_p(statement)
Test if a statement is an assignment.
Definition: statement.c:135
#define DEFAULT_INTEGER_TYPE_SIZE
#define ENTITY_PLUS_C_P(e)
#define ENTITY_MINUS_C_P(e)
#define MINUS_C_OPERATOR_NAME
#define PLUS_C_OPERATOR_NAME
bool expression_integer_value(expression e, intptr_t *pval)
Definition: eval.c:792
bool expression_call_p(expression e)
Definition: expression.c:415
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
Definition: expression.c:1347
call expression_call(expression e)
Definition: expression.c:445
void AddLocalEntityToDeclarations(entity, entity, statement)
Add the variable entity e to the list of variables of the function module.
Definition: variable.c:233
entity make_new_scalar_variable(entity, basic)
Definition: variable.c:741
#define sequence_statements(x)
Definition: ri.h:2360
Definition: statement.c:4047
struct block block
static bool do_terapix_loop_optimizer(call c, tlo_context_t *ctxt)
Definition: terapixify.c:479

References AddLocalEntityToDeclarations(), assignment_statement_p(), binary_call_lhs, binary_call_rhs, call_domain, call_function, CONS, copy_statement(), DEFAULT_INTEGER_TYPE_SIZE, do_terapix_loop_optimizer(), ENDP, entity_intrinsic(), ENTITY_MINUS_C_P, ENTITY_PLUS_C_P, expression_call(), expression_call_p(), expression_equal_p(), expression_integer_value(), expression_to_entity(), FOREACH, free_statement(), gen_context_recurse, gen_copy_seq(), gen_free_list(), gen_nreverse(), gen_null2(), gen_remove(), get_current_module_entity(), get_referenced_entities(), insert_statement(), intptr_t, loop_body, make_basic_int(), make_block_statement(), make_new_scalar_variable(), MINUS_C_OPERATOR_NAME, NIL, PLUS_C_OPERATOR_NAME, sequence_statements, set_belong_p(), set_free(), STATEMENT, statement_block(), statement_block_p, statement_call(), statement_loop(), statement_loop_p(), statement_sequence(), and tlo_context_t::success.

Referenced by normalize_microcode().

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

◆ terapix_mask_entity_p()

static bool terapix_mask_entity_p ( entity  e)
static

Definition at line 150 of file terapixify.c.

150  {
152 }

References entity_bool::e, TERAPIX_MASK_PREFIX, and terapix_renamed_entity_p().

Referenced by do_terapix_pointer_initialized_from_a_mask_p().

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

◆ terapix_normalize_tests()

static void terapix_normalize_tests ( call  c)
static

a test is normalized when it is in the form a>0

Definition at line 362 of file terapixify.c.

362  {
363  entity op = call_function(c);
364  if(ENTITY_CONDITIONAL_P(op)) {
365  expression cond = binary_call_lhs(c);
366  if(expression_call_p(cond)) {
367  call c = expression_call(cond);
368  entity op = call_function(c);
369  if(ENTITY_GREATER_THAN_P(op)) {
370  expression etmp = MakeBinaryCall(
374  );
377  );
378  free_expression(etmp);
379  }
380  else if(ENTITY_LESS_THAN_P(op)) {
381  expression etmp = MakeBinaryCall(
385  );
389  free_expression(etmp);
390  }
391  else
392  pips_internal_error("case not handled yet\n");
393  }
394  else
395  pips_internal_error("does not know how to handle this conditional");
396  }
397 }
syntax copy_syntax(syntax p)
SYNTAX.
Definition: ri.c:2442
#define pips_internal_error
Definition: misc-local.h:149
#define GREATER_THAN_OPERATOR_NAME
#define ENTITY_LESS_THAN_P(e)
#define ENTITY_CONDITIONAL_P(e)
#define ENTITY_GREATER_THAN_P(e)
#define expression_syntax(x)
Definition: ri.h:1247

References binary_call_lhs, binary_call_rhs, call_function, copy_expression(), copy_syntax(), ENTITY_CONDITIONAL_P, ENTITY_GREATER_THAN_P, entity_intrinsic(), ENTITY_LESS_THAN_P, expression_call(), expression_call_p(), expression_syntax, free_expression(), GREATER_THAN_OPERATOR_NAME, MakeBinaryCall(), MINUS_OPERATOR_NAME, pips_internal_error, and update_expression_syntax().

Referenced by normalize_microcode().

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

◆ terapix_optimize_accumulator()

static void terapix_optimize_accumulator ( statement  st)
static

if only one register is ever written by a sequence of assignment, take advantage of it

first ensure it's a sequence of assignment

then check that the written register is always the same

finally, rename this entity as the accumulator P

Definition at line 442 of file terapixify.c.

442  {
443  if(statement_block_p(st)) {
444  /* first ensure it's a sequence of assignment */
447  return;
448  /* then check that the written register is always the same */
451  if(!continue_statement_p(s)) {
453  entity scalar = expression_int_scalar(lhs);
454  if(entity_undefined_p(scalar))
455  continue;
456  if(entity_undefined_p(reg))
457  reg=scalar;
458  else if(!same_entity_p(reg,scalar))
459  return;
460  }
461  }
462  /* finally, rename this entity as the accumulator P */
463 #define TERAPIX_ACC "P"
465  if(entity_undefined_p(P)) {
468  }
469  replace_entity(st,reg,P);
470  }
471 }
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
entity expression_int_scalar(expression exp)
================================================================
entity make_scalar_entity(const char *, const char *, basic)
entity make_scalar_entity(name, module_name, base)
Definition: variable.c:331
#define TERAPIX_ACC

References AddEntityToCurrentModule(), assignment_statement_p(), binary_call_lhs, continue_statement_p(), DEFAULT_INTEGER_TYPE_SIZE, entity_undefined, entity_undefined_p, expression_int_scalar(), FindEntityFromUserName(), FOREACH, get_current_module_name(), make_basic_int(), make_scalar_entity(), replace_entity(), same_entity_p(), STATEMENT, statement_block(), statement_block_p, statement_call(), and TERAPIX_ACC.

Referenced by normalize_microcode().

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

◆ terapix_pointer_initialized_from_a_mask_p()

static bool terapix_pointer_initialized_from_a_mask_p ( entity  e)
static

Definition at line 354 of file terapixify.c.

354  {
355  context c = { .ref=e, .res=false };
358  return c.res;
359 }
Definition: delay.c:253
static void do_terapix_pointer_initialized_from_a_mask_p(call c, context *ctxt)
Definition: terapixify.c:327

References call_domain, do_terapix_pointer_initialized_from_a_mask_p(), gen_context_recurse, gen_true2(), get_current_module_statement(), context::ref, and context::res.

Referenced by normalize_microcode().

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

◆ terapix_remove_divide()

bool terapix_remove_divide ( const string  module_name)

prelude

converts divide operator into multiply operator: a/cste = a* (1/b) ~= a * ( 128 / cste ) / 128

validate

ostlude

Parameters
module_nameodule_name

Definition at line 1045 of file terapixify.c.

1046 {
1047  /* prelude */
1050 
1051  /* converts divide operator into multiply operator:
1052  * a/cste = a* (1/b) ~= a * ( 128 / cste ) / 128
1053  */
1055 
1056  /* validate */
1058 
1059  /*postlude*/
1062  return true;
1063 }
static void do_terapix_remove_divide(call c)
Definition: terapixify.c:1011

References call_domain, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, do_terapix_remove_divide(), gen_recurse, gen_true(), get_current_module_statement(), module_name(), module_name_to_entity(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), and set_current_module_statement().

+ Here is the call graph for this function:

◆ terapix_renamed_entity_p()

static bool terapix_renamed_entity_p ( entity  e,
const char *  prefix 
)
static

Definition at line 147 of file terapixify.c.

147  {
149 }
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
static bool terapix_renamed_local_p(const char *s, const char *prefix)
Definition: terapixify.c:135

References entity_bool::e, entity_local_name(), prefix, and terapix_renamed_local_p().

Referenced by compare_formal_parameters(), and terapix_mask_entity_p().

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

◆ terapix_renamed_local_p()

static bool terapix_renamed_local_p ( const char *  s,
const char *  prefix 
)
static

Definition at line 135 of file terapixify.c.

136 {
137  string found = strstr(s,prefix);
138  if(found)
139  {
140  for(found+=strlen(prefix);*found;++found)
141  if(!isdigit(*found)) return false;
142  return true;
143  }
144  return false;
145 }

References prefix.

Referenced by terapix_renamed_entity_p(), and terapix_renamed_p().

+ Here is the caller graph for this function:

◆ terapix_renamed_p()

static bool terapix_renamed_p ( const char *  s)
static

◆ terapix_suitable_loop_bound_p()

static bool terapix_suitable_loop_bound_p ( expression  exp)
static

Definition at line 231 of file terapixify.c.

232 {
233  bool suitable=true;
235  return suitable;
236 }
static bool terapix_suitable_loop_bound_walker(reference r, bool *suitable)
Definition: terapixify.c:225

References exp, gen_context_recurse, gen_null2(), reference_domain, and terapix_suitable_loop_bound_walker().

Referenced by terapix_loop_handler().

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

◆ terapix_suitable_loop_bound_walker()

static bool terapix_suitable_loop_bound_walker ( reference  r,
bool suitable 
)
static

Definition at line 225 of file terapixify.c.

226 {
227  return (*suitable) &= formal_parameter_p(reference_variable(r));
228 }

References formal_parameter_p(), and reference_variable.

Referenced by terapix_suitable_loop_bound_p().

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

◆ terapix_warmup()

bool terapix_warmup ( const char *  module_name)

prelude

go go power rangers

validate

ostlude

Parameters
module_nameodule_name

Definition at line 908 of file terapixify.c.

908  {
909  /* prelude */
912 
913  /* go go power rangers */
914  bool can_terapixify =
916 
917  /* validate */
920 
921  /*postlude*/
924  return can_terapixify;
925 
926 }
static bool do_terapix_warmup(statement top)
make sure s is of the form decl loop nest
Definition: terapixify.c:879

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, do_terapix_warmup(), get_current_module_statement(), module_name(), module_name_to_entity(), module_reorder(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), and set_current_module_statement().

+ Here is the call graph for this function:

◆ terapixify_loop_purge()

static void terapixify_loop_purge ( statement  s,
entity  e 
)
static

Definition at line 399 of file terapixify.c.

399  {
400  if(statement_call_p(s)) {
402  if(set_belong_p(re,e)) {
404  }
405  set_free(re);
406  }
407 }
instruction make_continue_instruction()
Creates a CONTINUE instruction, that is the FORTRAN nop, the ";" in C or the "pass" in Python for exa...
Definition: instruction.c:79
bool statement_call_p(statement)
Definition: statement.c:364
statement update_statement_instruction(statement, instruction)
Replace the instruction in statement s by instruction i.
Definition: statement.c:3039

References get_referenced_entities(), make_continue_instruction(), set_belong_p(), set_free(), statement_call_p(), and update_statement_instruction().

Referenced by terapixify_loops().

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

◆ terapixify_loops()

static void terapixify_loops ( statement  s)
static

look for iterators

now try to hide the iteration in a pointer access somewhere

be optimistic: even if we failed, remove the iterator

Definition at line 565 of file terapixify.c.

565  {
566  if(statement_loop_p(s)) {
567  loop l =statement_loop(s);
568  entity index = loop_index(l);
569  range r = loop_range(l);
573  full_loop_unroll(s);
574  if(statement_block_p(s)) {
576  list bblock= gen_copy_seq(block);
577  /* look for iterators */
578  for(list iter = bblock; !ENDP(iter) ; POP(iter)) {
579  statement s = STATEMENT(CAR(iter));
580  if(assignment_statement_p(s)) {
581  call c = statement_call(s);
582  expression lhs = binary_call_lhs(c),
583  rhs = binary_call_rhs(c);
584  if(expression_call_p(rhs)) {
585  call c = expression_call(rhs);
586  entity op = call_function(c);
587  if(ENTITY_PLUS_C_P(op) || ENTITY_MINUS_C_P(op)) {
588  bool plus = ENTITY_PLUS_C_P(op);
589  intptr_t step;
590  if(expression_equal_p(binary_call_lhs(c),lhs) &&
591  expression_integer_value(binary_call_rhs(c),&step)&&step==1) {
592  entity iterator = expression_to_entity(lhs);
593  /* now try to hide the iteration in a pointer access somewhere */
594  tlo_context_t ctxt = {iterator,plus,false };
595  FOREACH(STATEMENT,ss,iter) {
596  set re = get_referenced_entities(ss);
597  if(set_belong_p(re,iterator)) {
599  if(ctxt.success) {
600  set_free(re);
601  break;
602  }
603  }
604  set_free(re);
605  }
606  /* be optimistic: even if we failed, remove the iterator */
607  gen_remove(&block,s);
608  free_statement(s);
609  }
610  }
611  }
612  }
613  }
614  gen_free_list(bblock);
616  }
617  }
618  }
619 }
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
Definition: expression.c:2453
void full_loop_unroll(statement loop_statement)
get rid of the loop by body replication;
Definition: loop_unroll.c:788
#define range_increment(x)
Definition: ri.h:2292
#define range_lower(x)
Definition: ri.h:2288
static void terapixify_loop_purge(statement s, entity e)
Definition: terapixify.c:399

References assignment_statement_p(), binary_call_lhs, binary_call_rhs, call_domain, call_function, CAR, do_terapix_loop_optimizer(), ENDP, ENTITY_MINUS_C_P, ENTITY_PLUS_C_P, expression_call(), expression_call_p(), expression_constant_p(), expression_equal_p(), expression_integer_value(), expression_to_entity(), FOREACH, free_statement(), full_loop_unroll(), gen_context_recurse, gen_copy_seq(), gen_free_list(), gen_null2(), gen_remove(), gen_true2(), get_referenced_entities(), intptr_t, loop_index, loop_range, POP, range_increment, range_lower, range_upper, set_belong_p(), set_free(), STATEMENT, statement_block(), statement_block_p, statement_call(), statement_domain, statement_loop(), statement_loop_p(), tlo_context_t::success, and terapixify_loop_purge().

Referenced by normalize_microcode().

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

◆ two_addresses_code_generator()

static void two_addresses_code_generator ( statement  s)
static

a=b+c; -> (1) a=b; (2) a=a+c;

Definition at line 948 of file terapixify.c.

949 {
950  if(statement_call_p(s))
951  {
952  call c = statement_call(s);
954  {
955  list args = call_arguments(c);
956  expression lhs = EXPRESSION(CAR(args));
957  expression rhs = EXPRESSION(CAR(CDR(args)));
959  list e_effects = proper_effects_of_expression(rhs);
960  bool conflict=false;
961  FOREACH(EFFECT,we,w_effects) {
962  FOREACH(EFFECT,e,e_effects) {
963  if((conflict=effects_may_conflict_p(e,we))) {
964  goto end;
965  }
966  }
967  }
968 end:
969  gen_full_free_list(e_effects);
971 
973  call parent_call = call_undefined;
974  do {
975  parent_call=expression_call(rhs);
976  rhs=EXPRESSION(CAR(call_arguments(parent_call)));
978  if(! expression_equal_p(lhs,rhs) )
979  {
980  /* a=b+c; -> (1) a=b; (2) a=a+c; */
982  statement thecall/*2*/= s;
983  CAR(call_arguments(parent_call)).p=(gen_chunkp)copy_expression(lhs);
984  insert_statement(thecall,theassign,true);
985  }
986  }
987  }
988  }
989 }
list load_cumulated_rw_effects_list(statement)
list effects_write_effects(list)
list proper_effects_of_expression(expression)
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
void gen_full_free_list(list l)
Definition: genClib.c:1023
bool effects_may_conflict_p(effect eff1, effect eff2)
Check if two effect may conflict @description Two effects may conflict if their abstract two location...
Definition: conflicts.c:162
char end
Definition: gtk_status.c:82
#define call_undefined
Definition: ri.h:685
static list * w_effects
PDSon: w_effect store all the variables modified in the sequence of statement.
static bool two_addresses_code_generator_split_p(expression e)
Definition: terapixify.c:935

References call_arguments, call_function, call_undefined, CAR, CDR, copy_expression(), EFFECT, effects_may_conflict_p(), effects_write_effects(), end, ENTITY_ASSIGN_P, EXPRESSION, expression_call(), expression_call_p(), expression_equal_p(), FOREACH, gen_free_list(), gen_full_free_list(), insert_statement(), load_cumulated_rw_effects_list(), make_assign_statement(), proper_effects_of_expression(), statement_call(), statement_call_p(), two_addresses_code_generator_split_p(), and w_effects.

Referenced by generate_two_addresses_code().

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

◆ two_addresses_code_generator_split_p()

static bool two_addresses_code_generator_split_p ( expression  e)
static
Parameters
e
Returns

Definition at line 935 of file terapixify.c.

936 {
937  if(expression_call_p(e))
938  {
939  call c = expression_call(e);
940  entity op = call_function(c);
941  return ! call_constant_p(c) && (!get_bool_property("GENERATE_TWO_ADDRESSES_CODE_SKIP_DEREFERENCING") || !ENTITY_DEREFERENCING_P(op));
942  }
943  else
944  return false;
945 }
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....

References call_constant_p, call_function, ENTITY_DEREFERENCING_P, expression_call(), expression_call_p(), and get_bool_property().

Referenced by two_addresses_code_generator().

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

Variable Documentation

◆ tw_loop_index

entity tw_loop_index
static

Definition at line 838 of file terapixify.c.

Referenced by do_terapix_warmup(), and do_terapix_warmup_patching().