00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
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",
00077 "ar.k4", "ar.k5", "ar.k6", "ar.k7",
00078 NULL, NULL, NULL, NULL,
00079 NULL, NULL, NULL, NULL,
00080 "ar.rsc", "ar.bsp", "ar.bspstore", "ar.rnat",
00081 NULL, "ar.fcr", NULL, NULL,
00082 "ar,eflag", "ar.csd", "ar.ssd", "ar.cflg",
00083 "ar.fsr", "ar.fir", "ar.fdr", NULL,
00084 "ar.ccv", NULL, NULL, NULL,
00085 "ar.unat", NULL, NULL, NULL,
00086 "ar.fpsr", NULL, NULL, NULL,
00087 "ar.itc", NULL, NULL, NULL,
00088 NULL, NULL, NULL, NULL,
00089 NULL, NULL, NULL, NULL,
00090 NULL, NULL, NULL, NULL,
00091 NULL, NULL, NULL, NULL,
00092 "ar.pfs", "ar.lc", "ar.ec", NULL,
00093 NULL, NULL, NULL, NULL,
00094 NULL, NULL, NULL, NULL,
00095 NULL, NULL, NULL, NULL,
00096 NULL, NULL, NULL, NULL,
00097 NULL, NULL, NULL, NULL,
00098 NULL, NULL, NULL, NULL,
00099 NULL, NULL, NULL, NULL,
00100 NULL, NULL, NULL, NULL,
00101 NULL, NULL, NULL, NULL,
00102 NULL, NULL, NULL, NULL,
00103 NULL, NULL, NULL, NULL,
00104 NULL, NULL, NULL, NULL,
00105 NULL, NULL, NULL, NULL,
00106 NULL, NULL, NULL, NULL,
00107 NULL, NULL, NULL, NULL,
00108 };
00109
00110
00111 static const char *cr_reg_names[128] = {
00112 "cr.dcr", "cr.itm", "cr.iva", NULL,
00113 NULL, NULL, NULL, NULL,
00114 "cr.pta", NULL, NULL, NULL,
00115 NULL, NULL, NULL, NULL,
00116 "cr.ipsr", "cr.isr", NULL, "cr.iip",
00117 "cr.ifa", "cr.itir", "cr.iipa", "cr.ifs",
00118 "cr.iim", "cr.iha", NULL, NULL,
00119 NULL, NULL, NULL, NULL,
00120 NULL, NULL, NULL, NULL,
00121 NULL, NULL, NULL, NULL,
00122 NULL, NULL, NULL, NULL,
00123 NULL, NULL, NULL, NULL,
00124 NULL, NULL, NULL, NULL,
00125 NULL, NULL, NULL, NULL,
00126 NULL, NULL, NULL, NULL,
00127 NULL, NULL, NULL, NULL,
00128 "cr.lid", "cr.ivr", "cr.tpr", "cr.eoi",
00129 "cr.irr0", "cr.irr1", "cr.irr2", "cr.irr3",
00130 "cr.itv", "cr.pmv", "cr.cmcv", NULL,
00131 NULL, NULL, NULL, NULL,
00132 "cr.lrr0", "cr.lrr1", NULL, NULL,
00133 NULL, NULL, NULL, NULL,
00134 NULL, NULL, NULL, NULL,
00135 NULL, NULL, NULL, NULL,
00136 NULL, NULL, NULL, NULL,
00137 NULL, NULL, NULL, NULL,
00138 NULL, NULL, NULL, NULL,
00139 NULL, NULL, NULL, NULL,
00140 NULL, NULL, NULL, NULL,
00141 NULL, NULL, NULL, NULL,
00142 NULL, NULL, NULL, NULL,
00143 NULL, NULL, NULL, NULL,
00144 };
00145
00146 static const char *int_reg_names[128] = {
00147 NULL, "gp", NULL, NULL, NULL, NULL, NULL, NULL,
00148 NULL, NULL, NULL, NULL, "sp", NULL, NULL, NULL,
00149 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00150 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00151 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00152 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00153 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00154 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00155 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00156 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00157 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00158 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00159 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00160 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00161 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00162 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
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
00212
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
00218
00219
00220
00221 ISA_Register_Set(rc_predicate, 0, 63, "p%d", NULL, All_ISA_Mask());
00222
00223
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 }