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
00038
00039
00040
00041 #include "operands_gen.h"
00042
00043 static const char* const description[] = {
00044 "/* ====================================================================",
00045 " * ====================================================================",
00046 " *",
00047 " * Description:",
00048 " *",
00049 " * A description of the ISA instruction operands. The description",
00050 " * exports the following:",
00051 " *",
00052 " * typedef (struct) ISA_OPERAND_VALTYP",
00053 " * Describes a particular operand/result type, including",
00054 " * the type of value it may contain and whether or not is",
00055 " * a register, literal or enum. The contents are private.",
00056 " *",
00057 " * typedef (struct) ISA_OPERAND_INFO",
00058 " * Identifies the operand types of a particular instruction.",
00059 " * The contents are private.",
00060 " *",
00061 " *, typedef (enum) ISA_OPERAND_USE",
00062 " * Identifies the useage of an operand of a particular instruction.",
00063 " * The names have the form OU_xxxx.",
00064 " *",
00065 " * const INT OU_UNDEFINED",
00066 " * Identifies an undefined/unknown operand use.",
00067 " *",
00068 " * const INT ISA_OPERAND_max_operands",
00069 " * The maximum number of operands of any instruction.",
00070 " *",
00071 " * const INT ISA_OPERAND_max_results",
00072 " * The maximum number of results of any instruction.",
00073 " *",
00074 " * const ISA_OPERAND_INFO *ISA_OPERAND_Info(TOP topcode)",
00075 " * Return a pointer to the operand info for the instruction",
00076 " * specified by 'topcode'.",
00077 " *",
00078 " * INT ISA_OPERAND_INFO_Operands(const ISA_OPERAND_INFO *oinfo)",
00079 " * Return the number of operands specified by the operand",
00080 " * info 'oinfo'.",
00081 " *",
00082 " * const ISA_OPERAND_VALTYP *ISA_OPERAND_INFO_Operand(",
00083 " * const ISA_OPERAND_INFO *oinfo,",
00084 " * int opnd",
00085 " * )",
00086 " * Get the operand type of operand 'opnd' specified by the",
00087 " * operand info 'oinfo'.",
00088 " *",
00089 " * INT ISA_OPERAND_INFO_Results(const ISA_OPERAND_INFO *oinfo)",
00090 " * Return the number of results specified by the operand",
00091 " * info 'oinfo'.",
00092 " *",
00093 " * const ISA_OPERAND_VALTYP *ISA_OPERAND_INFO_Result(",
00094 " * const ISA_OPERAND_INFO *oinfo,",
00095 " * int result",
00096 " * )",
00097 " * Get the operand type for the result 'result' specified by the",
00098 " * operand info 'oinfo'.",
00099 " *",
00100 " * ISA_OPERAND_USE ISA_OPERAND_INFO_Use(",
00101 " * const ISA_OPERAND_INFO *oinfo,",
00102 " * INT opnd",
00103 " * )",
00104 " * Get the operand use type of operand 'opnd' specified by the",
00105 " * operand info 'oinfo'.",
00106 " *",
00107 " * BOOL ISA_OPERAND_Any_Use(ISA_OPERAND_USE ouse)",
00108 " * Returns a boolean that indicates if any instruction in the",
00109 " * architecture has an an operand with usage 'use'. Useful",
00110 " * for omitting sections of code that aren't applicable to",
00111 " * some architectures.",
00112 " *",
00113 " * ISA_REGISTER_CLASS ISA_OPERAND_VALTYP_Register_Class(",
00114 " * const ISA_OPERAND_VALTYP *otype",
00115 " * )",
00116 " * Get the register class for the operand specified by 'otype'.",
00117 " *",
00118 " * ISA_REGISTER_SUBCLASS ISA_OPERAND_VALTYP_Register_Subclass(",
00119 " * const ISA_OPERAND_VALTYP *otype",
00120 " * )",
00121 " * Get the register subclass for the operand specified by 'otype'.",
00122 " *",
00123 " * ISA_LIT_CLASS ISA_OPERAND_VALTYP_Literal_Class(const ISA_OPERAND_VALTYP *otype)",
00124 " * Get the literal class for the operand specified by 'otype'.",
00125 " *",
00126 " * ISA_ENUM_CLASS ISA_OPERAND_VALTYP_Enum_Class(",
00127 " * const ISA_OPERAND_VALTYP *otype",
00128 " * )",
00129 " * Get the enum class for the operand specified by 'otype'.",
00130 " *",
00131 " * INT ISA_OPERAND_VALTYP_Size(const ISA_OPERAND_VALTYP *otype)",
00132 " * Get the size for the operand specified by 'otype'.",
00133 " *",
00134 " * BOOL ISA_OPERAND_VALTYP_Is_Register(const ISA_OPERAND_VALTYP *otype)",
00135 " * Return a boolean to specify if the operand specifed",
00136 " * by 'otype' is a register.",
00137 " *",
00138 " * BOOL ISA_OPERAND_VALTYP_Is_Signed(const ISA_OPERAND_VALTYP *otype)",
00139 " * Return a boolean to specify if the operand specifed",
00140 " * by 'otype' is signed.",
00141 " *",
00142 " * BOOL ISA_OPERAND_VALTYP_Is_FPU_Int(const ISA_OPERAND_VALTYP *otype)",
00143 " * Return a boolean to specify if the operand specifed",
00144 " * by 'otype' is an FPU integer.",
00145 " *",
00146 " * BOOL ISA_OPERAND_VALTYP_Is_PCRel(const ISA_OPERAND_VALTYP *otype)",
00147 " * Return a boolean to specify if the operand specifed",
00148 " * by 'otype' is pc-relative.",
00149 " *",
00150 " * BOOL ISA_OPERAND_VALTYP_Is_Literal (const ISA_OPERAND_VALTYP *otype)",
00151 " * Return a boolean to specify if the operand specifed",
00152 " * by 'otype' is a literal.",
00153 " *",
00154 " * BOOL ISA_OPERAND_VALTYP_Is_Enum (const ISA_OPERAND_VALTYP *otype)",
00155 " * Return a boolean to specify if the operand specifed",
00156 " * by 'otype' is an enum.",
00157 " *",
00158 " * BOOL TOP_Can_Have_Immediate(INT64 value, TOP topcode)",
00159 " * Return a boolean to specify if the 64-bit integer value can fit",
00160 " * in the literal field of an instruction with the given topcode.",
00161 " *",
00162 " * INT TOP_Immediate_Operand(TOP topcode, ISA_LIT_CLASS *lclass)",
00163 " * If 'topcode' has an immediate operand, return its operand",
00164 " * number by value and literal class by reference through 'lclass'",
00165 " * (a null pointer can be passed for 'lclass' if the literal",
00166 " * class is not needed). If there is no immediate operand, return -1.",
00167 " *",
00168 " * INT TOP_Relocatable_Operand(TOP topcode, ISA_LIT_CLASS *lclass)",
00169 " * If 'topcode' has a relocatable operand, return its operand",
00170 " * number by value and literal class by reference through 'lclass'",
00171 " * (a null pointer can be passed for 'lclass' if the literal",
00172 " * class is not needed). If there is no relocatable operand, return -1.",
00173 " *",
00174 " * INT TOP_Find_Operand_Use(TOP topcode, ISA_OPERAND_USE use)",
00175 " * For the instruction specified by 'topcode', give the",
00176 " * operand number with the use 'use'. If there is no such",
00177 " * operand, return -1.",
00178 " *",
00179 " * void TOP_Operand_Uses(TOP topcode, ISA_OPERAND_USE *uses)",
00180 " * For the instruction specified by 'topcode', return",
00181 " * the usage of all its operands in the array pointed to",
00182 " * by 'uses'. The use of operand n corresponds to 'uses'[n].",
00183 " *",
00184 " * ====================================================================",
00185 " * ====================================================================",
00186 " */", NULL};
00187
00188 static const char* const opnd_query[]= {
00189 "inline const ISA_OPERAND_INFO *ISA_OPERAND_Info(TOP topcode)",
00190 "{",
00191 " extern const mUINT8 ISA_OPERAND_info_index[];",
00192 " extern const ISA_OPERAND_INFO ISA_OPERAND_info[];",
00193 " INT index = ISA_OPERAND_info_index[(INT)topcode];",
00194 " return &ISA_OPERAND_info[index];",
00195 "}",
00196 "",
00197 "inline INT ISA_OPERAND_INFO_Operands(const ISA_OPERAND_INFO *oinfo)",
00198 "{",
00199 " return oinfo->opnds;",
00200 "}",
00201 "",
00202 "inline const ISA_OPERAND_VALTYP *ISA_OPERAND_INFO_Operand(",
00203 " const ISA_OPERAND_INFO *oinfo,",
00204 " INT opnd)",
00205 "{",
00206 " extern const ISA_OPERAND_VALTYP ISA_OPERAND_operand_types[];",
00207 " INT index = oinfo->opnd[opnd];",
00208 " return &ISA_OPERAND_operand_types[index];",
00209 "}",
00210 "",
00211 "inline INT ISA_OPERAND_INFO_Results(const ISA_OPERAND_INFO *oinfo)",
00212 "{",
00213 " return oinfo->results;",
00214 "}",
00215 "",
00216 "inline const ISA_OPERAND_VALTYP *ISA_OPERAND_INFO_Result(",
00217 " const ISA_OPERAND_INFO *oinfo,",
00218 " INT result)",
00219 "{",
00220 " extern const ISA_OPERAND_VALTYP ISA_OPERAND_operand_types[];",
00221 " INT index = oinfo->result[result];",
00222 " return &ISA_OPERAND_operand_types[index];",
00223 "}",
00224 "",
00225 "inline ISA_REGISTER_CLASS ISA_OPERAND_VALTYP_Register_Class(",
00226 " const ISA_OPERAND_VALTYP *otype)",
00227 "{",
00228 " return (ISA_REGISTER_CLASS)otype->rclass;",
00229 "}",
00230 "",
00231 "inline ISA_REGISTER_SUBCLASS ISA_OPERAND_VALTYP_Register_Subclass(",
00232 " const ISA_OPERAND_VALTYP *otype)",
00233 "{",
00234 " return (ISA_REGISTER_SUBCLASS)otype->rsubclass;",
00235 "}",
00236 "",
00237 "inline ISA_LIT_CLASS ISA_OPERAND_VALTYP_Literal_Class(const ISA_OPERAND_VALTYP *otype)",
00238 "{",
00239 " return (ISA_LIT_CLASS)otype->lclass;",
00240 "}",
00241 "",
00242 "inline ISA_ENUM_CLASS ISA_OPERAND_VALTYP_Enum_Class(",
00243 " const ISA_OPERAND_VALTYP *otype)",
00244 "{",
00245 " return (ISA_ENUM_CLASS)otype->eclass;",
00246 "}",
00247 "",
00248 "inline INT ISA_OPERAND_VALTYP_Size(const ISA_OPERAND_VALTYP *otype)",
00249 "{",
00250 " return otype->size;",
00251 "}",
00252 "",
00253 "inline BOOL ISA_OPERAND_VALTYP_Is_Register(const ISA_OPERAND_VALTYP *otype)",
00254 "{",
00255 " return (otype->flags & 0x01) != 0;",
00256 "}",
00257 "",
00258 "inline BOOL ISA_OPERAND_VALTYP_Is_Literal(const ISA_OPERAND_VALTYP *otype)",
00259 "{",
00260 " return (otype->lclass != LC_UNDEFINED);",
00261 "}",
00262 "",
00263 "inline BOOL ISA_OPERAND_VALTYP_Is_Enum(const ISA_OPERAND_VALTYP *otype)",
00264 "{",
00265 " return (otype->eclass != EC_UNDEFINED);",
00266 "}",
00267 "",
00268 "inline BOOL ISA_OPERAND_VALTYP_Is_Signed(const ISA_OPERAND_VALTYP *otype)",
00269 "{",
00270 " return (otype->flags & 0x02) != 0;",
00271 "}",
00272 "",
00273 "/*ARGSUSED*/",
00274 "inline BOOL ISA_OPERAND_VALTYP_Is_FPU_Int(const ISA_OPERAND_VALTYP *otype)",
00275 "{",
00276 " return FALSE;",
00277 "}",
00278 "",
00279 "inline BOOL ISA_OPERAND_VALTYP_Is_PCRel(const ISA_OPERAND_VALTYP *otype)",
00280 "{",
00281 " return (otype->flags & 0x08) != 0;",
00282 "}",
00283 "",
00284 "inline ISA_OPERAND_USE ISA_OPERAND_INFO_Use(",
00285 " const ISA_OPERAND_INFO *oinfo,",
00286 " INT opnd)",
00287 "{",
00288 " return (ISA_OPERAND_USE)oinfo->ouse[opnd];",
00289 "}",
00290 "",
00291 "inline BOOL ISA_OPERAND_Any_Use(ISA_OPERAND_USE ouse)",
00292 "{",
00293 " return (0x00000000000003fbULL & (1ULL << ouse)) != 0;",
00294 "}",
00295 "",
00296 "extern INT TOP_Immediate_Operand(TOP topcode, ISA_LIT_CLASS *lclass);",
00297 "",
00298 "extern INT TOP_Relocatable_Operand(TOP topcode, ISA_LIT_CLASS *lclass);",
00299 "",
00300 "extern BOOL TOP_Can_Have_Immediate(INT64 value, TOP topcode);",
00301 "",
00302 "extern INT TOP_Find_Operand_Use(TOP topcode, ISA_OPERAND_USE use);",
00303 "",
00304 "extern void TOP_Operand_Uses(TOP topcode, ISA_OPERAND_USE *uses);\n",
00305 NULL};
00306
00307
00308 static const char * const top_opnd_query_func[]= {
00309 "INT TOP_Immediate_Operand(TOP topcode, ISA_LIT_CLASS *lclass)",
00310 "{",
00311 " INT iopnd;",
00312 " const ISA_OPERAND_INFO *opinfo = ISA_OPERAND_Info(topcode);",
00313 " INT opnds = ISA_OPERAND_INFO_Operands(opinfo);",
00314 " const INT first = 0;",
00315 "",
00316 " for (iopnd = first; iopnd < opnds; ++iopnd) {",
00317 " const ISA_OPERAND_VALTYP *vtype = ISA_OPERAND_INFO_Operand(opinfo, iopnd);",
00318 " ISA_LIT_CLASS lit_class = ISA_OPERAND_VALTYP_Literal_Class(vtype);",
00319 " if (lit_class != LC_UNDEFINED) {",
00320 " if (lclass) *lclass = lit_class;",
00321 " return iopnd;",
00322 " }",
00323 " }",
00324 "",
00325 " return -1;",
00326 "}",
00327 "",
00328 "INT TOP_Relocatable_Operand(TOP topcode, ISA_LIT_CLASS *lclass)",
00329 "{",
00330 " extern const mINT8 ISA_OPERAND_relocatable_opnd[];",
00331 " INT iopnd = ISA_OPERAND_relocatable_opnd[(INT)topcode];",
00332 " if (lclass && iopnd >= 0) {",
00333 " const ISA_OPERAND_INFO *opinfo = ISA_OPERAND_Info(topcode);",
00334 " const ISA_OPERAND_VALTYP *vtype = ISA_OPERAND_INFO_Operand(opinfo,iopnd);",
00335 " *lclass = (ISA_LIT_CLASS)ISA_OPERAND_VALTYP_Literal_Class(vtype);",
00336 " }",
00337 " return iopnd;",
00338 "}",
00339 "",
00340 "BOOL TOP_Can_Have_Immediate(INT64 value, TOP topcode)",
00341 "{",
00342 " ISA_LIT_CLASS lclass;",
00343 " if (TOP_Immediate_Operand(topcode, &lclass) < 0) return 0;",
00344 " return ISA_LC_Value_In_Class(value, lclass);",
00345 "}",
00346 "",
00347 "INT TOP_Find_Operand_Use(TOP topcode, ISA_OPERAND_USE use)",
00348 "{",
00349 " INT i;",
00350 " const ISA_OPERAND_INFO *oinfo = ISA_OPERAND_Info(topcode);",
00351 " INT opnds = ISA_OPERAND_INFO_Operands(oinfo);",
00352 " for (i = 0; i < opnds; ++i) {",
00353 " ISA_OPERAND_USE this_use = ISA_OPERAND_INFO_Use(oinfo, i);",
00354 " if (this_use == use) return i;",
00355 " }",
00356 " return -1;",
00357 "}",
00358 "",
00359 "void TOP_Operand_Uses(TOP topcode, ISA_OPERAND_USE *uses)",
00360 "{",
00361 " INT i;",
00362 " const ISA_OPERAND_INFO *oinfo = ISA_OPERAND_Info(topcode);",
00363 " INT opnds = ISA_OPERAND_INFO_Operands(oinfo);",
00364 " for (i = 0; i < opnds; ++i) {",
00365 " ISA_OPERAND_USE this_use = ISA_OPERAND_INFO_Use(oinfo, i);",
00366 " uses[i] = this_use;",
00367 " }",
00368 "}", NULL};
00369
00370
00371
00372 void Operands_Generator(void *pknobs, GEN_MODE mode)
00373 {
00374 FILE *c_file, *h_file, *export_file;
00375 int max=0;
00376 int max_src, max_dest;
00377
00378
00379 int reg_class_count = EKAPI_RegClassCount(pknobs);
00380 int max_reg_count = 0;
00381 EKAPI_REGISTER_CLASS_INFO *reg_class_info = (EKAPI_REGISTER_CLASS_INFO*)
00382 malloc(reg_class_count*sizeof(EKAPI_REGISTER_CLASS_INFO));
00383
00384 for (int reg_i=0; reg_i<reg_class_count; reg_i++){
00385 EKAPI_RegStruct4id(pknobs, ®_class_info[reg_i], reg_i);
00386 if (EKAPI_GetRegMaxNum(®_class_info[reg_i]) > max_reg_count){
00387 max_reg_count = EKAPI_GetRegMaxNum(®_class_info[reg_i]);
00388 }
00389 }
00390
00391 Init_Module_Files(mode, "targ_isa_operands",
00392 &c_file, &h_file, &export_file);
00393 Emit_Header(h_file, "targ_isa_operands", description);
00394 fprintf(h_file, "#include \"topcode.h\"\n"
00395 "#include \"targ_isa_registers.h\"\n"
00396 "#include \"targ_isa_enums.h\"\n"
00397 "#include \"targ_isa_lits.h\"\n\n" );
00398 fprintf(c_file, "#include \"targ_isa_operands.h\"\n"
00399 "#include \"targ_isa_registers.h\"\n"
00400 "#include \"targ_isa_properties.h\"\n"
00401 "#include \"targ_isa_lits.h\"\n\n" );
00402
00403
00404 int use_i;
00405 fprintf(h_file, "typedef enum {\n");
00406 for (use_i=0; use_i<EKAPI_OpndUseCount(pknobs); use_i++){
00407 fprintf(h_file, " %s,\n", EKAPI_OpndUseName(pknobs, use_i));
00408 }
00409 fprintf(h_file, " OU_MAX = %d\n} ISA_OPERAND_USE;\n\n", use_i-1);
00410
00411
00412 fprintf(h_file, "typedef struct {\n"
00413 " mUINT8 rclass;\n"
00414 " mUINT8 rsubclass;\n"
00415 " mUINT8 lclass;\n"
00416 " mUINT8 eclass;\n"
00417 " mUINT8 size;\n"
00418 " mUINT8 flags;\n"
00419 "} ISA_OPERAND_VALTYP;\n\n");
00421
00422 fprintf(export_file, "ISA_OPERAND_operand_types\n");
00423 fprintf(c_file, "\nconst ISA_OPERAND_VALTYP ISA_OPERAND_operand_types[] = {\n");
00424 for (int ty_i=0; ty_i<EKAPI_OpndTypeCount(pknobs); ty_i++){
00425 int reg_class_id = EKAPI_RegClass4otid(pknobs, ty_i);
00426 fprintf(c_file, " { ISA_REGISTER_CLASS_%-10s,",
00427 (reg_class_id==-1) ? "UNDEFINED" :
00428 EKAPI_GetRegClassName(®_class_info[reg_class_id]));
00429 int reg_subc_id = EKAPI_RegSubclass4otid(pknobs, ty_i);
00430 fprintf(c_file, " ISA_REGISTER_SUBCLASS_%-10s,\n",
00431 (reg_subc_id==-1) ? "UNDEFINED" :
00432 EKAPI_RegSubclassName(pknobs, reg_subc_id));
00433 fprintf(c_file, " %3d,",EKAPI_LitClass4otid(pknobs, ty_i)+1);
00434 int ec_id = EKAPI_EnumClass4otid(pknobs, ty_i);
00435 fprintf(c_file, " %s,",
00436 (ec_id==-1) ? "EC_UNDEFINED" :
00437 EKAPI_EnumClassName(pknobs, ec_id));
00438 fprintf(c_file, "%3d, 0x%02x }, /* %s */\n",
00439 EKAPI_Size4otid(pknobs, ty_i),
00440 EKAPI_Flag4otid(pknobs, ty_i),
00441 EKAPI_OpndTypeName(pknobs, ty_i)+strlen("OT_"));
00442 }
00443 fprintf(c_file, "};\n\n");
00444
00445 max_src = EKAPI_GetSrcOpndsMax(pknobs);
00446 max_dest = EKAPI_GetDestOpndsMax(pknobs);
00447
00448
00449 fprintf(h_file, "enum {\n ISA_OPERAND_max_operands=%d,\n"
00450 " ISA_OPERAND_max_results=%d\n};\n\n",
00451 max_src,
00452 max_dest);
00453
00455
00456 fprintf(h_file, "typedef struct {\n"
00457 " mUINT8 opnds;\n"
00458 " mUINT8 opnd[ISA_OPERAND_max_operands];\n"
00459 " mUINT8 ouse[ISA_OPERAND_max_operands];\n"
00460 " mUINT8 results;\n"
00461 " mUINT8 result[ISA_OPERAND_max_results];\n"
00462 "} ISA_OPERAND_INFO;\n\n");
00463
00464 fprintf(export_file, "ISA_OPERAND_info\n");
00465
00466 EKAPI_OPNDGRP_INFO opnd_grp;
00467 opnd_grp.source = (int*)malloc(max_src*sizeof(int));
00468 opnd_grp.opnduse = (int*)malloc(max_src*sizeof(int));
00469 opnd_grp.result = (int*)malloc(max_dest*sizeof(int));
00470 FmtAssert( opnd_grp.source && opnd_grp.opnduse && opnd_grp.result,
00471 ("Memory Allocation Failure!\n"));
00472
00473 fprintf(c_file, "const ISA_OPERAND_INFO ISA_OPERAND_info[] = {\n");
00474
00475 for (int grp_i=0; grp_i<EKAPI_OpndGrpCount(pknobs); grp_i++){
00476 int opnd_i;
00477
00478 EKAPI_GetOperandInfo4Grp(pknobs, grp_i, &opnd_grp);
00479
00480 fprintf(c_file, " {%2d, { ", opnd_grp.num_source);
00481 for (opnd_i=0; opnd_i<max_src; opnd_i++){
00482 fprintf(c_file, "%3d",
00483 (opnd_i>=opnd_grp.num_source)?-1:opnd_grp.source[opnd_i]);
00484 fprintf(c_file, "%s", (opnd_i==(max_src-1))? " " : ", ");
00485 }
00486 fprintf(c_file, "}, /* O_%d */\n", grp_i);
00487
00488 fprintf(c_file, " { ");
00489 for (opnd_i=0; opnd_i<max_src; opnd_i++){
00490 fprintf(c_file, "%3d",
00491 (opnd_i>=opnd_grp.num_source)?0:opnd_grp.opnduse[opnd_i]);
00492 fprintf(c_file, "%s", (opnd_i==(max_src-1))? " " : ", ");
00493 }
00494 fprintf(c_file, "}, /* O_%d */\n", grp_i);
00495
00496 fprintf(c_file, " %2d, { ", opnd_grp.num_result);
00497 for (opnd_i=0; opnd_i<max_dest; opnd_i++){
00498 fprintf(c_file, "%3d",
00499 (opnd_i>=opnd_grp.num_result)?-1:opnd_grp.result[opnd_i]);
00500 fprintf(c_file, "%s", (opnd_i==(max_dest-1))? " " : ", ");
00501 }
00502 fprintf(c_file, "} }, /* O_%d */\n", grp_i);
00503 }
00504
00505 free(opnd_grp.source);
00506 free(opnd_grp.opnduse);
00507 free(opnd_grp.result);
00508
00509 fprintf(c_file, "};\n\n");
00510
00511 int op_i;
00513
00514 fprintf (export_file, "ISA_OPERAND_info_index\n");
00515 fprintf(c_file, "const mUINT8 ISA_OPERAND_info_index[] = {\n");
00516
00517 for (op_i=0; op_i<EKAPI_OpCount(pknobs); op_i++){
00518 int opnd_grp = EKAPI_Op2Opndsgrp(pknobs, op_i);
00519 fprintf(c_file, "%5d, /* %s: O_%d */\n",
00520 opnd_grp, EKAPI_OpName4id(pknobs, op_i), opnd_grp);
00521 }
00522 fprintf(c_file, "};\n\n");
00523
00525
00526 fprintf(export_file, "ISA_OPERAND_relocatable_opnd\n");
00527 fprintf(c_file, "const mINT8 ISA_OPERAND_relocatable_opnd[] = {\n");
00528
00529 for (op_i=0; op_i<EKAPI_OpCount(pknobs); op_i++){
00530 int reloc = EKAPI_GetRelocatableOpnd(pknobs, op_i);
00531 fprintf(c_file, "%4d, /* %s */\n",
00532 reloc, EKAPI_OpName4id(pknobs, op_i));
00533 }
00534 fprintf(c_file, "};\n\n");
00535
00536 for (int i=0; opnd_query[i] != NULL; i++)
00537 fprintf(h_file, "%s\n", opnd_query[i]);
00538 for (int i=0; top_opnd_query_func[i] != NULL; i++)
00539 fprintf(c_file, "%s\n", top_opnd_query_func[i]);
00540 fprintf(export_file, "TOP_Immediate_Operand\n");
00541 fprintf(export_file, "TOP_Relocatable_Operand\n");
00542 fprintf(export_file, "TOP_Can_Have_Immediate\n");
00543 fprintf(export_file, "TOP_Find_Operand_Use\n");
00544 fprintf(export_file, "TOP_Operand_Uses\n");
00545
00546 free(reg_class_info);
00547
00548 Emit_Tailer(h_file);
00549 Close_Module_Files(mode, &c_file, &h_file, &export_file);
00550 }