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 /* Subuniverses of Live Ranges 00036 * =========================== 00037 * 00038 * Description: 00039 * 00040 * We use LRANGE_SETs to represent interference. Live ranges can 00041 * only conflict if they are (a) in the same region and (b) need a 00042 * register from the same register class. We'll take advantage of 00043 * this fact to make our interference sets denser. This module 00044 * implements multiple dense LRANGE<=>INT32 mappings to be used as 00045 * support for LRANGE subuniverses. These subuniverses are 00046 * NON-INTERSECTING in the current implementation. 00047 * 00048 * Count returns the number of elements in the subuniverse. 00049 * Since the numbering is guaranteed to be dense, this can be used in 00050 * conjunction with Nth_Lrange to iteration over the elements: 00051 * 00052 * for ( i = sub->Count() - 1; i >= 0; --i) { 00053 * LRANGE *lrange = sub->Nth_Lrange(i); 00054 * .. lrange is now a live range in subuniverse 00055 * } 00056 */ 00057 00058 00059 /* 00060 * $Revision: 1.2 $ 00061 * $Date: 02/11/07 23:41:29-00:00 $ 00062 * $Author: fchow@keyresearch.com $ 00063 * $Source: /scratch/mee/2.4-65/kpro64-pending/be/cg/gra_mon/SCCS/s.gra_lrange_subuniverse.h $ 00064 */ 00065 00066 00067 #ifndef LRANGE_SUBUNIVERSE_INCLUDED 00068 #define LRANGE_SUBUNIVERSE_INCLUDED 00069 00070 #ifndef LRANGE_SUBUNIVERSE_RCS_ID 00071 #define LRANGE_SUBUNIVERSE_RCS_ID 00072 #ifdef _KEEP_RCS_ID 00073 static char *lrange_subuniverse_rcs_id = "$Source: /scratch/mee/2.4-65/kpro64-pending/be/cg/gra_mon/SCCS/s.gra_lrange_subuniverse.h $ $Revision: 1.2 $"; 00074 #endif 00075 #endif 00076 00077 #include "defs.h" 00078 #include "errors.h" 00079 #include "gra_lrange.h" 00080 00081 class LRANGE_SET_SUBUNIVERSE { 00082 friend class LRANGE_SUB_MGR; 00083 LRANGE** lranges; // Maps integers to LRANGEs 00084 INT32 count; // Number of elements currently in the subuniverse 00085 INT32 alloc_size; // How many it can hold before it must be reallocated 00086 public: 00087 LRANGE_SET_SUBUNIVERSE(void) {} 00088 ~LRANGE_SET_SUBUNIVERSE(void) {} 00089 00090 LRANGE** Lranges(void) { return lranges; } 00091 INT32 Count(void) { return count; } 00092 INT32 Alloc_Size(void) { return alloc_size; } 00093 INT32 Member_Count(void) { return alloc_size; } 00094 00095 void Add(LRANGE* lrange); 00096 LRANGE *Nth_Lrange(INT i); 00097 }; 00098 00099 // use shorter name in gra's code 00100 class LRANGE_SUBUNIVERSE: public LRANGE_SET_SUBUNIVERSE { 00101 }; 00102 00103 class LRANGE_SUB_MGR { 00104 friend class LRANGE_SET_SUBUNIVERSE; 00105 MEM_POOL pool; // where to allocate stuff 00106 BOOL pool_initialized; 00107 public: 00108 LRANGE_SUB_MGR(void) { pool_initialized = FALSE; } 00109 ~LRANGE_SUB_MGR(void) {} 00110 00111 void Initialize(void); 00112 void Finalize(void); 00113 LRANGE_SUBUNIVERSE *Create(INT32 initial_size); 00114 }; 00115 00116 extern LRANGE_SUB_MGR lrange_sub_mgr; 00117 00118 #endif
1.5.6