00001 /* 00002 * Copyright 2003, 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2 of the GNU General Public License as 00011 published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with this program; if not, write the Free Software Foundation, Inc., 59 00026 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00027 00028 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00029 Mountain View, CA 94043, or: 00030 00031 http://www.sgi.com 00032 00033 For further information regarding this notice, see: 00034 00035 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00036 00037 */ 00038 00039 00040 //-*-c++-*- 00041 //--------------------------------------------------------------------------- 00042 // DO_LOOP_INFO_BASE 00043 // 00044 // Loop representation, hold information about DO loops 00045 // 00046 // ACCESS_ARRAY _lb 00047 // 00048 // the lower bound is the max of all the access vectors in _lb 00049 // 00050 // ACCESS_ARRAY _ub 00051 // 00052 // the upper bound is the min of all the access vectors in _ub 00053 // 00054 // mUINT8 Depth 00055 // 00056 // What is the "depth" of this DO loop. The outer DO loop 00057 // (good or bad) is numbered 0. The next inner 1, etc. 00058 // 00059 // WN *Guard 00060 // 00061 // Points to the if statement that "guards" this loop. 00062 // By guard we guarantee that the do loop is not 00063 // zero trip count. If this is NULL, then the loop 00064 // is non-zero trip count without any special guard. 00065 // 00066 // IF_INFO 00067 // Contains information about block structured IFs 00068 // 00069 //--------------------------------------------------------------------------- 00070 00071 #ifndef loop_info_INCLUDED 00072 #define loop_info_INCLUDED 00073 00074 #ifndef defs_INCLUDED 00075 #include "defs.h" 00076 #endif 00077 00078 #ifndef wn_INCLUDED 00079 #include "wn.h" 00080 #endif 00081 00082 #ifndef access_vector_INCLUDED 00083 #include "access_vector.h" 00084 #endif 00085 00086 #ifndef cxx_memory_INCLUDED 00087 #include "cxx_memory.h" 00088 #endif 00089 00090 #ifndef cxx_base_INCLUDED 00091 #include "cxx_base.h" 00092 #endif 00093 00094 #ifndef if_info_INCLUDED 00095 #include "if_info.h" 00096 #endif 00097 00098 #ifndef reduction_INCLUDED 00099 #include "reduction.h" 00100 #endif 00101 00102 extern WN_MAP IPL_info_map; 00103 extern WN_MAP IPL_reduc_map; 00104 00105 class DO_LOOP_INFO_BASE; 00106 00107 typedef STACK<WN* > STACK_OF_WN; 00108 typedef STACK<DO_LOOP_INFO_BASE *> DLI_BASE_STACK; 00109 typedef STACK<IF_INFO *> IF_STACK; 00110 00111 #define IPL_LOOP_HAS_CALLS 1 00112 #define IPL_LOOP_HAS_GOTOS 2 00113 #define IPL_LOOP_IS_INNER 4 00114 00115 class DO_LOOP_INFO_BASE { 00116 00117 private: 00118 MEM_POOL *_pool; 00119 ACCESS_ARRAY *_lb; 00120 ACCESS_ARRAY *_ub; 00121 ACCESS_VECTOR *_step; 00122 INT32 _state; 00123 mUINT8 _depth; 00124 mINT16 _max_non_const_loop; 00125 public: 00126 MEM_POOL *Pool() { return _pool; }; 00127 00128 DO_LOOP_INFO_BASE(MEM_POOL *pool) { 00129 _lb = _ub = NULL; 00130 _step = NULL; 00131 _pool = pool; 00132 _state = 0; 00133 _depth = 0; 00134 _max_non_const_loop = 0; 00135 }; 00136 00137 DO_LOOP_INFO_BASE(DO_LOOP_INFO_BASE *dli, MEM_POOL *pool); 00138 00139 void Set_depth (mUINT8 d) { _depth = d;}; 00140 mUINT8 Get_depth () const { return _depth;}; 00141 00142 void Set_has_calls() { _state = _state | IPL_LOOP_HAS_CALLS;}; 00143 BOOL Has_calls() const { return _state & IPL_LOOP_HAS_CALLS;}; 00144 00145 void Set_has_gotos() { _state = _state | IPL_LOOP_HAS_GOTOS;}; 00146 BOOL Has_gotos() const { return _state & IPL_LOOP_HAS_GOTOS;}; 00147 00148 void Set_is_inner_loop() { _state = _state | IPL_LOOP_IS_INNER;}; 00149 BOOL Is_inner_loop() const { return _state & IPL_LOOP_IS_INNER;}; 00150 void Reset_is_inner_loop() { _state = _state & ~IPL_LOOP_IS_INNER;}; 00151 00152 mINT16 Get_max_non_const_loop() const { return _max_non_const_loop;}; 00153 void Set_max_non_const_loop(mINT16 l) { _max_non_const_loop = l;}; 00154 00155 void Set_lb(ACCESS_ARRAY *lb) { _lb = lb; }; 00156 ACCESS_ARRAY* Get_lb() const { return _lb;}; 00157 00158 void Set_ub(ACCESS_ARRAY *ub) { _ub = ub;}; 00159 ACCESS_ARRAY* Get_ub() const { return _ub;}; 00160 00161 void Set_step(ACCESS_VECTOR *step) { _step = step;}; 00162 ACCESS_VECTOR* Get_step() const { return _step;}; 00163 00164 #if defined(KEY) && defined(SHARED_BUILD) 00165 void Print(FILE *fp, INT = 0) __attribute__((weak)); 00166 #else 00167 void Print(FILE *fp, INT = 0); 00168 #endif 00169 00170 ~DO_LOOP_INFO_BASE() { 00171 CXX_DELETE(_lb,_pool); 00172 CXX_DELETE(_ub,_pool); 00173 CXX_DELETE(_step,_pool); 00174 } 00175 00176 }; 00177 00178 // do we need to store control flow for this symbol? 00179 extern 00180 BOOL Record_scalar_flow(WN* stid); 00181 00182 extern void Mark_formal_summary_symbol(ST* s); 00183 extern "C" void Print_DO_LOOP_INFO_BASE (FILE *fp, DO_LOOP_INFO_BASE *b); 00184 00185 #endif
1.5.6