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
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 #ifndef _KAPI_INTERNAL_H_
00097 #define _KAPI_INTERNAL_H_
00098
00099 #include "kapi.h"
00100 #include "kapi_ia64.h"
00101 #include "kapi_bv.h"
00102
00103
00104 #ifdef _WIN32
00105 #define strdup _strdup
00106 #define fileno _fileno
00107 #define itoa _itoa
00108 #include <malloc.h>
00109 #define alloca _alloca
00110 #endif
00111
00112
00113
00114
00115
00116
00117
00118
00119 #define maxDESTINATIONS 32
00120 #define maxSOURCES 32
00121
00122 #define maxCLR 4
00123 #define maxPORTS 32
00124 #define maxCPORTS 32
00125 #define maxICPORTS 6
00126 #define maxMCPORTS 8
00127 #define maxBCPORTS 6
00128 #define maxFCPORTS 4
00129
00130
00131
00132 typedef struct BIDINFO_T {
00133 kapi_syl_t mpsylType[ nSYLBID ];
00134 int mpnsylAvail[ kapi_nSYL ];
00135 int mpnitAvail[ kapi_nIT ];
00136 int fReserved;
00137 int isylSbit;
00138 char *pchBID;
00139 } bidinfo_t;
00140
00141
00142
00143 typedef struct SYLINFO_T {
00144 int mpnutNeeded[ kapi_nUT ];
00145 kapi_it_t itMajor;
00146 } sylinfo_t;
00147
00148
00149 #define maxBUNDLE_ISSUE_IMP 4
00150
00151 typedef struct TPINFO_T {
00152 kapi_bid_t mpbid[ maxBUNDLE_ISSUE_IMP ];
00153 } tpinfo_t;
00154
00155 #define syl2bv32( syl ) ( 1 << (syl) )
00156
00157 #define itOk4syl( _syl, _it ) \
00158 ( dmpitinfoTable[ (_it) ].bv32sylAllowed & syl2bv32( _syl ) )
00159
00160
00161
00162
00163
00164
00165 #define bidMII 0x0
00166 #define bidMI_I 0x1
00167 #define bidMLI 0x2
00168 #define bidRESERVED_3 0x3
00169 #define bidMMI 0x4
00170 #define bidM_MI 0x5
00171 #define bidMFI 0x6
00172 #define bidMMF 0x7
00173 #define bidMIB 0x8
00174 #define bidMBB 0x9
00175 #define bidRESERVED_A 0xA
00176 #define bidBBB 0xB
00177 #define bidMMB 0xC
00178 #define bidRESERVED_D 0xD
00179 #define bidMFB 0xE
00180 #define bidRESERVED_F 0xF
00181
00182 #define bvMII ( 1 << bidMII )
00183 #define bvMI_I ( 1 << bidMI_I )
00184 #define bvMLI ( 1 << bidMLI )
00185 #define bvMMI ( 1 << bidMMI )
00186 #define bvM_MI ( 1 << bidM_MI )
00187 #define bvMFI ( 1 << bidMFI )
00188 #define bvMMF ( 1 << bidMMF )
00189 #define bvMIB ( 1 << bidMIB )
00190 #define bvMBB ( 1 << bidMBB )
00191 #define bvBBB ( 1 << bidBBB )
00192 #define bvMMB ( 1 << bidMMB )
00193 #define bvMFB ( 1 << bidMFB )
00194
00195 #define bv32sylI ( 1 << kapi_sylI )
00196 #define bv32sylF ( 1 << kapi_sylF )
00197 #define bv32sylB ( 1 << kapi_sylB )
00198 #define bv32sylM ( 1 << kapi_sylM )
00199 #define bv32sylL ( 1 << kapi_sylL )
00200
00201
00202
00203
00204
00205 typedef struct _PORTINFO_T {
00206 kapi_ut_t ut;
00207 kapi_cport_t cport;
00208 kapi_cutport_t cutport;
00209 bv_t bvfuAllowed;
00210 } cportinfo_t;
00211
00212
00213
00214 typedef struct _ITINFO_T {
00215 kapi_it_t it;
00216 int maxAvail;
00217 char *pchitName;
00218 bv32_t bv32sylAllowed;
00219 } itinfo_t;
00220
00221 typedef struct _FUINFO_T {
00222 kapi_fu_t fu;
00223 int iCoreLatency[ maxDESTINATIONS ];
00224
00225 int cntDest;
00226 char *mppchDestName[ maxDESTINATIONS ];
00227
00228 int cntSrc;
00229 char *mppchSrcName[ maxSOURCES ];
00230 bv32_t bv32InfoBits;
00231
00232 char *pchName;
00233 } fuinfo_t;
00234
00235 typedef enum {
00236 type_single,
00237 type_multiple
00238 } operand_list_e;
00239
00240 typedef struct operand_match_T {
00241 operand_list_e iType;
00242 union
00243 {
00244 int pOperand;
00245 struct operand_match_T *pOperandList;
00246 } pIndexes[2];
00247 } operand_match_t;
00248
00249
00250 typedef struct _INST_T {
00251 char *pchUniqueName;
00252 char *pchMnemonic;
00253 char *pchfu;
00254 char *pchit;
00255 kapi_it_t it;
00256 kapi_fu_t fu;
00257 operand_match_t *pExplicitOps;
00258 operand_match_t *pImplicitOps;
00259 } inst_t;
00260
00261 typedef struct _PORTNODE {
00262 struct _PORTNODE *pportnNext;
00263 int latDefault;
00264 int oppSource, oppSink;
00265 kapi_cport_t cportSource, cportSink;
00266 } portn_t;
00267
00268
00269 typedef struct _CLUSTER_T {
00270
00271
00272 int idxclr;
00273
00274
00275 int ncports;
00276
00277 cportinfo_t *mppcportinfoTable[ maxCPORTS ];
00278
00279
00280 cportinfo_t *dmppcportinfoTable[ kapi_nUT ];
00281
00282
00283 int mpncutport[ kapi_nUT ];
00284
00285
00286 int cport2port[ 32 ];
00287
00288
00289 int distClr[ maxCLR ];
00290 } clr_t;
00291
00292
00293 typedef struct _EBYPASS_T {
00294 kapi_cluster_t clusterSrc, clusterDest;
00295 kapi_fu_t fuSrc, fuDest;
00296 kapi_cutport_t cutportSrc, cutportDest;
00297 kapi_ut_t utSrc, utDest;
00298 int oppSrc, oppDest;
00299 int iValue;
00300 } eby_t;
00301
00302 typedef struct _ABYPASS_T {
00303 kapi_cluster_t cluster;
00304 kapi_fu_t fuSrc, fuDest;
00305 kapi_cutport_t cutportSrc, cutportDest;
00306 kapi_ut_t utSrc, utDest;
00307 int oppSrc, oppDest;
00308 int iValue;
00309 char *pchEntry;
00310 } aby_t;
00311
00312
00313 typedef struct _CACHEPORT_T {
00314 bv32_t bv32AccessMode;
00315 } cacheport_t;
00316
00317 typedef struct CACHE_T {
00318 int nLines;
00319 int nBytesLine;
00320 int nWays;
00321
00322 int nCachePorts;
00323 cacheport_t cacheportInfo[ KAPI_MAX_CACHE_PORTS_IMPL ];
00324
00325 bv32_t bv32CacheContents;
00326 kapi_cache_policy_write_e iWritePolicy;
00327 kapi_cache_policy_repl_e iReplPolicy;
00328 kapi_cache_policy_alloc_e iAllocPolicy;
00329 int nCyclesRead;
00330 } cache_t;
00331
00332
00333 typedef enum _CACHE_TYPES_E {
00334 cache_type_instruction=0,
00335 cache_type_data,
00336 cache_type_unified,
00337 cache_type_enum_size
00338 } cache_types_e;
00339
00340
00341
00342 typedef enum _KNOBS_T_FIELDS_E {
00343 enum_pfSaveHeaderFlags=0,
00344 enum_maxBundleIssue,
00345 enum_maxInstructionIssue,
00346 enum_fImplicitNone,
00347 enum_cntLinesDeltaFile,
00348 enum_cntLinesBaselineFile,
00349 enum_pchToolname,
00350 enum_nclr,
00351 enum_mpclrTable,
00352 enum_nRawInter,
00353 enum_dmpebyInterTable,
00354 enum_nRawIntra,
00355 enum_dmpabyIntraTable,
00356 enum_nports,
00357 enum_mppportinfoTable,
00358 enum_port2cluster,
00359 enum_mpnut,
00360 enum_nfuinfoTable,
00361 enum_dmpfuinfoTable,
00362 enum_ninstTable,
00363 enum_dmpinstTable,
00364 enum_nitinfoTable,
00365 enum_dmpitinfoTable,
00366 enum_nbidinfoTable,
00367 enum_dmpbidinfoTable,
00368 enum_nsylinfoTable,
00369 enum_dmpsylinfoTable,
00370 enum_nCacheLevels,
00371 enum_dmpcacheTable,
00372 enum_dmpstn,
00373 enum_nstn,
00374 enum_fRestructuredAttributes,
00375 enum_pvalnTypeList,
00376 enum_pvalnVarList,
00377 enum_pvalnAttrList,
00378 enum_LAST_KAPI_FIELD
00379 } knobs_fields_enum_t;
00380
00381
00382 typedef struct _KNOBS_T {
00383
00384
00385 int *pfSaveHeaderFlags;
00386 int maxBundleIssue[ maxCLR ];
00387 int maxInstructionIssue[ maxCLR ];
00388
00389 int fImplicitNone;
00390
00391 int cntLinesDeltaFile;
00392 int cntLinesBaselineFile;
00393
00394 char *pchToolname;
00395
00396
00397 int nclr;
00398 clr_t mpclrTable[maxCLR];
00399
00400
00401 int nRawInter;
00402 eby_t *dmpebyInterTable;
00403
00404
00405 int nRawIntra;
00406 aby_t *dmpabyIntraTable;
00407
00408
00409 int nports;
00410 cportinfo_t *mppportinfoTable[ maxPORTS ];
00411
00412
00413 int port2cluster[ 32 ];
00414
00415
00416 int mpnut[ kapi_nUT ];
00417
00418
00419 int nfuinfoTable;
00420 fuinfo_t *dmpfuinfoTable;
00421
00422
00423 int nfudirTable;
00424 int fudirDestination;
00425 int fudirSource;
00426 int *dmpfudirTable;
00427
00428
00429 int ninstTable;
00430 inst_t *dmpinstTable;
00431
00432
00433 int nitinfoTable;
00434 itinfo_t *dmpitinfoTable;
00435
00436
00437 int nbidinfoTable;
00438 bidinfo_t *dmpbidinfoTable;
00439
00440
00441 int nsylinfoTable;
00442 sylinfo_t *dmpsylinfoTable;
00443
00444
00445 int nCacheLevels[cache_type_enum_size];
00446 cache_t *dmpcacheTable[cache_type_enum_size];
00447
00448
00449 struct _SYM_TABLE_NODE *dmpstn;
00450 int nstn;
00451
00452
00453 int fRestructuredAttributes;
00454
00455
00456 struct _VALUE_NODE *pvalnTypeList;
00457 struct _VALUE_NODE *pvalnVarList;
00458 struct _VALUE_NODE *pvalnAttrList;
00459 } knobs_t;
00460
00461
00462
00463
00464 extern void kapi_InitBidAndSyllable( knobs_t *pknobs );
00465
00466 extern kapi_cport_t cport4utcport( knobs_t *pknobs,
00467 kapi_cluster_t cluster, kapi_ut_t ut,
00468 int cportfromut );
00469
00470
00471
00472
00473 #define iITANIUM 0
00474 #define iHALEAKALA 1
00475
00476 extern int kapi_cLine;
00477
00478 #endif
00479