00001 /* 00002 00003 Copyright (C) 2000 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 #define HAS_STACKED_REGISTERS 00037 #define HAS_ROTATING_REGISTERS 00038 00039 /* 00040 * Target specific register class routines: 00041 * 00042 * Register stack register allocation: 00043 * 00044 * void REGISTER_Init_Stacked(ISA_REGISTER_CLASS rclass) 00045 * Initialize the data to allocate from the register stack for 00046 * a given class (only integer in IA-64). 00047 * 00048 * void REGISTER_Request_Stacked_Rotating_Register() 00049 * Allocate the rotating register from stacked_callee_used 00050 * 00051 * REGISTER REGISTER_Request_Stacked_Register( 00052 * INT has_abi_property, 00053 * ISA_REGISTER_CLASS rclass 00054 * ) 00055 * Return a register from the register stack that behaves like 00056 * the supplied ABI property (callee saved, caller saved, etc...). 00057 * 00058 * REGISTER REGISTER_Allocate_Stacked_Register 00059 * INT has_abi_property, 00060 * ISA_REGISTER_CLASS rclass 00061 * REGISTER reg 00062 * ) 00063 * Allocate a specific register from the stacked registers that 00064 * behaves like the supplied ABI property. 00065 * 00066 * REGISTER_SET REGISTER_Get_Stacked_Avail_Set 00067 * INT has_abi_property, 00068 * ISA_REGISTER_CLASS rclass 00069 * ) 00070 * Return a register set of the registers that are currently 00071 * available from the register stack that behaves like 00072 * the supplied ABI property (i.e. the registers of that 00073 * ABI property that have already been allocated). 00074 * 00075 * BOOL REGISTER_Is_Stacked_Local( 00076 * ISA_REGISTER_CLASS rclass, 00077 * REGISTER reg 00078 * ) 00079 * Return true if the supplied register is a local register 00080 * in the register stack for the given register class. 00081 * 00082 * BOOL REGISTER_Is_Stacked_Output( 00083 * ISA_REGISTER_CLASS rclass, 00084 * REGISTER reg 00085 * ) 00086 * Return true if the supplied register is an output register 00087 * in the register stack for the given register class. 00088 * 00089 * REGISTER REGISTER_Is_Stacked( 00090 * ISA_REGISTER_CLASS rclass, 00091 * REGISTER reg 00092 * ) 00093 * Return true if the supplied register is a member of 00094 * the register stack for the given register class. 00095 * 00096 * BOOL REGISTER_Is_Rotating( 00097 * ISA_REGISTER_CLASS rclass, 00098 * REGISTER reg 00099 * ) 00100 * Return true if the supplied register is a rotating register 00101 * in the register stack for the given register class. 00102 * 00103 * REGISTER REGISTER_Translate_Stacked_Output( 00104 * REGISTER reg 00105 * ) 00106 * Output registers are allocated from the end of the stacked 00107 * set and input/callee from the front. This makes it easier 00108 * to prevent over subscribing the register set. This routine 00109 * will translate the register number of the output register 00110 * to its real number once all the counts are known. 00111 * 00112 * INT REGISTER_Number_Stacked_Output( 00113 * ISA_REGISTER_CLASS rclass 00114 * ) 00115 * INT REGISTER_Number_Stacked_Local( 00116 * ISA_REGISTER_CLASS rclass 00117 * ) 00118 * INT REGISTER_Number_Stacked_Rotating( 00119 * ISA_REGISTER_CLASS rclass 00120 * ) 00121 * Return number of local, output, and rotating registers 00122 * allocated from the register stack. 00123 * 00124 * void REGISTER_Reserve_Rotating_Registers( 00125 * ISA_REGISTER_CLASS rclass, INT n) 00126 * Rerserve n rotating registers. 00127 * 00128 * void REGISTER_Set_Stacked_Output_Minimum(ISA_REGISTER_CLASS rclass, 00129 * INT num) 00130 * Set the minimum number of output registers that must be allocated. 00131 * This is to prevent all of them from being given to over as locals. 00132 * 00133 * BOOL REGISTER_Has_Stacked_Registers(ISA_REGISTER_CLASS rclass) 00134 * Returns TRUE if stacked register set exists for <rclass>. 00135 * 00136 * char * REGISTER_Stacked_Output_Name (REGISTER reg) 00137 * Return software stack name like out0. 00138 * If returns NULL then should just use regular register name. 00139 * 00140 * BOOL REGISTER_Has_Rotating_Registers(ISA_REGISTER_CLASS rclass) 00141 * Returns TRUE if rotating register set exists for <rclass>. 00142 * 00143 * REGISTER REGISTER_First_Rotating_Registers(ISA_REGISTER_CLASS rclass) 00144 * Returns the first rotating register for <rclass>. 00145 * 00146 * REGISTER REGISTER_Last_Rotating_Registers(ISA_REGISTER_CLASS rclass) 00147 * Returns the last rotating register for <rclass>. 00148 * 00149 * BOOL Is_Predicate_REGISTER_CLASS(ISA_REGISTER_CLASS rclass) 00150 * Returns TRUE if the rclass is the predicate register class 00151 * 00152 * REGISTER_SET REGISTER_Get_Requested_Rotating_Registers(ISA_REGISTER_CLASS rclass) 00153 * Returns the set of allocated rotating registers 00154 * 00155 */ 00156 00157 #include "targ_abi_properties.h" 00158 00159 inline BOOL REGISTER_Has_Stacked_Registers(ISA_REGISTER_CLASS rclass) { 00160 if (rclass == ISA_REGISTER_CLASS_integer) { 00161 return TRUE; 00162 } 00163 return FALSE; 00164 } 00165 inline BOOL REGISTER_Has_Rotating_Registers(ISA_REGISTER_CLASS rclass) { 00166 if (rclass == ISA_REGISTER_CLASS_integer || 00167 rclass == ISA_REGISTER_CLASS_float || 00168 rclass == ISA_REGISTER_CLASS_predicate) { 00169 return TRUE; 00170 } 00171 return FALSE; 00172 } 00173 00174 extern void REGISTER_Init_Stacked(ISA_REGISTER_CLASS rclass); 00175 extern REGISTER REGISTER_Request_Stacked_Register(INT has_abi_property, 00176 ISA_REGISTER_CLASS rclass); 00177 extern REGISTER REGISTER_Allocate_Stacked_Register(INT has_abi_property, 00178 ISA_REGISTER_CLASS rclass, 00179 REGISTER reg); 00180 // unallocate a stacked register such that it is not re-used. 00181 extern void REGISTER_Unallocate_Stacked_Register ( 00182 ISA_REGISTER_CLASS rclass, REGISTER reg); 00183 00184 // return whether stacked register is allocatable 00185 extern BOOL REGISTER_Is_Allocatable_Stacked_Register ( 00186 ISA_REGISTER_CLASS rclass, REGISTER reg); 00187 00188 extern INT32 Get_Stacked_Callee_Used(); 00189 extern INT32 Get_Stacked_Caller_Used(); 00190 00191 00192 extern REGISTER_SET REGISTER_Get_Stacked_Avail_Set(INT has_abi_property, 00193 ISA_REGISTER_CLASS rclass); 00194 extern BOOL REGISTER_Is_Stacked_Output(ISA_REGISTER_CLASS rclass, REGISTER reg); 00195 extern BOOL REGISTER_Is_Rotating(ISA_REGISTER_CLASS rclass, REGISTER reg); 00196 extern BOOL REGISTER_Is_Stacked(ISA_REGISTER_CLASS rclass, REGISTER reg); 00197 extern BOOL REGISTER_Is_Stacked_Local(ISA_REGISTER_CLASS rclass, REGISTER reg); 00198 extern REGISTER REGISTER_Translate_Stacked_Output(REGISTER reg); 00199 extern INT REGISTER_Number_Stacked_Output (ISA_REGISTER_CLASS); 00200 extern INT REGISTER_Number_Stacked_Local (ISA_REGISTER_CLASS); 00201 extern INT REGISTER_Number_Stacked_Rotating (ISA_REGISTER_CLASS); 00202 extern INT REGISTER_Number_Stacked_Registers_Available (ISA_REGISTER_CLASS); 00203 00204 extern void REGISTER_Reserve_Rotating_Registers(ISA_REGISTER_CLASS rclass, 00205 INT n); 00206 extern void REGISTER_Set_Stacked_Output_Minimum(ISA_REGISTER_CLASS rclass, 00207 INT num); 00208 00209 extern char * REGISTER_Stacked_Output_Name (REGISTER reg); 00210 00211 extern INT Get_Stacked_Callee_Next(); 00212 extern INT Get_Stacked_Caller_Next(); 00213 00214 extern REGISTER REGISTER_First_Rotating_Registers(ISA_REGISTER_CLASS rclass); 00215 extern REGISTER REGISTER_Last_Rotating_Registers(ISA_REGISTER_CLASS rclass); 00216 extern void REGISTER_Request_Stacked_Rotating_Register(); 00217 00218 inline BOOL Is_Predicate_REGISTER_CLASS(ISA_REGISTER_CLASS rclass) { 00219 return rclass == ISA_REGISTER_CLASS_predicate; 00220 } 00221 00222 extern REGISTER_SET REGISTER_Get_Requested_Rotating_Registers(ISA_REGISTER_CLASS rclass);
1.5.6