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 // Generate ISA registers information 00039 00040 00041 00042 #include <stddef.h> 00043 #include "isa_registers_gen.h" 00044 #include "targ_isa_subset.h" 00045 00046 00047 static int ISA_Mask(ISA_SUBSET isa) 00048 { 00049 return 1 << (int)isa; 00050 } 00051 00052 00053 static int All_ISA_Mask(void) 00054 { 00055 int i; 00056 int mask = 0; 00057 for (i = ISA_SUBSET_MIN; i <= ISA_SUBSET_MAX; ++i) { 00058 mask |= 1 << i; 00059 } 00060 return mask; 00061 } 00062 00063 00064 static int Range_ISA_Mask(ISA_SUBSET min_isa, ISA_SUBSET max_isa) 00065 { 00066 int i; 00067 int mask = 0; 00068 for (i = (int)min_isa; i <= (int)max_isa; ++i) { 00069 mask |= 1 << i; 00070 } 00071 return mask; 00072 } 00073 00074 00075 static const char *ar_reg_names[128] = { 00076 "ar.k0", "ar.k1", "ar.k2", "ar.k3", // 0-3 00077 "ar.k4", "ar.k5", "ar.k6", "ar.k7", // 4-7 00078 NULL, NULL, NULL, NULL, // 8-11 00079 NULL, NULL, NULL, NULL, // 12-15 00080 "ar.rsc", "ar.bsp", "ar.bspstore", "ar.rnat", // 16-19 00081 NULL, "ar.fcr", NULL, NULL, // 20-23 00082 "ar,eflag", "ar.csd", "ar.ssd", "ar.cflg", // 24-27 00083 "ar.fsr", "ar.fir", "ar.fdr", NULL, // 28-31 00084 "ar.ccv", NULL, NULL, NULL, // 32-35 00085 "ar.unat", NULL, NULL, NULL, // 36-39 00086 "ar.fpsr", NULL, NULL, NULL, // 40-43 00087 "ar.itc", NULL, NULL, NULL, // 44-47 00088 NULL, NULL, NULL, NULL, // 48-51 00089 NULL, NULL, NULL, NULL, // 52-55 00090 NULL, NULL, NULL, NULL, // 56-59 00091 NULL, NULL, NULL, NULL, // 60-63 00092 "ar.pfs", "ar.lc", "ar.ec", NULL, // 64-67 00093 NULL, NULL, NULL, NULL, // 68-71 00094 NULL, NULL, NULL, NULL, // 72-75 00095 NULL, NULL, NULL, NULL, // 76-79 00096 NULL, NULL, NULL, NULL, // 80-83 00097 NULL, NULL, NULL, NULL, // 84-87 00098 NULL, NULL, NULL, NULL, // 88-91 00099 NULL, NULL, NULL, NULL, // 92-95 00100 NULL, NULL, NULL, NULL, // 96-99 00101 NULL, NULL, NULL, NULL, // 100-103 00102 NULL, NULL, NULL, NULL, // 104-107 00103 NULL, NULL, NULL, NULL, // 108-111 00104 NULL, NULL, NULL, NULL, // 112-115 00105 NULL, NULL, NULL, NULL, // 116-119 00106 NULL, NULL, NULL, NULL, // 120-123 00107 NULL, NULL, NULL, NULL, // 124-127 00108 }; 00109 00110 00111 static const char *cr_reg_names[128] = { 00112 "cr.dcr", "cr.itm", "cr.iva", NULL, // 0-3 00113 NULL, NULL, NULL, NULL, // 4-7 00114 "cr.pta", NULL, NULL, NULL, // 8-11 00115 NULL, NULL, NULL, NULL, // 12-15 00116 "cr.ipsr", "cr.isr", NULL, "cr.iip", // 16-19 00117 "cr.ifa", "cr.itir", "cr.iipa", "cr.ifs", // 20-23 00118 "cr.iim", "cr.iha", NULL, NULL, // 24-27 00119 NULL, NULL, NULL, NULL, // 28-31 00120 NULL, NULL, NULL, NULL, // 32-35 00121 NULL, NULL, NULL, NULL, // 36-39 00122 NULL, NULL, NULL, NULL, // 40-43 00123 NULL, NULL, NULL, NULL, // 44-47 00124 NULL, NULL, NULL, NULL, // 48-51 00125 NULL, NULL, NULL, NULL, // 52-55 00126 NULL, NULL, NULL, NULL, // 56-59 00127 NULL, NULL, NULL, NULL, // 60-63 00128 "cr.lid", "cr.ivr", "cr.tpr", "cr.eoi", // 64-67 00129 "cr.irr0", "cr.irr1", "cr.irr2", "cr.irr3", // 68-71 00130 "cr.itv", "cr.pmv", "cr.cmcv", NULL, // 72-75 00131 NULL, NULL, NULL, NULL, // 76-79 00132 "cr.lrr0", "cr.lrr1", NULL, NULL, // 80-83 00133 NULL, NULL, NULL, NULL, // 84-87 00134 NULL, NULL, NULL, NULL, // 88-91 00135 NULL, NULL, NULL, NULL, // 92-95 00136 NULL, NULL, NULL, NULL, // 96-99 00137 NULL, NULL, NULL, NULL, // 100-103 00138 NULL, NULL, NULL, NULL, // 104-107 00139 NULL, NULL, NULL, NULL, // 108-111 00140 NULL, NULL, NULL, NULL, // 112-115 00141 NULL, NULL, NULL, NULL, // 116-119 00142 NULL, NULL, NULL, NULL, // 120-123 00143 NULL, NULL, NULL, NULL, // 124-127 00144 }; 00145 00146 static const char *int_reg_names[128] = { 00147 NULL, "gp", NULL, NULL, NULL, NULL, NULL, NULL, // 0-7 00148 NULL, NULL, NULL, NULL, "sp", NULL, NULL, NULL, // 8-15 00149 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 16-23 00150 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 24-31 00151 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 32-39 00152 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 40-47 00153 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 48-55 00154 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 56-63 00155 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 64-71 00156 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 72-79 00157 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 80-87 00158 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 88-95 00159 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 96-103 00160 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 104-111 00161 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 112-119 00162 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 120-127 00163 }; 00164 00165 static const int addl_regs[] = { 0, 1, 2, 3 }; 00166 00167 static const int ec_regs[] = { 66 }; 00168 static const int lc_regs[] = { 65 }; 00169 static int num_ar_i_regs, ar_i_regs[128]; 00170 static int num_ar_m_regs, ar_m_regs[128]; 00171 00172 static void init_ar_regs(void) 00173 { 00174 int i; 00175 int n; 00176 00177 n = 0; 00178 for (i = 0; i <= 63; ++i) ar_m_regs[n++] = i; 00179 for (i = 112; i <= 127; ++i) ar_m_regs[n++] = i; 00180 num_ar_m_regs = n; 00181 00182 n = 0; 00183 for (i = 48; i <= 127; ++i) ar_i_regs[n++] = i; 00184 num_ar_i_regs = n; 00185 } 00186 00187 #define NELEMS(a) (sizeof(a) / sizeof(*(a))) 00188 00189 main() 00190 { 00191 ISA_REGISTER_CLASS 00192 rc_integer, 00193 rc_float, 00194 rc_predicate, 00195 rc_branch, 00196 rc_application, 00197 rc_control; 00198 00199 ISA_Registers_Begin("ia64"); 00200 00201 init_ar_regs(); 00202 00203 rc_integer = ISA_Register_Class_Create("integer", 64, true, false); 00204 rc_float = ISA_Register_Class_Create("float", 82, true, false); 00205 rc_predicate = ISA_Register_Class_Create("predicate", 1, false, true); 00206 rc_branch = ISA_Register_Class_Create("branch", 64, false, false); 00207 rc_application = ISA_Register_Class_Create("application", 64, false, false); 00208 rc_control = ISA_Register_Class_Create("control", 64, false, false); 00209 00210 ISA_Register_Set(rc_integer, 0, 127, "r%d", int_reg_names, All_ISA_Mask()); 00211 // 32-127 rotate 00212 // r0 == 0 00213 ISA_Register_Subclass_Create("addl", rc_integer, 00214 NELEMS(addl_regs), addl_regs, NULL); 00215 00216 ISA_Register_Set(rc_float, 0, 127, "f%d", NULL, All_ISA_Mask()); 00217 // 32-127 rotate 00218 // f0 = 0.0 00219 // f1 = 1.1 00220 00221 ISA_Register_Set(rc_predicate, 0, 63, "p%d", NULL, All_ISA_Mask()); 00222 // 16-63 rotate 00223 // p0 = 1 00224 00225 ISA_Register_Set(rc_branch, 0, 7, "b%d", NULL, All_ISA_Mask()); 00226 00227 ISA_Register_Set(rc_application, 0, 127, "ar%d", ar_reg_names, 00228 All_ISA_Mask()); 00229 ISA_Register_Subclass_Create("ar_i", rc_application, 00230 num_ar_i_regs, ar_i_regs, NULL); 00231 ISA_Register_Subclass_Create("ar_m", rc_application, 00232 num_ar_m_regs, ar_m_regs, NULL); 00233 ISA_Register_Subclass_Create("ec", rc_application, 00234 NELEMS(ec_regs), ec_regs, NULL); 00235 ISA_Register_Subclass_Create("lc", rc_application, 00236 NELEMS(lc_regs), lc_regs, NULL); 00237 00238 ISA_Register_Set(rc_control, 0, 127, "cr%d", cr_reg_names, 00239 All_ISA_Mask()); 00240 00241 ISA_Registers_End(); 00242 return 0; 00243 }