00001
00002
00003 #ifndef _DIRECTIVE_H
00004 #define _DIRECTIVE_H
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef POLARIS_GNU_PRAGMAS
00025 #pragma interface
00026 #endif
00027
00028 #include <stream.h>
00029 #include <strstream.h>
00030
00031 #include "../Boolean.h"
00032 #include "../Listable.h"
00033 #include "../String.h"
00034 #include "../StringElem.h"
00035 #include "../Collection/List.h"
00036
00037 class BlockEntryStmt;
00038 class BlockExitStmt;
00039 class StmtList;
00040
00041 enum DirectiveType {
00042 DT_NONE = 0,
00043 DT_CSRD,
00044 DT_HPF,
00045 DT_CRAY,
00046 DT_KSR,
00047 DT_CONVEX,
00048 DT_SGI,
00049 DT_CONVEX_SPP,
00050 DT_CEDAR_FORTRAN,
00051 DT_CRAY_T3D,
00052 DT_COMMENT,
00053 DT_CF_F77,
00054 DT_SGI_POWER,
00055 DT_KAP_SGI,
00056 DT_TREADMARKS,
00057 DT_FAST_MESSAGES,
00058
00059 DT_OMP,
00060
00061 DT_ZHU = 25
00062 };
00063
00064 enum DirectiveState {
00065 DS_NONE,
00066 DS_PARSED,
00067 DS_GENERATED
00068 };
00069
00070 class ProgramUnit;
00071 class Statement;
00072 class Expression;
00073 class DirectiveList;
00074 class Assertion;
00075 class AssertionList;
00076
00077 class Directive : public Listable {
00078 friend class DirectiveList;
00079 friend inline ostream & operator << (ostream & o, const Directive & d)
00080 { d.print(o); return o; }
00081
00082 protected:
00083 DirectiveType _dtype;
00084 DirectiveState _dstate;
00085
00086 List<StringElem> _text;
00087 List<StringElem> _tokens;
00088
00089 AssertionList *_alist;
00090
00091 void generate_recurrence_directive( Statement &s, Assertion &ap );
00092
00093
00094 void generate_comment_directive( Statement &s, Assertion &ap );
00095
00096
00097 void generate_csrd_shared_directive( Statement &s, Assertion &a );
00098
00099
00100 void generate_csrd_induction_directive( Statement &s, Assertion &a );
00101
00102
00103 void generate_csrd_parcondition_directive( Statement &s, Assertion &a );
00104
00105
00106 void generate_csrd_maymod_directive( Statement &s, Assertion &a );
00107
00108
00109 void generate_csrd_nomod_directive( Statement &s, Assertion &a );
00110
00111
00112 void generate_csrd_looplabel_directive( Statement &s, Assertion &a );
00113
00114
00115 void generate_csrd_schedule_directive( Statement &s, Assertion &a );
00116
00117
00118 void generate_csrd_private_directive( Statement &s, Assertion &ap );
00119
00120
00121 void generate_csrd_dep_WFvsRO_directive( Statement &s, Assertion &a );
00122
00123
00124 void generate_csrd_dep_RWvsWF_directive( Statement &s, Assertion &a );
00125
00126
00127 void generate_csrd_dep_ROvsRW_directive( Statement &s, Assertion &a );
00128
00129
00130 void generate_csrd_dep_overlap_directive( Statement &s, Assertion &a );
00131
00132
00133 void generate_csrd_private_descr_directive( Statement &s, Assertion &a );
00134
00135
00136 void generate_csrd_test_monotone_directive( Statement &s, Assertion &a );
00137
00138
00139 void generate_csrd_reduct_descr_directive( Statement &s, Assertion &a );
00140
00141
00142 void generate_csrd_overlap_directive( Statement &s, Assertion &a );
00143
00144
00145 void generate_csrd_overlap_sort_directive( Statement &s, Assertion &a );
00146
00147
00148 void generate_csrd_safe_condition_directive( Statement &s, Assertion &ap );
00149
00150
00151 void generate_csrd_assert_directive( Statement &s, Assertion &ap );
00152
00153
00154 void generate_csrd_serial_directive( Statement &s, Assertion &ap );
00155
00156
00157 void generate_csrd_critical_directive( Statement &s, Assertion &ap );
00158
00159
00160 void generate_csrd_reduction_directive( Statement &s, Assertion &ap );
00161
00162
00163 void generate_csrd_dynlastvalue_directive( Statement &s, Assertion &ap );
00164
00165
00166 void generate_csrd_lastvalue_directive( Statement &s, Assertion &ap );
00167
00168
00169 void generate_csrd_nodependence_directive( Statement &s, Assertion &ap );
00170
00171
00172 void generate_csrd_sideeffectfree_directive( Statement &s, Assertion &ap );
00173
00174
00175 void generate_csrd_rangewritten_directive( Statement &s, Assertion &ap );
00176
00177
00178 void generate_csrd_firstvalue_directive( Statement &s, Assertion &ap );
00179
00180
00181 void Directive::generate_csrd_forward_directive( Statement &s, Assertion &a );
00182
00183
00184 void generate_csrd_privaterefs_directive( Statement &s, Assertion &a );
00185
00186
00187 void generate_csrd_readonlyrefs_directive( Statement &s, Assertion &a );
00188
00189
00190 void generate_csrd_sharedrefs_directive( Statement &s, Assertion &a );
00191
00192
00193 void generate_csrd_prologue_directive( Statement &s, Assertion &ap );
00194
00195
00196 void generate_csrd_epilogue_directive( Statement &s, Assertion &ap );
00197
00198
00199 void generate_csrd_parallel_directive( Statement &s, Assertion &ap );
00200
00201
00202 void generate_csrd_preamble_directive( Statement &s, Assertion &a );
00203
00204
00205 void generate_csrd_postamble_directive( Statement &s, Assertion &a );
00206
00207
00208 void generate_csrd_instrument_directive( Statement &s, Assertion &a );
00209
00210
00211 void generate_csrd_rtshadow_directive( Statement &s, Assertion &a );
00212
00213
00214 void generate_csrd_dep_io_directive( Statement &s, Assertion &a );
00215
00216
00217 void generate_csrd_inline_directive( Statement &s, Assertion &a );
00218
00219
00220 void generate_csrd_recursive_inline_directive( Statement &s, Assertion &a );
00221
00222
00223 void generate_csrd_noinline_directive( Statement &s, Assertion &a );
00224
00225
00226 void generate_csrd_noputget_directive( Statement &s, Assertion &a );
00227
00228
00229 void generate_csrd_runtimetest_directive( Statement &s, Assertion &a );
00230
00231
00232 void generate_comment_directive( Statement &s );
00233
00234
00235 void generate_csrd_directive( Statement &s );
00236
00237
00238
00239
00240 void generate_convex_private_directive( Statement &s, Assertion &ap );
00241
00242
00243 void generate_convex_serial_directive( Statement &s, Assertion &ap );
00244
00245
00246 void generate_convex_reduction_directive( Statement &s, Assertion &ap );
00247
00248
00249 void generate_convex_lastvalue_directive( Statement &s, Assertion &ap );
00250
00251
00252 void generate_convex_prologue_directive( Statement &s, Assertion &ap );
00253
00254
00255 void generate_convex_epilogue_directive( Statement &s, Assertion &ap );
00256
00257
00258 void generate_convex_parallel_directive( Statement &s, Assertion &ap );
00259
00260
00261 void generate_convex_directive( Statement &s );
00262
00263
00264
00265
00266 void generate_sgi_prologue_directive( Statement &s, Assertion &ap );
00267
00268
00269 void generate_sgi_epilogue_directive( Statement &s, Assertion &ap );
00270
00271
00272 void generate_sgi_parallel_directive( Statement &s, Assertion &ap );
00273
00274
00275 void generate_sgi_directive( Statement &s );
00276
00277
00278
00279
00280
00281
00282 void generate_omp_parallel_directive(Statement &s, Assertion& a);
00283
00284
00285 void generate_omp_do_directive(Statement &s, Assertion &a);
00286
00287
00288 void generate_omp_end_parallel_directive(Statement &s, Assertion &a);
00289
00290
00291 void generate_omp_critical_directive(Statement &s, Assertion &a);
00292
00293
00294 void generate_omp_directive(Statement &s);
00295
00296
00297 void break_line(char * sentinel, char * subdir, strstream& o);
00298
00299
00300
00301
00302
00303 void generate_hpf_directive( Statement &s );
00304
00305
00306
00307
00308 void generate_cray_directive( Statement &s );
00309
00310
00311
00312
00313 void generate_ksr_directive( Statement &s );
00314
00315
00316
00317
00318 void generate_cray_t3d_shared_directive( Statement &s, Assertion &a );
00319 void generate_cray_t3d_private_directive( Statement &s, Assertion &a );
00320
00321 void generate_cray_t3d_directive( Statement &s );
00322
00323
00324
00325
00326 void generate_convex_spp_private_directive( Statement &s, Assertion &ap );
00327
00328
00329 void generate_convex_spp_serial_directive( Statement &s, Assertion &ap );
00330
00331
00332 void generate_convex_spp_critical_directive( Statement &s, Assertion &ap );
00333
00334
00335 void generate_convex_spp_reduction_directive( Statement &s, Assertion &ap );
00336
00337
00338 void generate_convex_spp_lastvalue_directive( Statement &s, Assertion &ap );
00339
00340
00341 void generate_convex_spp_parallel_directive( Statement &s, Assertion &ap );
00342
00343
00344 void generate_convex_spp_nodependence_directive( Statement &s, Assertion &ap );
00345
00346
00347 void generate_convex_spp_directive( Statement &s );
00348
00349
00350 void generate_convex_spp_nosideeffect_directive( Statement &s, Assertion &ap );
00351
00352
00353
00354
00355 public:
00356 Directive(DirectiveType dt = DT_NONE);
00357
00358
00359 Directive(String & s, DirectiveType dt = DT_NONE);
00360
00361
00362 Directive(List<StringElem> & sl, DirectiveType dt = DT_NONE);
00363
00364
00365 Directive(const Directive & d);
00366
00367
00368 Directive(const AssertionList &a, DirectiveType dt = DT_CSRD);
00369
00370
00371 int lines() const;
00372
00373
00374 const List<StringElem> & text_list() const;
00375 List<StringElem> & text_list();
00376
00377
00378 virtual ~Directive();
00379
00380
00381 void generate( Statement &s );
00382
00383
00384 virtual Directive & operator = (const Directive &d);
00385
00386
00387 virtual void print(ostream &o) const;
00388
00389
00390 virtual void write(ostream &o) const;
00391
00392
00393 virtual Listable *listable_clone() const;
00394
00395
00396 public:
00397
00398
00399 static void _ins_after(StmtList &stmts,
00400 Statement *curr_stmt,
00401 Statement *ref_stmt,
00402 char *method_name);
00403
00404
00405 static void _set_follow_fields(BlockEntryStmt &entry,
00406 BlockExitStmt &exit);
00407 };
00408
00409 #endif