00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00622 #ifndef access_vector_INCLUDED
00623 #define access_vector_INCLUDED "access_vector.h"
00624
00625 #ifdef _KEEP_RCS_ID
00626 static char *access_vector_rcs_id = access_vector_INCLUDED "$Revision: 1.5 $";
00627 #endif
00628
00629 #ifndef wn_INCLUDED
00630 #include "wn.h"
00631 #endif
00632 #ifndef cxx_memory_INCLUDED
00633 #include "cxx_memory.h"
00634 #endif
00635 #ifndef cxx_base_INCLUDED
00636 #include "cxx_base.h"
00637 #endif
00638 #ifndef cxx_template_INCLUDED
00639 #include "cxx_template.h"
00640 #endif
00641 #ifndef stab_INCLUDED
00642 #include "stab.h"
00643 #endif
00644
00645 #include "symtab_compatible.h"
00646
00647 #define MAX_TLOG_CHARS 3000
00648
00649 class SYSTEM_OF_EQUATIONS;
00650 typedef STACK<WN *> DOLOOP_STACK;
00651
00652
00653
00654
00655
00656
00657 struct INDX_RANGE {
00658 mBOOL Valid;
00659 mBOOL Min_Max_Valid;
00660
00661 INT64 Min;
00662 INT64 Max;
00663 INT64 Mult;
00664 INT64 Size;
00665 INDX_RANGE() : Valid(FALSE) {};
00666 void Union(INT64 offset, BOOL offset_valid, INT64 Mult, INT64 Size);
00667 INT64 Maxsize() const;
00668 };
00669
00670 typedef STACK<INDX_RANGE> INDX_RANGE_STACK;
00671
00672
00673 class SYMBOL {
00674 mBOOL _is_formal;
00675 union {
00676 ST* _st;
00677 INT _formal_number;
00678 } u;
00679 WN_OFFSET _WN_Offset;
00680 public:
00681 ST* ST_Base() const
00682 { FmtAssert(!_is_formal, ("SYMBOL::ST_Base(): Expecting non-formal"));
00683 return ST_base(u._st); }
00684 INT64 ST_Offset() const
00685 { FmtAssert(!_is_formal, ("SYMBOL::ST_Offset(): Expecting non-formal"));
00686 return ST_ofst(u._st); }
00687 WN_OFFSET WN_Offset() const
00688 { return _WN_Offset; }
00689 ST* St() const
00690 { FmtAssert(!_is_formal, ("SYMBOL::St(): Expecting non-formal"));
00691 return u._st; }
00692 INT Formal_Number() const
00693 { FmtAssert(_is_formal, ("SYMBOL::Formal_Number(): Expecting formal"));
00694 return u._formal_number; }
00695 BOOL Is_Formal() const { return _is_formal; }
00696 TYPE_ID Type;
00697
00698 SYMBOL (const SYMBOL& symbol) {
00699 _is_formal = symbol._is_formal;
00700 if (_is_formal) {
00701 u._formal_number = symbol.u._formal_number;
00702 } else {
00703 u._st = symbol.u._st;
00704 }
00705 _WN_Offset = symbol._WN_Offset;
00706 Type = symbol.Type;
00707 }
00708 void Init(const WN *wn) {
00709 FmtAssert(OPCODE_has_sym(WN_opcode(wn)),
00710 ("SYMBOL::Init(WN*) called with opcode %d", WN_opcode(wn)));
00711 _is_formal = FALSE;
00712 u._st = WN_st(wn);
00713 if (WN_operator(wn) == OPR_CONST ||
00714 WN_operator(wn) == OPR_INTCONST) {
00715 _WN_Offset = 0;
00716 Type = WN_rtype(wn);
00717 } else {
00718 _WN_Offset = WN_offset(wn);
00719 Type = WN_desc(wn);
00720 }
00721 }
00722 SYMBOL (const WN *wn) { Init(wn); }
00723 void Init(const SYMBOL *s) {
00724 _is_formal = s->_is_formal;
00725 if (_is_formal) {
00726 u._formal_number = s->u._formal_number;
00727 } else {
00728 u._st = s->u._st;
00729 }
00730 _WN_Offset = s->_WN_Offset;
00731 Type = s->Type;
00732 }
00733 SYMBOL(const SYMBOL *s) { Init(s); }
00734 BOOL operator ==(const SYMBOL &symbol) const {
00735 if (_is_formal != symbol._is_formal)
00736 return FALSE;
00737 if (_is_formal) {
00738 return (u._formal_number == symbol.u._formal_number &&
00739 _WN_Offset == symbol._WN_Offset &&
00740 Type == symbol.Type);
00741 } else {
00742 if (u._st == NULL || symbol.u._st == NULL)
00743 return (u._st == symbol.u._st &&
00744 _WN_Offset == symbol._WN_Offset);
00745 return (ST_Base() == symbol.ST_Base() &&
00746 ST_Offset() == symbol.ST_Offset() &&
00747 WN_Offset() == symbol.WN_Offset());
00748 }
00749 }
00750 BOOL operator !=(const SYMBOL &symbol) const {
00751 return (!(*this == symbol));
00752 }
00753 SYMBOL& operator=(const SYMBOL& symbol) {
00754 _is_formal = symbol._is_formal;
00755 if (_is_formal) {
00756 u._formal_number = symbol.u._formal_number;
00757 } else {
00758 u._st = symbol.u._st;
00759 }
00760 _WN_Offset = symbol._WN_Offset;
00761 Type = symbol.Type;
00762 return(*this);
00763 }
00764 SYMBOL(ST* st, WN_OFFSET wn_offset, TYPE_ID type) {
00765 _is_formal = FALSE;
00766 u._st = st;
00767 _WN_Offset = wn_offset;
00768 Type = type;
00769 }
00770 SYMBOL(INT formal_number, WN_OFFSET wn_offset, TYPE_ID type) {
00771 _is_formal = TRUE;
00772 u._formal_number = formal_number;
00773 _WN_Offset = wn_offset;
00774 Type = type;
00775 }
00776 SYMBOL() {
00777 _is_formal = FALSE; u._st = NULL; _WN_Offset = 0; Type = 0;
00778 }
00779 void Print(FILE *fp) const;
00780 INT Print(char* bf, INT ccount) const;
00781 char* Name() const;
00782 char* Prompf_Name() const;
00783 char* Name(char* buf, INT bufsz) const;
00784 };
00785
00786
00787
00788
00789 class INTSYMB_NODE: public SLIST_NODE {
00790 DECLARE_SLIST_NODE_CLASS( INTSYMB_NODE);
00791 public:
00792 SYMBOL Symbol;
00793 INT32 Coeff;
00794 void Print(FILE* fp) const;
00795 INT Print(char* bf, INT ccount) const;
00796 BOOL operator ==(const INTSYMB_NODE &i) const {
00797 return ((Coeff == i.Coeff) && (Symbol == i.Symbol));
00798 }
00799 INTSYMB_NODE(SYMBOL symbol,INT32 coeff) { Symbol = symbol; Coeff = coeff;}
00800 INTSYMB_NODE(INTSYMB_NODE *in) { Symbol = in->Symbol; Coeff = in->Coeff;}
00801 ~INTSYMB_NODE() { };
00802 };
00803
00804 class INTSYMB_LIST: public SLIST {
00805 DECLARE_SLIST_CLASS( INTSYMB_LIST, INTSYMB_NODE )
00806 public:
00807 void Init(INTSYMB_LIST *il,MEM_POOL *mem_pool);
00808 friend INTSYMB_LIST *Subtract(INTSYMB_LIST *, INTSYMB_LIST *,
00809 MEM_POOL *mem_pool);
00810 friend INTSYMB_LIST *Add(INTSYMB_LIST *, INTSYMB_LIST *,
00811 MEM_POOL *mem_pool);
00812 friend INTSYMB_LIST *Mul(INT, INTSYMB_LIST *, MEM_POOL *mem_pool);
00813 void Print(FILE* fp) const;
00814 INT Print(char* bf, INT ccount) const;
00815 BOOL operator ==(const INTSYMB_LIST &symbol_list) const;
00816 ~INTSYMB_LIST();
00817 };
00818
00819 class INTSYMB_ITER: public SLIST_ITER {
00820 DECLARE_SLIST_ITER_CLASS( INTSYMB_ITER, INTSYMB_NODE ,INTSYMB_LIST)
00821 public:
00822 ~INTSYMB_ITER() {};
00823 };
00824
00825 class INTSYMB_CONST_ITER: public SLIST_ITER {
00826 DECLARE_SLIST_CONST_ITER_CLASS(INTSYMB_CONST_ITER, INTSYMB_NODE ,INTSYMB_LIST);
00827 public:
00828 ~INTSYMB_CONST_ITER() {}
00829 };
00830
00831
00832 class SYMBOL_NODE:public SLIST_NODE {
00833 DECLARE_SLIST_NODE_CLASS( SYMBOL_NODE );
00834 public:
00835 SYMBOL Symbol;
00836 mBOOL Is_Loop_Var;
00837 void Print(FILE* fp) const;
00838 INT Print(char* bf, INT ccount) const;
00839 SYMBOL_NODE(const SYMBOL_NODE *sl) {
00840 Symbol = sl->Symbol;
00841 Is_Loop_Var = sl->Is_Loop_Var;
00842 }
00843 SYMBOL_NODE(const SYMBOL& symbol, mBOOL is_loop_var) {
00844 Symbol = symbol;
00845 Is_Loop_Var = is_loop_var;
00846 }
00847 BOOL operator ==(const SYMBOL_NODE& sn) const {
00848 return (Symbol == sn.Symbol);
00849 }
00850 ~SYMBOL_NODE() {};
00851 };
00852
00853 class SYMBOL_LIST:public SLIST {
00854 DECLARE_SLIST_CLASS( SYMBOL_LIST, SYMBOL_NODE )
00855 public:
00856 SYMBOL_LIST(SYMBOL_LIST *sl, MEM_POOL *mem_pool) {
00857 Init(sl,mem_pool);
00858 }
00859 void Init(const SYMBOL_LIST *sl, MEM_POOL *mem_pool);
00860 void Print(FILE* fp, BOOL starsep = FALSE) const;
00861 INT Print(char* bf, INT ccount, BOOL starsep = FALSE) const;
00862 BOOL operator ==(const SYMBOL_LIST&) const;
00863 BOOL Contains(const SYMBOL *s);
00864 ~SYMBOL_LIST();
00865 };
00866
00867 class SYMBOL_ITER:public SLIST_ITER {
00868 DECLARE_SLIST_ITER_CLASS( SYMBOL_ITER, SYMBOL_NODE, SYMBOL_LIST )
00869 public:
00870 ~SYMBOL_ITER() {};
00871 };
00872
00873 class SYMBOL_CONST_ITER : public SLIST_ITER {
00874 DECLARE_SLIST_CONST_ITER_CLASS(SYMBOL_CONST_ITER, SYMBOL_NODE, SYMBOL_LIST);
00875 public:
00876 ~SYMBOL_CONST_ITER() {};
00877 };
00878
00879
00880
00881 class SUMPROD_NODE:public SLIST_NODE {
00882 DECLARE_SLIST_NODE_CLASS( SUMPROD_NODE );
00883 public:
00884 SYMBOL_LIST *Prod_List;
00885 INT32 Coeff;
00886 void Print(FILE* fp) const;
00887 INT Print(char* bf, INT ccount) const;
00888 SUMPROD_NODE(SYMBOL_LIST *pl,INT32 coeff) {
00889 Prod_List = pl; Coeff = coeff;
00890 }
00891 SUMPROD_NODE(SUMPROD_NODE *sp,MEM_POOL *mem_pool) {
00892 Prod_List = CXX_NEW(SYMBOL_LIST(sp->Prod_List,mem_pool),mem_pool);
00893 Coeff = sp->Coeff;
00894 }
00895 BOOL operator ==(const SUMPROD_NODE& sp) const {
00896 if (Coeff != sp.Coeff) return(FALSE);
00897 return (*Prod_List == *sp.Prod_List);
00898 }
00899 ~SUMPROD_NODE() {};
00900 };
00901
00902 class SUMPROD_LIST:public SLIST {
00903 DECLARE_SLIST_CLASS( SUMPROD_LIST, SUMPROD_NODE )
00904 public:
00905 BOOL operator ==(const SUMPROD_LIST&) const;
00906 INT Negate_Me() ;
00907 void Merge(SUMPROD_LIST *sl);
00908 void Print(FILE* fp) const;
00909 INT Print(char* bf, INT ccount) const;
00910 void Init(SUMPROD_LIST *sp, MEM_POOL *mem_pool);
00911 SUMPROD_LIST(SUMPROD_LIST *sp, MEM_POOL *mem_pool) { Init(sp,mem_pool); }
00912 ~SUMPROD_LIST();
00913 };
00914
00915 class SUMPROD_ITER:public SLIST_ITER {
00916 DECLARE_SLIST_ITER_CLASS( SUMPROD_ITER, SUMPROD_NODE, SUMPROD_LIST )
00917 public:
00918 ~SUMPROD_ITER() {};
00919 };
00920
00921 class SUMPROD_CONST_ITER : public SLIST_ITER {
00922 DECLARE_SLIST_CONST_ITER_CLASS(SUMPROD_CONST_ITER, SUMPROD_NODE, SUMPROD_LIST);
00923 public:
00924 ~SUMPROD_CONST_ITER() {};
00925 };
00926
00927
00928
00929
00930 class ACCESS_VECTOR {
00931 MEM_POOL *_mem_pool;
00932 mINT32 *_lcoeff;
00933 mUINT16 _nest_depth;
00934 mUINT16 _non_const_loops;
00935 void Add_Sum(WN *wn,INT64 coeff,DOLOOP_STACK *stack,BOOL allow_nonlin=FALSE);
00936 SUMPROD_LIST *Add_Nonlin(WN *wn,SUMPROD_LIST *list, DOLOOP_STACK *stack);
00937 ACCESS_VECTOR(const ACCESS_VECTOR&) {}
00938 ACCESS_VECTOR& operator=(const ACCESS_VECTOR&);
00939 public:
00940 BOOL Too_Messy;
00941 mUINT16 Non_Const_Loops() const { return _non_const_loops; }
00942 void Set_Non_Const_Loops(const mUINT16 i) { _non_const_loops = i; }
00943 void Max_Non_Const_Loops(INT val) {
00944 _non_const_loops = MAX(_non_const_loops,val);
00945 };
00946 void Update_Non_Const_Loops(WN *wn,DOLOOP_STACK *stack);
00947 INTSYMB_LIST *Lin_Symb;
00948 SUMPROD_LIST *Non_Lin_Symb;
00949 INT64 Const_Offset;
00950 mUINT16 Nest_Depth() const { return _nest_depth; }
00951
00952 void Set_Nest_Depth(mUINT16 nest_depth)
00953 {
00954 if (_lcoeff != NULL && _nest_depth < nest_depth) {
00955 mINT32 * newlcoeff = CXX_NEW_ARRAY(mINT32, nest_depth, _mem_pool);
00956 INT i;
00957 for (i = 0; i < _nest_depth; ++i) {
00958 newlcoeff[i] = _lcoeff[i];
00959 }
00960 for (i = _nest_depth; i < nest_depth; ++i) {
00961 newlcoeff[i] = 0;
00962 }
00963 CXX_DELETE_ARRAY(_lcoeff, _mem_pool);
00964 _lcoeff = newlcoeff;
00965 }
00966 _nest_depth = nest_depth;
00967 }
00968
00969 BOOL Is_Const() const;
00970 void Set(WN *wn, DOLOOP_STACK *stack, INT8 sign, INT offset=0,
00971 BOOL allow_nonlin=FALSE);
00972 void Add(WN *wn, DOLOOP_STACK *stack, INT8 sign);
00973 void Mul(INT c);
00974 BOOL operator ==(const ACCESS_VECTOR &av) const;
00975 BOOL Contains_Lin_Symb() const { return (Lin_Symb && !Lin_Symb->Is_Empty()); }
00976 SYMBOL *Delinearized_Symbol;
00977 void Add_Symbol(INT64 coeff, SYMBOL symbol, DOLOOP_STACK *stack, WN *wn);
00978 BOOL Contains_Non_Lin_Symb() const {
00979 return (Non_Lin_Symb && !Non_Lin_Symb->Is_Empty()); }
00980 void Update_Non_Const_Loops_Nonlinear(DOLOOP_STACK *stack);
00981 void Substitute(INT formal_number, WN* wn_sub, DOLOOP_STACK* stack,
00982 BOOL allow_nonlin = FALSE);
00983
00984 INT32 Loop_Coeff(UINT16 i) const {
00985 if (_lcoeff && (i < _nest_depth)) {
00986 return(_lcoeff[i]);
00987 } else {
00988 return(0);
00989 }
00990 }
00991 void Set_Condition(WN *wn, DOLOOP_STACK *stack, BOOL negate);
00992 BOOL Has_Loop_Coeff() const { return(_lcoeff != NULL); }
00993 void Set_Loop_Coeff(UINT16 i, INT32 val);
00994 void Print(FILE *fp, BOOL is_bound=FALSE, BOOL print_brackets=TRUE) const;
00995 INT Print(char* bf, INT ccount, BOOL is_bound=FALSE,
00996 BOOL print_brackets=TRUE) const;
00997 void Print_Analysis_Info(FILE *fp, DOLOOP_STACK &do_stack,
00998 BOOL is_bound=FALSE) const;
00999
01000 ACCESS_VECTOR(UINT16 lnest, MEM_POOL *mem_pool=0) { Init(lnest,mem_pool);}
01001 ACCESS_VECTOR() {
01002 Too_Messy = TRUE; _lcoeff=NULL;
01003 Lin_Symb=NULL; Non_Lin_Symb=NULL;
01004 Delinearized_Symbol = NULL;
01005 }
01006 #ifdef LNO
01007 BOOL Can_Delinearize(WN *wn, const SYMBOL *delin_symbol);
01008 #endif
01009 ACCESS_VECTOR(const ACCESS_VECTOR *a, MEM_POOL *pool);
01010 void Init(UINT16 nest_depth, MEM_POOL *mem_pool=0) {
01011 _mem_pool = mem_pool;
01012 Too_Messy = TRUE;
01013 _nest_depth = nest_depth;
01014 _lcoeff = NULL; Lin_Symb = NULL; Non_Lin_Symb = NULL;
01015 Const_Offset = 0;
01016 _non_const_loops = 0;
01017 Delinearized_Symbol = NULL;
01018 }
01019 void Init(const ACCESS_VECTOR *a, MEM_POOL *pool);
01020 friend ACCESS_VECTOR *Subtract(ACCESS_VECTOR *, ACCESS_VECTOR *,
01021 MEM_POOL *mem_pool);
01022 friend ACCESS_VECTOR *Add(ACCESS_VECTOR *, ACCESS_VECTOR *,
01023 MEM_POOL *mem_pool);
01024 friend ACCESS_VECTOR *Mul(INT c, ACCESS_VECTOR *av, MEM_POOL *mem_pool);
01025 friend ACCESS_VECTOR *Merge(ACCESS_VECTOR *, ACCESS_VECTOR *,
01026 MEM_POOL *mem_pool);
01027 void Negate_Me();
01028 ACCESS_VECTOR *Convert_Bound_To_Exp(MEM_POOL *mem_pool);
01029 ACCESS_VECTOR(const SYSTEM_OF_EQUATIONS *soe,
01030 const INT i, const SYMBOL_LIST *syms,
01031 const INT depth, const INT dim,
01032 const INT non_const_loops,
01033 const INT which_array,
01034 BOOL is_lower_bound, MEM_POOL *pool);
01035 ~ACCESS_VECTOR() {
01036 if (_lcoeff) CXX_DELETE_ARRAY(_lcoeff,_mem_pool);
01037 if (Lin_Symb) {
01038 MEM_POOL_Set_Default(_mem_pool);
01039 CXX_DELETE(Lin_Symb,_mem_pool);
01040 }
01041 if (Non_Lin_Symb) {
01042 MEM_POOL_Set_Default(_mem_pool);
01043 CXX_DELETE(Non_Lin_Symb,_mem_pool);
01044 }
01045 }
01046 BOOL Has_Formal_Parameter();
01047 };
01048
01049
01050 class ACCESS_ARRAY {
01051 ACCESS_VECTOR *_dim;
01052 MEM_POOL *_mem_pool;
01053 mUINT16 _num_vec;
01054 ACCESS_ARRAY(const ACCESS_ARRAY&) {}
01055 ACCESS_ARRAY& operator=(const ACCESS_ARRAY&);
01056 public:
01057 BOOL Too_Messy;
01058 mUINT16 Num_Vec() const { return _num_vec; }
01059
01060 ACCESS_VECTOR *Dim(UINT16 i) const {
01061 Is_True(i < _num_vec,("Bad index in ACCESS_ARRAY::Dim"));
01062 return &(_dim[i]);
01063 }
01064
01065 ACCESS_ARRAY(UINT16 num_vec,UINT16 nest_depth,MEM_POOL *mem_pool);
01066 ACCESS_ARRAY(UINT16 num_vec,ACCESS_VECTOR* dim[],MEM_POOL *mem_pool);
01067 void Print(FILE *fp, BOOL is_bound=FALSE) const __attribute__((weak));
01068 ACCESS_ARRAY() { Too_Messy = TRUE; _dim = NULL; _num_vec=0;}
01069 ACCESS_ARRAY(const ACCESS_ARRAY *a, MEM_POOL *pool);
01070 mUINT16 Non_Const_Loops() const;
01071 void Set_Array(WN *wn, DOLOOP_STACK *stack);
01072 void Set_LB(WN *wn, DOLOOP_STACK *stack, INT64 step);
01073 void Set_UB(WN *wn, DOLOOP_STACK *stack);
01074 void Init(const ACCESS_ARRAY *a, MEM_POOL *pool);
01075 ~ACCESS_ARRAY() { CXX_DELETE_ARRAY(_dim,_mem_pool); }
01076 MEM_POOL *Pool() const { return _mem_pool; }
01077 BOOL operator ==(const ACCESS_ARRAY& a) const;
01078
01079 INT Set_IF(WN *wn, DOLOOP_STACK *stack, BOOL negate, BOOL is_and, INT i);
01080 void Substitute(INT formal_number, WN* wn_sub, DOLOOP_STACK* stack,
01081 BOOL allow_nonlinear = FALSE);
01082 BOOL Has_Formal_Parameter();
01083 private:
01084
01085 INT Set_UB_r(WN *wn, DOLOOP_STACK *stack, INT i, INT sign);
01086 INT Set_LB_r(WN *wn, DOLOOP_STACK *stack, INT i, INT64 step);
01087 #ifdef LNO
01088 void Delinearize(DOLOOP_STACK *stack, WN *wn);
01089 INT Delinearize(DOLOOP_STACK *stack, INT dim, WN *wn);
01090 INT Delinearize(DOLOOP_STACK *stack, INT dim, const SYMBOL *delin_symbol);
01091 #endif
01092 void Update_Non_Const_Loops(WN *wn,DOLOOP_STACK *stack);
01093 };
01094
01095 extern INT Num_Mins(WN *wn);
01096 extern INT Num_Maxs(WN *wn);
01097 extern INT Num_Lands(WN* wn);
01098 extern INT Num_Liors(WN* wn);
01099
01100 extern INT Num_Upper_Bounds(WN* wn);
01101 extern INT Num_Lower_Bounds(WN* wn, ACCESS_VECTOR *step);
01102
01103 extern INT snprintfs(char* buf, INT ccount, INT tcount, const char* fstring);
01104 extern INT snprintfd(char* buf, INT ccount, INT tcount, INT32 value);
01105 extern INT snprintfll(char* buf, INT ccount, INT tcount, INT64 value);
01106 extern INT snprintfx(char* buf, INT ccount, INT tcount, INT32 value);
01107
01108 #endif
01109
01110