PIPS
complexity-local.h
Go to the documentation of this file.
1
/*
2
3
$Id: complexity-local.h 23065 2016-03-02 09:05:50Z coelho $
4
5
Copyright 1989-2016 MINES ParisTech
6
7
This file is part of PIPS.
8
9
PIPS is free software: you can redistribute it and/or modify it
10
under the terms of the GNU General Public License as published by
11
the Free Software Foundation, either version 3 of the License, or
12
any later version.
13
14
PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15
WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
FITNESS FOR A PARTICULAR PURPOSE.
17
18
See the GNU General Public License for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22
23
*/
24
/*
25
*
26
* COMPLEXITY EVALUATION P. Berthomier 21-08-90
27
*
28
* L. Zhou 21-03-90
29
*
30
* Modifications:
31
* - deletion of includes in this include file; Francois Irigoin,
32
* 13 March 1991
33
*
34
* - deletion of #define for operators ;
35
* (all the operators and the instrinsics are defined inside of ri-util-local.h); Molka Becher, 08.03.2011
36
*/
37
#include "
matrice.h
"
38
39
#define COMPLEXITY_PACKAGE_NAME "COMPLEXITY"
40
#define COMPLEXITY_UNDEFINED complexity_undefined
41
/*
42
#define COMPLEXITY_UNDEFINED_SYMBOL "<Complexity undefined>"
43
*/
44
#define COMPLEXITY_UNDEFINED_P(c) ((c)==complexity_undefined)
45
#define COMPLEXITY_NOT_FOUND ((complexity) HASH_UNDEFINED_VALUE)
46
47
#define MAX_CONTROLS_IN_UNSTRUCTURED 100
48
49
/* pseudo-variable for unknown variables */
50
#define UNKNOWN_VARIABLE_NAME "UNKNOWN_VARIABLE"
51
52
/* pseudo-variable for default iteration number of a loop */
53
#define UNKNOWN_RANGE_NAME "UNKNOWN_RANGE"
54
55
#define TCST_NAME "_TCST_"
56
57
/* Prefix added to a variable name when its value is unknown but has to
58
* be used in a complexity formulae
59
*/
60
#define UNKNOWN_VARIABLE_VALUE_PREFIX "U_"
61
62
/* defined complexity data file names here. LZ 13/03/92 */
63
#define COST_DATA "operation index memory trigo transcend overhead"
64
65
/* defines for "complexity_fprint" calls */
66
#define DO_PRINT_STATS true
67
#define DONT_PRINT_STATS false
68
#define PRINT_LOCAL_NAMES true
69
#define PRINT_GLOBAL_NAMES false
70
71
#define HASH_LOOP_INDEX ((char *) 4)
/* Used as `value' field in the hash-table */
72
#define HASH_USER_VARIABLE ((char *) 8)
/* "hash_complexity_parameters"... useful? */
73
#define HASH_FORMAL_PARAM ((char *) 12)
74
#define HASH_COMMON_VARIABLE ((char *) 16)
/* used for variable in common. LZ 04/12/91 */
75
76
#define ZERO_BYTE 0
77
#define INT_NBYTES 4
/* number of bytes used by a standard int */
78
#define FLOAT_NBYTES 4
/* number of bytes used by a single-precision */
79
#define DOUBLE_NBYTES 8
/* number of bytes used by a double-precision */
80
#define COMPLEX_NBYTES 2*FLOAT_NBYTES
/* complex, single-precision */
81
#define DCOMPLEX_NBYTES 2*DOUBLE_NBYTES
/* complex, double-precision */
82
#define MAKE_INT_BASIC make_basic(is_basic_int, (void *) INT_NBYTES)
83
#define MAKE_ADDRESS_BASIC make_basic(is_basic_int, (void *) DEFAULT_POINTER_TYPE_SIZE)
84
#define MAKE_FLOAT_BASIC make_basic(is_basic_float, (void *) FLOAT_NBYTES)
85
#define MAKE_DOUBLE_BASIC make_basic(is_basic_float, (void *) DOUBLE_NBYTES)
86
#define MAKE_COMPLEX_BASIC make_basic(is_basic_complex, (void *) COMPLEX_NBYTES)
87
#define MAKE_DCOMPLEX_BASIC make_basic(is_basic_complex, (void *) DCOMPLEX_NBYTES)
88
#define MAKE_STRING_BASIC make_basic(is_basic_string, make_value(is_value_unknown, UU))
89
90
#define hash_contains_p(htp, key) (hash_get(htp, key) != HASH_UNDEFINED_VALUE)
91
#define hash_contains_formal_param_p(htp, key) (hash_get(htp, key) == HASH_FORMAL_PARAM)
92
#define hash_contains_user_var_p(htp, key) (hash_get(htp, key) == HASH_USER_VARIABLE)
93
#define hash_contains_common_var_p(htp, key) (hash_get(htp, key) == HASH_COMMON_VARIABLE)
94
#define hash_contains_loop_index_p(htp, key) (hash_get(htp, key) == HASH_LOOP_INDEX)
95
96
97
/* defines for "expression_to_polynome" parameters */
98
#define KEEP_SYMBOLS true
99
#define DONT_KEEP_SYMBOLS false
100
#define MAXIMUM_VALUE 1
101
#define MINIMUM_VALUE -1
102
#define EXACT_VALUE 0
103
#define TAKE_MAX(m) ((m) == MAXIMUM_VALUE)
104
#define TAKE_MIN(m) ((m) == MINIMUM_VALUE)
105
#define KEEP_EXACT(m) ((m) == EXACT_VALUE)
106
107
/* Intrinsics costs defines */
108
109
typedef
struct
intrinsic_cost_rec
{
110
char
*
name
;
111
_int
min_basic_result
;
112
_int
min_nbytes_result
;
113
_int
int_cost
;
114
_int
float_cost
;
115
_int
double_cost
;
116
_int
complex_cost
;
117
_int
dcomplex_cost
;
118
}
intrinsic_cost_record
;
119
120
#define LOOP_INIT_OVERHEAD "LOOP-INIT-OVERHEAD"
121
#define LOOP_BRANCH_OVERHEAD "LOOP-BRANCH-OVERHEAD"
122
#define CONDITION_OVERHEAD "CONDITION-OVERHEAD"
123
124
#define CALL_ZERO_OVERHEAD "CALL-ZERO-OVERHEAD"
125
#define CALL_ONE_OVERHEAD "CALL-ONE-OVERHEAD"
126
#define CALL_TWO_OVERHEAD "CALL-TWO-OVERHEAD"
127
#define CALL_THREE_OVERHEAD "CALL-THREE-OVERHEAD"
128
#define CALL_FOUR_OVERHEAD "CALL-FOUR-OVERHEAD"
129
#define CALL_FIVE_OVERHEAD "CALL-FIVE-OVERHEAD"
130
#define CALL_SIX_OVERHEAD "CALL-SIX-OVERHEAD"
131
#define CALL_SEVEN_OVERHEAD "CALL-SEVEN-OVERHEAD"
132
133
/* TYPE_CAST_COST added to handle cast case ; Molka Becher */
134
#define TYPE_CAST_COST "TypeCast"
135
136
/* the above two lines are added for 6th cost file, overhead. LZ 280993 */
137
/* overhead is divided into two. init and branch 081093 */
138
139
#define MEMORY_READ_NAME "MEMORY-READ"
140
#define ONE_INDEX_NAME "ONE-INDEX"
/* to count indexation costs in multi-dim arrays */
141
#define TWO_INDEX_NAME "TWO-INDEX"
/* to count indexation costs in multi-dim arrays */
142
#define THREE_INDEX_NAME "THREE-INDEX"
143
#define FOUR_INDEX_NAME "FOUR-INDEX"
144
#define FIVE_INDEX_NAME "FIVE-INDEX"
145
#define SIX_INDEX_NAME "SIX-INDEX"
146
#define SEVEN_INDEX_NAME "SEVEN-INDEX"
147
#define STRING_INTRINSICS_COST 1
148
#define LOGICAL_INTRINSICS_COST 1
149
150
#define DONT_COUNT_THAT 0, 0, 0, 0, 0
151
#define EMPTY_COST 0,0,0,0,0
152
#define DISCRIMINE_TYPES 1, 10, 100,1000,10000
153
#define REAL_INTRINSIC 100, 100, 100, 100, 100
154
#define DOUBLE_INTRINSIC 200, 200, 200, 200, 200
155
#define COMPLEX_INTRINSIC 400, 400, 400, 400, 400
156
157
#define MEMORY_READ_COST DONT_COUNT_THAT
158
#define MEMORY_WRITE_COST DONT_COUNT_THAT
159
#define PLUS_MINUS_COST 1, 10, 20, 20, 40
160
/*
161
#define MULTIPLY_COST 50, 50, 100, 100, 200
162
#define DIVIDE_COST 50, 50, 100, 100, 200
163
*/
164
#define MULTIPLY_COST PLUS_MINUS_COST
165
#define DIVIDE_COST PLUS_MINUS_COST
166
#define POWER_COST 100, 100, 200, 200, 400
167
168
#define TRANSC_COST REAL_INTRINSIC
169
#define DTRANSC_COST DOUBLE_INTRINSIC
170
#define CTRANSC_COST COMPLEX_INTRINSIC
171
#define TRIGO_COST REAL_INTRINSIC
172
#define DTRIGO_COST DOUBLE_INTRINSIC
173
#define CTRIGO_COST COMPLEX_INTRINSIC
174
#define TRIGOH_COST REAL_INTRINSIC
175
#define DTRIGOH_COST DOUBLE_INTRINSIC
176
#define CTRIGOH_COST COMPLEX_INTRINSIC
177
178
#define TWO_INDEX_COST DONT_COUNT_THAT
179
#define THREE_INDEX_COST DONT_COUNT_THAT
180
#define FOUR_INDEX_COST DONT_COUNT_THAT
181
#define FIVE_INDEX_COST DONT_COUNT_THAT
182
#define SIX_INDEX_COST DONT_COUNT_THAT
183
#define SEVEN_INDEX_COST DONT_COUNT_THAT
184
intrinsic_cost_record
struct intrinsic_cost_rec intrinsic_cost_record
Intrinsics costs defines.
matrice.h
_int
intptr_t _int
_INT
Definition:
newgen_types.h:53
intrinsic_cost_rec
Intrinsics costs defines.
Definition:
complexity-local.h:109
intrinsic_cost_rec::float_cost
_int float_cost
Definition:
complexity-local.h:114
intrinsic_cost_rec::complex_cost
_int complex_cost
Definition:
complexity-local.h:116
intrinsic_cost_rec::dcomplex_cost
_int dcomplex_cost
Definition:
complexity-local.h:117
intrinsic_cost_rec::name
char * name
Definition:
complexity-local.h:110
intrinsic_cost_rec::min_basic_result
_int min_basic_result
Definition:
complexity-local.h:111
intrinsic_cost_rec::min_nbytes_result
_int min_nbytes_result
Definition:
complexity-local.h:112
intrinsic_cost_rec::int_cost
_int int_cost
Definition:
complexity-local.h:113
intrinsic_cost_rec::double_cost
_int double_cost
Definition:
complexity-local.h:115
pips
src
Libs
complexity
complexity-local.h
Generated on Thu Sep 26 2024 22:11:35 for PIPS by
1.9.1