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 <stdio.h>
00042 #include <stdlib.h>
00043 #include <assert.h>
00044 #include <string.h>
00045
00046
00047 #include "ekapi_ia64.h"
00048
00049 #include "issue_port_gen.h"
00050 #include "opcode_gen.h"
00051 #include "subset_gen.h"
00052 #include "properties_gen.h"
00053 #include "operands_gen.h"
00054 #include "enums_gen.h"
00055 #include "lits_gen.h"
00056 #include "bundle_gen.h"
00057 #include "reg_gen.h"
00058 #include "itanium_gen.h"
00059 #include "bypass_gen.h"
00060 #include "proc_gen_new.h"
00061 #include "proc_properties_gen_new.h"
00062 #include "cache_info_gen.h"
00063
00064 void Generate_MM(char *knobf, char *eknobf, MACHINE_TYPE type)
00065 {
00066 FILE *fp1, *fp2;
00067 void *pknobs;
00068
00069 fp1 = fopen( knobf, "r" );
00070 fp2 = fopen( eknobf, "r" );
00071 if ((fp1 == NULL)||(fp2 == NULL))
00072 {
00073 printf("ERROR: can't open files %s and %s\n", knobf, eknobf);
00074 exit(-1);
00075 }
00076
00077
00078 pknobs = KAPI_Initialize(fp2,fp1,NULL);
00079 pknobs = KAPI_ia64_Initialize(pknobs);
00080 if (fp2 != NULL) fclose(fp2);
00081 if (fp1 != NULL) fclose(fp1);
00082
00083 if (type == MCK_TYPE) {
00084 Issue_Port_Generator(pknobs, GEN_MODE_FILE, type);
00085 Itanium_Generator(pknobs, GEN_MODE_FILE, type);
00086 Bypass_Generator(pknobs, GEN_MODE_FILE, type);
00087 Cache_Info_Generator(pknobs, GEN_MODE_FILE, type);
00088 } else {
00089
00090
00091 Opcode_Generator(pknobs, GEN_MODE_FILE);
00092 Issue_Port_Generator(pknobs, GEN_MODE_FILE);
00093 Subset_Generator(pknobs, GEN_MODE_FILE);
00094 Properties_Generator(pknobs, GEN_MODE_FILE);
00095 Enums_Generator(pknobs, GEN_MODE_FILE);
00096 Lits_Generator(pknobs, GEN_MODE_FILE);
00097 Bundle_Generator(pknobs, GEN_MODE_FILE);
00098 Register_Generator(pknobs, GEN_MODE_FILE);
00099 Operands_Generator(pknobs, GEN_MODE_FILE);
00100 Itanium_Generator(pknobs, GEN_MODE_FILE);
00101 Bypass_Generator(pknobs, GEN_MODE_FILE);
00102 Proc_Generator(pknobs, GEN_MODE_FILE);
00103 Proc_Properties_Generator(pknobs, GEN_MODE_FILE);
00104 Cache_Info_Generator(pknobs, GEN_MODE_FILE);
00105
00106 }
00107
00108 KAPI_Finalize(pknobs);
00109 }
00110
00111 int main( int argc, char *argv[] )
00112 {
00113 char src1[200],src2[200];
00114 int i;
00115
00116
00117
00118 if ( argc < 2 ) {
00119 strcpy( src1,"v26-itanium-41-external.knb" );
00120 strcpy( src2,"v11-itanium-extra.knb");
00121 }
00122 else {
00123 strcpy( src1, argv[1] );
00124 strcpy( src2, argv[2] );
00125 }
00126 Generate_MM(src1, src2, ITM_TYPE);
00127
00128 printf("Use Mckinley knobsfile to generate machine model!\n");
00129 strcpy( src1,"mckinley_knobsfile.knb" );
00130 strcpy( src2,"v12-itanium-extra.knb");
00131 Generate_MM(src1, src2, MCK_TYPE);
00132
00133
00134 printf("Leaving creat machine model\n");
00135 }
00136