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 * Module: gtn_universe.h 00040 * $Revision: 1.2 $ 00041 * $Date: 02/11/07 23:41:25-00:00 $ 00042 * $Author: fchow@keyresearch.com $ 00043 * $Source: /scratch/mee/2.4-65/kpro64-pending/be/cg/SCCS/s.gtn_universe.h $ 00044 * 00045 * Revision comments: 00046 * 00047 * 13-Oct-1994 - Initial version 00048 * 00049 * Description: 00050 * ============ 00051 * 00052 * Impliments the universe of global TNs over which we define GTN_SETs. 00053 * It is very advantageous to do this as there are far fewer global TNs 00054 * than local TNs. 00055 * 00056 * Reserved prefix: 00057 * ================ 00058 * 00059 * GTN_UNIVERSE 00060 * 00061 * Exported functions: 00062 * =================== 00063 * 00064 * void GTN_UNIVERSE_Pu_Begin(void) 00065 * 00066 * Initialize GTN for the current program unit. 00067 * 00068 * 00069 * void GTN_UNIVERSE_Pu_End(void) 00070 * 00071 * All done with GTN sets in current PU. Release any memory and 00072 * destruct ay data structures. 00073 * 00074 * 00075 * void GTN_UNIVERSE_Add_TN( 00076 * TN *tn 00077 * ) 00078 * 00079 * Register 'tn' as a global. There is no going back. 00080 * 00081 * 00082 * Exported variables: 00083 * =================== 00084 * 00085 * const INT32 GTN_UNIVERSE_size 00086 * 00087 * Number of TNs in the GTN universe. 00088 * 00089 * 00090 * Macros exported only to GTN_SET functions: 00091 * ========================================== 00092 * 00093 * INT32 GTN_UNIVERSE_TN_int( 00094 * TN *tn 00095 * ) 00096 * 00097 * Returns the global TN number of 'tn'. If it has not been 00098 * added to the universe, return 0. 00099 * 00100 * 00101 * TN *GTN_UNIVERSE_INT_tn( 00102 * INT32 i 00103 * ) 00104 * 00105 * Returns the global TN whose number in the GTN universe is 00106 * 'i'. 00107 * 00108 * Iteration over the members of the GTN universe: 00109 * =============================================== 00110 * 00111 * Iterator type GTN_UNIVERSE_ITER 00112 * 00113 * Iterates over all the GTNs in the current REGION. 00114 * 00115 * Supports: 00116 * 00117 * void GTN_UNIVERSE_ITER_Init( GTN_UNIVERSE_ITER *iter ) 00118 * BOOL GTN_UNIVERSE_ITER_Done( const GTN_UNIVERSE_ITER *iter ) 00119 * TN* GTN_UNIVERSE_ITER_Current( GTN_UNIVERSE_ITER *iter ) 00120 * void GTN_UNIVERSE_ITER_Step( GTN_UNIVERSE_ITER *iter ) 00121 * 00122 * 00123 * ======================================================================= 00124 * ======================================================================= 00125 */ 00126 00127 #ifndef GTN_UNIVERSE_INCLUDED 00128 #define GTN_UNIVERSE_INCLUDED 00129 00130 00131 #ifdef GTN_IMPLEMENTATION 00132 #define GTN_CONST 00133 #else 00134 #define GTN_CONST const 00135 #endif 00136 00137 extern GTN_CONST INT32 GTN_UNIVERSE_size; 00138 extern INT32 First_REGION_GTN; 00139 extern GTN_CONST INT32 *GTN_CONST GTN_UNIVERSE_tn_int_map; 00140 extern TN *GTN_CONST *GTN_CONST GTN_UNIVERSE_int_tn_map; 00141 extern INT32 tn_int_map_allocated_size; 00142 extern INT32 int_tn_map_allocated_size; 00143 00144 00145 extern void GTN_UNIVERSE_Pu_Begin(void); 00146 extern void GTN_UNIVERSE_REGION_Begin(void); 00147 extern void GTN_UNIVERSE_Pu_End(void); 00148 extern void GTN_UNIVERSE_Add_TN( TN *tn ); 00149 00150 inline INT32 00151 GTN_UNIVERSE_TN_int( TN *tn) 00152 { 00153 #if 0 00154 /* the following assertion fails at several places in CG. Comment 00155 it out till those references are fixed. */ 00156 Is_True (TN_is_register(tn) && 00157 TN_is_global_reg(tn) && 00158 (TN_number(tn) < tn_int_map_allocated_size), 00159 ("Invalid TN%d in GTN_UNIVERSE_TN_int", TN_number(tn))); 00160 #else 00161 if (!(TN_is_register(tn) && 00162 TN_is_global_reg(tn) && 00163 (TN_number(tn) < tn_int_map_allocated_size))) 00164 return 0; 00165 #endif 00166 00167 return GTN_UNIVERSE_tn_int_map[TN_number(tn)]; 00168 } 00169 00170 00171 inline TN * 00172 GTN_UNIVERSE_INT_tn (INT32 i) 00173 { 00174 Is_True (i < GTN_UNIVERSE_size, ("GTN_UNIVERSE_INT_tn: %d out of range", i)); 00175 return GTN_UNIVERSE_int_tn_map[i]; 00176 } 00177 00178 00179 typedef INT32 GTN_UNIVERSE_ITER; /* Well, it's a simple iterator... */ 00180 00181 /* ======================================================================= 00182 * 00183 * GTN_UNIVERSE_ITER_Init 00184 * GTN_UNIVERSE_ITER_Done 00185 * GTN_UNIVERSE_ITER_Current 00186 * GTN_UNIVERSE_ITER_Step 00187 * 00188 * Iterator functions. See interface description. 00189 * 00190 * ======================================================================= 00191 */ 00192 00193 inline void 00194 GTN_UNIVERSE_ITER_Init( GTN_UNIVERSE_ITER* iter ) 00195 { 00196 *iter = GTN_UNIVERSE_size - 1; 00197 } 00198 00199 inline BOOL 00200 GTN_UNIVERSE_ITER_Done( const GTN_UNIVERSE_ITER* iter ) 00201 { 00202 return *iter < First_REGION_GTN; 00203 } 00204 00205 inline TN* 00206 GTN_UNIVERSE_ITER_Current( const GTN_UNIVERSE_ITER* iter ) 00207 { 00208 return GTN_UNIVERSE_INT_tn(*iter); 00209 } 00210 00211 inline void 00212 GTN_UNIVERSE_ITER_Step( GTN_UNIVERSE_ITER* iter ) 00213 { 00214 --*iter; 00215 } 00216 #endif
1.5.6