Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
wn_map.h
Go to the documentation of this file.
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 #ifndef wn_map_INCLUDED
00037 #define wn_map_INCLUDED
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 #ifdef _KEEP_RCS_ID
00043 #endif /* _KEEP_RCS_ID */
00044 
00045 
00281 struct mem_pool;
00282 
00283 
00284 typedef INT32           WN_MAP;
00285 
00286 /* predefined (reserved) mappings */
00287 #define WN_MAP_UNDEFINED (-1)
00288 #define WN_MAP_DEPGRAPH 0
00289 #define WN_MAP_PREFETCH 1
00290 #define WN_MAP_FEEDBACK 2
00291 #define WN_MAP_AC_INTERNAL 3
00292 #define WN_MAP_ALIAS_CLASS 4
00293 
00294 /* number of reserved mappings and total number */
00295 #define WN_MAP_RESERVED 5
00296 #define WN_MAP_MAX 28
00297 
00298 typedef enum {
00299   WN_MAP_KIND_VOIDP = 1,
00300   WN_MAP_KIND_INT32 = 2,
00301   WN_MAP_KIND_INT64 = 3
00302 } WN_MAP_KIND;
00303 
00304 typedef struct wn_map_tab {
00305   struct mem_pool *_free_list_pool;
00306   struct mem_pool *_pool[WN_MAP_MAX];
00307   WN_MAP_KIND _kind[WN_MAP_MAX];
00308   void **_mapping[WN_MAP_CATEGORIES][WN_MAP_MAX];
00309   BOOL _is_used[WN_MAP_MAX];  /* is this WN_MAP being used */
00310   INT32 _last_map_id[WN_MAP_CATEGORIES]; /* last map_id for each category */
00311   INT32 _map_size[WN_MAP_CATEGORIES][WN_MAP_MAX]; /* size of each mapping */
00312 
00313   /* free list of map_ids */
00314   WN_MAP_ID *_free_list[WN_MAP_CATEGORIES];
00315   INT32 _free_list_count[WN_MAP_CATEGORIES];
00316   INT32 _free_list_size[WN_MAP_CATEGORIES];
00317 } WN_MAP_TAB; 
00318 
00319 /* map table for the current PU (set automatically) */
00320 extern WN_MAP_TAB *Current_Map_Tab;
00321 
00322 
00323 extern WN_MAP_TAB *WN_MAP_TAB_Create(
00324     struct mem_pool *pool
00325 );
00326 
00327 extern void WN_MAP_TAB_Delete(
00328     WN_MAP_TAB  *maptab
00329 );
00330 
00331 #define WN_MAP_TAB_Last_ID(maptab,category) \
00332   (maptab)->_last_map_id[(category)]
00333 
00334 
00335 extern WN_MAP WN_MAP_Do_Create(
00336     WN_MAP_TAB  *maptab,
00337     struct mem_pool *pool,
00338     WN_MAP_KIND kind
00339 );
00340 
00341 #define WN_MAP_Create(pool) \
00342   WN_MAP_Do_Create(Current_Map_Tab, (pool), WN_MAP_KIND_VOIDP)
00343 #define WN_MAP32_Create(pool) \
00344   WN_MAP_Do_Create(Current_Map_Tab, (pool), WN_MAP_KIND_INT32)
00345 #define WN_MAP64_Create(pool) \
00346   WN_MAP_Do_Create(Current_Map_Tab, (pool), WN_MAP_KIND_INT64)
00347 
00348 #define IPA_WN_MAP_Create(maptab, pool) \
00349   WN_MAP_Do_Create((maptab), (pool), WN_MAP_KIND_VOIDP)
00350 #define IPA_WN_MAP32_Create(maptab, pool) \
00351   WN_MAP_Do_Create((maptab), (pool), WN_MAP_KIND_INT32)
00352 #define IPA_WN_MAP64_Create(maptab, pool) \
00353   WN_MAP_Do_Create((maptab), (pool), WN_MAP_KIND_INT64)
00354 
00355 extern WN_MAP_ID IPA_WN_MAP_Status(
00356     WN_MAP_TAB *maptab
00357 );
00358 
00359 #define WN_MAP_Status() \
00360   IPA_WN_MAP_Status(Current_Map_Tab)
00361 
00362 extern void IPA_WN_MAP_Delete(
00363     WN_MAP_TAB  *maptab,
00364     WN_MAP      wn_map
00365 );
00366 
00367 #define WN_MAP_Delete(wn_map) \
00368   IPA_WN_MAP_Delete(Current_Map_Tab, (wn_map))
00369 
00370 
00371 extern void IPA_WN_MAP_Set(
00372     WN_MAP_TAB  *maptab,
00373     WN_MAP      wn_map,
00374     WN          *wn,
00375     void        *thing
00376 );
00377 extern void IPA_WN_MAP32_Set(
00378     WN_MAP_TAB  *maptab,
00379     WN_MAP      wn_map,
00380     WN          *wn,
00381     INT32       thing
00382 );
00383 extern void IPA_WN_MAP64_Set(
00384     WN_MAP_TAB  *maptab,
00385     WN_MAP      wn_map,
00386     WN          *wn,
00387     INT64       thing
00388 );
00389 
00390 #define WN_MAP_Set(wn_map,wn,thing) \
00391   IPA_WN_MAP_Set(Current_Map_Tab, (wn_map), (wn), (thing))
00392 #define WN_MAP32_Set(wn_map,wn,thing) \
00393   IPA_WN_MAP32_Set(Current_Map_Tab, (wn_map), (wn), (thing))
00394 #define WN_MAP64_Set(wn_map,wn,thing) \
00395   IPA_WN_MAP64_Set(Current_Map_Tab, (wn_map), (wn), (thing))
00396 
00397 
00398 extern void *IPA_WN_MAP_Get(
00399     WN_MAP_TAB  *maptab,
00400     WN_MAP      wn_map,
00401     const WN    *wn
00402 );
00403 extern INT32 IPA_WN_MAP32_Get(
00404     WN_MAP_TAB  *maptab,
00405     WN_MAP      wn_map,
00406     const WN    *wn
00407 );
00408 extern INT64 IPA_WN_MAP64_Get(
00409     WN_MAP_TAB  *maptab,
00410     WN_MAP      wn_map,
00411     const WN    *wn
00412 );
00413 
00414 #define WN_MAP_Get(wn_map,wn) \
00415   IPA_WN_MAP_Get(Current_Map_Tab, (wn_map), (wn))
00416 #define WN_MAP32_Get(wn_map,wn) \
00417   IPA_WN_MAP32_Get(Current_Map_Tab, (wn_map), (wn))
00418 #define WN_MAP64_Get(wn_map,wn) \
00419   IPA_WN_MAP64_Get(Current_Map_Tab, (wn_map), (wn))
00420 
00421 
00422 #define WN_MAP_Size(wn_map,category) \
00423   IPA_WN_MAP_Size(Current_Map_Tab, (wn_map), (category))
00424 #define IPA_WN_MAP_Size(maptab,wn_map,category) \
00425   (maptab)->_map_size[(category)][(wn_map)]
00426 
00427 
00428 extern void WN_MAP_Add_Free_List(
00429     WN_MAP_TAB  *maptab,
00430     WN          *wn
00431 );
00432 
00433 extern void WN_MAP_Set_ID(
00434     WN_MAP_TAB  *maptab,
00435     WN          *wn
00436 );
00437 
00438 #define WN_MAP_Get_Kind(wn_map) (Current_Map_Tab->_kind[(wn_map)])
00439 
00440 #ifdef __cplusplus
00441 }
00442 #endif
00443 #endif /* wn_map_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines