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
00043
00044
00045
00046 #include <stddef.h>
00047 #include "isa_registers_gen.h"
00048 #include "targ_isa_subset.h"
00049
00050
00051 static int ISA_Mask(ISA_SUBSET isa)
00052 {
00053 return 1 << (int)isa;
00054 }
00055
00056
00057 static int All_ISA_Mask(void)
00058 {
00059 int i;
00060 int mask = 0;
00061 for (i = ISA_SUBSET_MIN; i <= ISA_SUBSET_MAX; ++i) {
00062 mask |= 1 << i;
00063 }
00064 return mask;
00065 }
00066
00067
00068 static int Range_ISA_Mask(ISA_SUBSET min_isa, ISA_SUBSET max_isa)
00069 {
00070 int i;
00071 int mask = 0;
00072 for (i = (int)min_isa; i <= (int)max_isa; ++i) {
00073 mask |= 1 << i;
00074 }
00075 return mask;
00076 }
00077
00078
00079 static const char *ar_reg_names[128] = {
00080 "ar.k0", "ar.k1", "ar.k2", "ar.k3",
00081 "ar.k4", "ar.k5", "ar.k6", "ar.k7",
00082 NULL, NULL, NULL, NULL,
00083 NULL, NULL, NULL, NULL,
00084 "ar.rsc", "ar.bsp", "ar.bspstore", "ar.rnat",
00085 NULL, "ar.fcr", NULL, NULL,
00086 "ar,eflag", "ar.csd", "ar.ssd", "ar.cflg",
00087 "ar.fsr", "ar.fir", "ar.fdr", NULL,
00088 "ar.ccv", NULL, NULL, NULL,
00089 "ar.unat", NULL, NULL, NULL,
00090 "ar.fpsr", NULL, NULL, NULL,
00091 "ar.itc", NULL, NULL, NULL,
00092 NULL, NULL, NULL, NULL,
00093 NULL, NULL, NULL, NULL,
00094 NULL, NULL, NULL, NULL,
00095 NULL, NULL, NULL, NULL,
00096 "ar.pfs", "ar.lc", "ar.ec", 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 NULL, NULL, NULL, NULL,
00109 NULL, NULL, NULL, NULL,
00110 NULL, NULL, NULL, NULL,
00111 NULL, NULL, NULL, NULL,
00112 };
00113
00114
00115 static const char *cr_reg_names[128] = {
00116 "cr.dcr", "cr.itm", "cr.iva", NULL,
00117 NULL, NULL, NULL, NULL,
00118 "cr.pta", NULL, NULL, NULL,
00119 NULL, NULL, NULL, NULL,
00120 "cr.ipsr", "cr.isr", NULL, "cr.iip",
00121 "cr.ifa", "cr.itir", "cr.iipa", "cr.ifs",
00122 "cr.iim", "cr.iha", 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 NULL, NULL, NULL, NULL,
00129 NULL, NULL, NULL, NULL,
00130 NULL, NULL, NULL, NULL,
00131 NULL, NULL, NULL, NULL,
00132 "cr.lid", "cr.ivr", "cr.tpr", "cr.eoi",
00133 "cr.irr0", "cr.irr1", "cr.irr2", "cr.irr3",
00134 "cr.itv", "cr.pmv", "cr.cmcv", NULL,
00135 NULL, NULL, NULL, NULL,
00136 "cr.lrr0", "cr.lrr1", 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 NULL, NULL, NULL, NULL,
00145 NULL, NULL, NULL, NULL,
00146 NULL, NULL, NULL, NULL,
00147 NULL, NULL, NULL, NULL,
00148 };
00149
00150 static const char *int_reg_names[128] = {
00151 NULL, "gp", NULL, NULL, NULL, NULL, NULL, NULL,
00152 NULL, NULL, NULL, NULL, "sp", 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 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00164 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00165 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00166 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00167 };
00168
00169 static const int addl_regs[] = { 0, 1, 2, 3 };
00170
00171 static const int ec_regs[] = { 66 };
00172 static const int lc_regs[] = { 65 };
00173 static int num_ar_i_regs, ar_i_regs[128];
00174 static int num_ar_m_regs, ar_m_regs[128];
00175
00176 static void init_ar_regs(void)
00177 {
00178 int i;
00179 int n;
00180
00181 n = 0;
00182 for (i = 0; i <= 63; ++i) ar_m_regs[n++] = i;
00183 for (i = 112; i <= 127; ++i) ar_m_regs[n++] = i;
00184 num_ar_m_regs = n;
00185
00186 n = 0;
00187 for (i = 48; i <= 127; ++i) ar_i_regs[n++] = i;
00188 num_ar_i_regs = n;
00189 }
00190
00191 #define NELEMS(a) (sizeof(a) / sizeof(*(a)))
00192
00193 main()
00194 {
00195 ISA_REGISTER_CLASS
00196 rc_integer,
00197 rc_float,
00198 rc_predicate,
00199 rc_branch,
00200 rc_application,
00201 rc_control;
00202
00203 ISA_Registers_Begin("ia64");
00204
00205 init_ar_regs();
00206
00207 rc_integer = ISA_Register_Class_Create("integer", 64, true, false);
00208 rc_float = ISA_Register_Class_Create("float", 82, true, false);
00209 rc_predicate = ISA_Register_Class_Create("predicate", 1, false, true);
00210 rc_branch = ISA_Register_Class_Create("branch", 64, false, false);
00211 rc_application = ISA_Register_Class_Create("application", 64, false, false);
00212 rc_control = ISA_Register_Class_Create("control", 64, false, false);
00213
00214 ISA_Register_Set(rc_integer, 0, 127, "r%d", int_reg_names, All_ISA_Mask());
00215
00216
00217 ISA_Register_Subclass_Create("addl", rc_integer,
00218 NELEMS(addl_regs), addl_regs, NULL);
00219
00220 ISA_Register_Set(rc_float, 0, 127, "f%d", NULL, All_ISA_Mask());
00221
00222
00223
00224
00225 ISA_Register_Set(rc_predicate, 0, 63, "p%d", NULL, All_ISA_Mask());
00226
00227
00228
00229 ISA_Register_Set(rc_branch, 0, 7, "b%d", NULL, All_ISA_Mask());
00230
00231 ISA_Register_Set(rc_application, 0, 127, "ar%d", ar_reg_names,
00232 All_ISA_Mask());
00233 ISA_Register_Subclass_Create("ar_i", rc_application,
00234 num_ar_i_regs, ar_i_regs, NULL);
00235 ISA_Register_Subclass_Create("ar_m", rc_application,
00236 num_ar_m_regs, ar_m_regs, NULL);
00237 ISA_Register_Subclass_Create("ec", rc_application,
00238 NELEMS(ec_regs), ec_regs, NULL);
00239 ISA_Register_Subclass_Create("lc", rc_application,
00240 NELEMS(lc_regs), lc_regs, NULL);
00241
00242 ISA_Register_Set(rc_control, 0, 127, "cr%d", cr_reg_names,
00243 All_ISA_Mask());
00244
00245 ISA_Registers_End();
00246 return 0;
00247 }