Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 00036 /* ==================================================================== 00037 * ==================================================================== 00038 * 00039 * 00040 * Synopsis: 00041 * 00042 * Resource accounting package for various clients including 00043 * the software pipeliner and the local (BB) scheduler. The pipeliner 00044 * has different needs than the BB scheduler. In particular, 00045 * it needs to be able to unreserve as well as reserve resources. 00046 * It also needs to be able compare resource requests for relevance 00047 * and equivalence during backtracking. 00048 * 00049 * Interface Description: 00050 * 00051 * Exported types: 00052 * 00053 * TI_RES_RES 00054 * 00055 * Opaque type to maintain context for resource reservation 00056 * and resource related inquiries. 00057 * 00058 * Exported functions: 00059 * 00060 * TI_RES_RES *TI_RES_RES_Alloc( 00061 * BOOL cyclic 00062 * MEM_POOL *pool 00063 * ) 00064 * 00065 * Allocate a TI_RES_RES structure for managing resources for a 00066 * basic block. 'cyclic' indicates if the BB is being scheduled 00067 * as a loop. 'pool' is used to allocate dynamic memory during 00068 * creation of the TI_RES_RES structure and for future 00069 * maintenence of the structure. 00070 * 00071 * After this call, the client must make the cycle count 00072 * of the BB known via TI_RES_RES_Set_BB_Cycle_Count. 00073 * And for cyclic scheduling, TI_RES_RES_Has_TOP should 00074 * be called for each instruction in the BB. 00075 * 00076 * Note that there is no corresponding "free" call, deallocating 00077 * the pool memory is the only cleanup necessary. 00078 * 00079 * void TI_RES_RES_Has_TOP( 00080 * TI_RES_RES *res 00081 * TOP opcode 00082 * ) 00083 * 00084 * Before software pipelining using 'res', this must be called at 00085 * least once for each unique 'opcode' to be scheduled in the 00086 * loop. 00087 * 00088 * void TI_RES_RES_Set_BB_Cycle_Count( 00089 * TI_RES_RES *res 00090 * INT length 00091 * ) 00092 * 00093 * Sets the cycle count to 'length', adjusting internal 00094 * data structures as necessary, including resetting 00095 * the resource reservation table to "empty". 00096 * 00097 * BOOL TI_RES_RES_Resources_Available( 00098 * TI_RES_RES *res 00099 * TOP opcode 00100 * INT cycle 00101 * ) 00102 * 00103 * Check to see if resources for 'opcode' are available at 00104 * the given 'cycle'. Returns TRUE for available; FALSE 00105 * otherwise. 00106 * 00107 * void TI_RES_RES_Reserve_Resources( 00108 * TI_RES_RES *res 00109 * TOP opcode 00110 * INT cycle 00111 * ) 00112 * 00113 * Reserve resources for 'opcode' at the given 'cycle'. It is 00114 * an error, resulting in undefined behavior, if the 00115 * resources are not available. 00116 * 00117 * void TI_RES_RES_Unreserve_Resources( 00118 * TI_RES_RES *res 00119 * TOP opcode 00120 * INT cycle 00121 * ) 00122 * 00123 * Unreserve resources for 'opcode' at the given 'cycle'. It 00124 * is an error, resulting in undefined behavior, if the 00125 * resources have not been reserved. 00126 * 00127 * BOOL TI_RES_RES_Is_Bad_II( 00128 * TI_RES_RES *res 00129 * INT ii 00130 * ) 00131 * 00132 * For cyclic scheduling, return TRUE if the given 'ii' is not 00133 * possible based on resource usage, FALSE otherwise. 00134 * The function always returns FALSE for non-cyclic scheduling. 00135 * 00136 * 00137 * BOOL TI_RES_RES_Resources_Relevant( 00138 * TI_RES_RES *res 00139 * TOP opcode1 00140 * TOP opcode2 00141 * INT offset 00142 * ) 00143 * 00144 * Are the resource requirements of 'opcode1' issued 'offset' 00145 * cycles before 'opcode2' relevant to 'opcode2'? The question 00146 * really is: "Is there a resource class of which 'opcode1' 00147 * requires a member, and which 'opcode2' also requires a 00148 * member in the same cycle when 'opcode2' is issued 'offset' 00149 * cycles after 'opcode1'? If there are some resources 00150 * common to all the OPs in the loop (such as issue 00151 * slot), these do not count. 00152 * 00153 * NOTE: only supported for cyclic scheduling. 00154 * 00155 * BOOL TI_RES_RES_Resources_Equivalent( 00156 * TI_RES_RES *res 00157 * TOP opcode1 00158 * TOP opcode2 00159 * ) 00160 * 00161 * Do 'opcode1' and 'opcode2' have exactly the same resource 00162 * requirements? 00163 * 00164 * BOOL TI_RES_RES_Resources_Grainy( 00165 * TI_RES_RES *res 00166 * TOP opcode 00167 * ) 00168 * 00169 * Does 'opcode' use non-common resources in any cycle other 00170 * than its first. (TODO: This is only a second cousin 00171 * of the right definition. It will probably work pretty 00172 * well for the r4k, but fails to capture the TFP LD, IST 00173 * interaction, for example.) 00174 * 00175 * NOTE: only supported for cyclic scheduling. 00176 * 00177 * INT TI_RES_RES_Resources_Length(TI_RES_RES *res) 00178 * Returns length of the resources 00179 * 00180 * void TI_RES_RES_Print(FILE *fp, TI_RES_RES *) 00181 * Prints the resources reservation table for debugging. 00182 * 00183 * BOOL TI_RES_RES_Equal(TI_RES_RES *res1, TI_RES_RES *res2) 00184 * Returns TRUE if res1 and res1 are identical. 00185 * 00186 * ==================================================================== 00187 * ==================================================================== 00188 */ 00189 00190 #ifndef ti_res_res_INCLUDED 00191 #define ti_res_res_INCLUDED 00192 00193 #include "topcode.h" 00194 00195 #ifdef __cplusplus 00196 extern "C" { 00197 #endif 00198 00199 #ifdef _KEEP_RCS_ID 00200 #endif /* _KEEP_RCS_ID */ 00201 00202 typedef struct ti_res_res TI_RES_RES; 00203 00204 extern TI_RES_RES *TI_RES_RES_Alloc( 00205 BOOL cyclic, 00206 MEM_POOL *pool 00207 ); 00208 00209 extern void TI_RES_RES_Has_TOP( 00210 TI_RES_RES *res, 00211 TOP opcode 00212 ); 00213 00214 extern void TI_RES_RES_Set_BB_Cycle_Count( 00215 TI_RES_RES *res, 00216 INT cycles 00217 ); 00218 00219 extern BOOL TI_RES_RES_Resources_Available( 00220 TI_RES_RES *res, 00221 TOP opcode, 00222 INT cycle 00223 ); 00224 00225 extern void TI_RES_RES_Reserve_Resources( 00226 TI_RES_RES *res, 00227 TOP opcode, 00228 INT cycle 00229 ); 00230 00231 extern void TI_RES_RES_Unreserve_Resources( 00232 TI_RES_RES *res, 00233 TOP opcode, 00234 INT cycle 00235 ); 00236 00237 extern BOOL TI_RES_RES_Is_Bad_II( 00238 TI_RES_RES *res, 00239 INT ii 00240 ); 00241 00242 extern BOOL TI_RES_RES_Resources_Relevant( 00243 TI_RES_RES *res, 00244 TOP opcode1, 00245 TOP opcode2, 00246 INT offset 00247 ); 00248 00249 extern BOOL TI_RES_RES_Resources_Equivalent( 00250 TI_RES_RES *res, 00251 TOP opcode1, 00252 TOP opcode2 00253 ); 00254 00255 extern BOOL TI_RES_RES_Resources_Grainy( 00256 TI_RES_RES *res, 00257 TOP opcode 00258 ); 00259 00260 extern BOOL TI_RES_RES_Resources_Length( 00261 TI_RES_RES *res, 00262 TOP opcode 00263 ); 00264 00265 extern void TI_RES_RES_Print(FILE *fp, TI_RES_RES *res); 00266 00267 extern BOOL TI_RES_RES_Equal(TI_RES_RES *res1, TI_RES_RES *res2); 00268 00269 #ifdef __cplusplus 00270 } 00271 #endif 00272 #endif /* ti_res_res_INCLUDED */