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
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341 #ifndef SI_INCLUDED
00342 #define SI_INCLUDED
00343 #ifdef __cplusplus
00344 extern "C" {
00345 #endif
00346 #ifndef SI_RCS_ID
00347 #define SI_RCS_ID
00348 #ifdef _KEEP_RCS_ID
00349 static const char SI_rcs_id[] = "$Source: /proj/osprey/CVS/open64/osprey1.0/common/targ_info/access/ti_si.h,v $ $Revision: 1.1.1.1 $";
00350 #endif
00351 #endif
00352
00353
00354 #include "ti_si_types.h"
00355
00356
00357
00358
00359 inline SI_BAD_II_SET SI_BAD_II_SET_Union( SI_BAD_II_SET s1, SI_BAD_II_SET s2 )
00360 {
00361 SI_BAD_II_SET the_union;
00362
00363 the_union.dw[0] = s1.dw[0] | s2.dw[0];
00364 the_union.dw[1] = s1.dw[1] | s2.dw[1];
00365
00366 return the_union;
00367 }
00368
00369 inline INT SI_BAD_II_SET_MemberP( SI_BAD_II_SET s, UINT i )
00370 {
00371 UINT bitnum = i - 1;
00372
00373 if ( bitnum > (UINT)SI_BAD_II_SET_MAX ) return 0;
00374
00375 return (s.dw[bitnum / 64] & (1ULL << (bitnum % 64))) != 0;
00376 }
00377
00378 inline SI_BAD_II_SET SI_BAD_II_SET_Empty( void )
00379 {
00380 const SI_BAD_II_SET empty_set = {{0,0}};
00381
00382 return empty_set;
00383 }
00384
00385
00386
00387
00388 inline const char* SI_RESOURCE_Name( SI_RESOURCE* res )
00389 {
00390 return res->name;
00391 }
00392
00393 inline UINT SI_RESOURCE_Id( SI_RESOURCE* res )
00394 {
00395 return res->id;
00396 }
00397
00398 inline UINT SI_RESOURCE_Avail_Per_Cycle( SI_RESOURCE* res )
00399 {
00400 return res->avail_per_cycle;
00401 }
00402
00403 inline UINT SI_RESOURCE_Word_Index( SI_RESOURCE* res )
00404 {
00405 return res->word_index;
00406 }
00407
00408 inline UINT SI_RESOURCE_Bit_Index( SI_RESOURCE* res )
00409 {
00410 return res->bit_index;
00411 }
00412
00413 #if defined(__linux__) && defined(TARG_X8664)
00414
00415 extern const int * SI_resource_count_p;
00416 #define SI_resource_count (*SI_resource_count_p)
00417
00418 extern SI_RESOURCE * const * SI_resources_p;
00419 #define SI_resources SI_resources_p
00420
00421 #elif defined(TARG_SL) || defined(TARG_MIPS)
00422 extern INT *SI_resource_count_p;
00423 #define SI_resource_count (*SI_resource_count_p)
00424 extern SI_RESOURCE* (*SI_resources_p)[];
00425 #define SI_resources (*SI_resources_p)
00426
00427 #else
00428 extern const INT SI_resource_count;
00429 #pragma weak SI_resource_count
00430
00431 extern SI_RESOURCE* const SI_resources[];
00432 #pragma weak SI_resources
00433
00434 #endif
00435
00436 inline const char* SI_RESOURCE_ID_Name( SI_RESOURCE_ID id )
00437 {
00438 return SI_RESOURCE_Name(SI_resources[id]);
00439 }
00440
00441 inline UINT SI_RESOURCE_ID_Avail_Per_Cycle( SI_RESOURCE_ID id )
00442 {
00443 return SI_RESOURCE_Avail_Per_Cycle(SI_resources[id]);
00444 }
00445
00446
00447
00448
00449 inline SI_RESOURCE_ID_SET SI_RESOURCE_ID_SET_Universe(void)
00450 {
00451 return (SI_RESOURCE_ID_SET)-1
00452 >> (sizeof(SI_RESOURCE_ID_SET) * 8 - SI_resource_count);
00453 }
00454
00455 inline SI_RESOURCE_ID_SET SI_RESOURCE_ID_SET_Empty(void)
00456 {
00457 return (SI_RESOURCE_ID_SET)0;
00458 }
00459
00460 inline SI_RESOURCE_ID_SET
00461 SI_RESOURCE_ID_SET_Intersection( SI_RESOURCE_ID_SET s0,
00462 SI_RESOURCE_ID_SET s1 )
00463 {
00464 return s0 & s1;
00465 }
00466
00467 inline INT
00468 SI_RESOURCE_ID_SET_Intersection_Non_Empty( SI_RESOURCE_ID_SET s0,
00469 SI_RESOURCE_ID_SET s1 )
00470 {
00471 return (s0 & s1) != (SI_RESOURCE_ID_SET)0;
00472 }
00473
00474 inline INT
00475 SI_RESOURCE_ID_SET_Intersection4_Non_Empty( SI_RESOURCE_ID_SET s0,
00476 SI_RESOURCE_ID_SET s1,
00477 SI_RESOURCE_ID_SET s2,
00478 SI_RESOURCE_ID_SET s3 )
00479 {
00480 return (s0 & s1 & s2 & s3) != (SI_RESOURCE_ID_SET)0;
00481 }
00482
00483 inline SI_RESOURCE_ID_SET
00484 SI_RESOURCE_ID_SET_Complement( SI_RESOURCE_ID_SET s )
00485 {
00486 return (~s) & SI_RESOURCE_ID_SET_Universe();
00487 }
00488
00489
00490
00491
00492 #if defined( __linux__ ) && defined(TARG_X8664)
00493
00494 extern const SI_RRW * SI_RRW_initializer_p;
00495 #define SI_RRW_initializer (*SI_RRW_initializer_p)
00496
00497 extern const SI_RRW * SI_RRW_overuse_mask_p;
00498 #define SI_RRW_overuse_mask (*SI_RRW_overuse_mask_p)
00499
00500 #elif defined(TARG_SL) || defined(TARG_MIPS)
00501 extern SI_RRW *SI_RRW_initializer_p;
00502 #define SI_RRW_initializer (*SI_RRW_initializer_p)
00503 extern SI_RRW *SI_RRW_overuse_mask_p;
00504 #define SI_RRW_overuse_mask (*SI_RRW_overuse_mask_p)
00505
00506 #else
00507
00508 extern const SI_RRW SI_RRW_initializer;
00509 #ifdef SHARED_BUILD
00510 #pragma weak SI_RRW_initializer
00511 #endif
00512
00513 extern const SI_RRW SI_RRW_overuse_mask;
00514 #ifdef SHARED_BUILD
00515 #pragma weak SI_RRW_overuse_mask
00516 #endif
00517
00518 #endif
00519
00520 inline SI_RRW SI_RRW_Initial(void)
00521 {
00522 return SI_RRW_initializer;
00523 }
00524
00525 inline SI_RRW SI_RRW_Reserve( SI_RRW table, SI_RRW requirement )
00526 {
00527 return table + requirement;
00528 }
00529
00530 inline SI_RRW SI_RRW_Has_Overuse( SI_RRW word_with_reservations )
00531 {
00532 return (word_with_reservations & SI_RRW_overuse_mask) != 0;
00533 }
00534
00535 inline SI_RRW SI_RRW_Unreserve( SI_RRW table, SI_RRW requirement )
00536 {
00537 return table - requirement;
00538 }
00539
00540
00541
00542
00543 inline const char* SI_ISSUE_SLOT_Name( SI_ISSUE_SLOT* slot )
00544 {
00545 return slot->name;
00546 }
00547
00548 inline INT SI_ISSUE_SLOT_Skew( SI_ISSUE_SLOT* slot )
00549 {
00550 return slot->skew;
00551 }
00552
00553 inline INT SI_ISSUE_SLOT_Avail_Per_Cycle( SI_ISSUE_SLOT* slot )
00554 {
00555 return slot->avail_per_cycle;
00556 }
00557
00558 #if defined (__linux__) && defined(TARG_X8664)
00559
00560 extern const int * SI_issue_slot_count_p;
00561 #define SI_issue_slot_count (*SI_issue_slot_count_p)
00562
00563 extern SI_ISSUE_SLOT * const * SI_issue_slots_p;
00564 #define SI_issue_slots SI_issue_slots_p
00565
00566 #elif defined(TARG_SL) || defined(TARG_MIPS)
00567 extern INT *SI_issue_slot_count_p;
00568 #define SI_issue_slot_count (*SI_issue_slot_count_p)
00569
00570 extern SI_ISSUE_SLOT *(*SI_issue_slots_p)[];
00571 #define SI_issue_slots (*SI_issue_slots_p)
00572 #else
00573
00574 extern const INT SI_issue_slot_count;
00575 #ifdef SHARED_BUILD
00576 #pragma weak SI_issue_slot_count
00577 #endif
00578
00579 extern SI_ISSUE_SLOT* const SI_issue_slots[];
00580 #ifdef SHARED_BUILD
00581 #pragma weak SI_issue_slots
00582 #endif
00583
00584 #endif
00585
00586 inline INT SI_ISSUE_SLOT_Count(void)
00587 {
00588 return SI_issue_slot_count;
00589 }
00590
00591 inline SI_ISSUE_SLOT* SI_Ith_Issue_Slot( UINT i )
00592 {
00593 return SI_issue_slots[i];
00594 }
00595
00596
00597
00598
00599 inline SI_RESOURCE*
00600 SI_RESOURCE_TOTAL_Resource( SI_RESOURCE_TOTAL* pair )
00601 {
00602 return pair->resource;
00603 }
00604
00605 inline SI_RESOURCE_ID SI_RESOURCE_TOTAL_Resource_Id( SI_RESOURCE_TOTAL* pair )
00606 {
00607 return SI_RESOURCE_Id(SI_RESOURCE_TOTAL_Resource(pair));
00608 }
00609
00610 inline UINT SI_RESOURCE_TOTAL_Avail_Per_Cycle(SI_RESOURCE_TOTAL* pair)
00611 {
00612 return SI_RESOURCE_Avail_Per_Cycle(SI_RESOURCE_TOTAL_Resource(pair));
00613 }
00614
00615 inline INT SI_RESOURCE_TOTAL_Total_Used( SI_RESOURCE_TOTAL* pair )
00616 {
00617 return pair->total_used;
00618 }
00619
00620
00621
00622
00623 inline UINT SI_RR_Length( SI_RR req )
00624 {
00625 return (INT) req[0];
00626 }
00627
00628 inline SI_RRW SI_RR_Cycle_RRW( SI_RR req, UINT cycle )
00629 {
00630
00631
00632
00633 return req[cycle+1];
00634 }
00635
00636
00637
00638
00639 #if defined (__linux__) && defined(TARG_X8664)
00640
00641 extern SI * const * SI_top_si_p;
00642 #define SI_top_si SI_top_si_p
00643
00644 #elif defined(TARG_SL) || defined(TARG_MIPS)
00645 extern SI* (*SI_top_si_p)[];
00646 #define SI_top_si (*SI_top_si_p)
00647 #else
00648
00649 extern SI* const SI_top_si[];
00650 #ifdef SHARED_BUILD
00651 #pragma weak SI_top_si
00652 #endif
00653
00654 #endif
00655
00656 inline const char* TSI_Name( TOP top )
00657 {
00658 return SI_top_si[(INT) top]->name;
00659 }
00660
00661 inline SI_ID TSI_Id( TOP top )
00662 {
00663 return SI_top_si[top]->id;
00664 }
00665
00666 inline INT
00667 TSI_Operand_Access_Time( TOP top, INT operand_index )
00668 {
00669 return SI_top_si[(INT) top]->operand_access_times[operand_index];
00670 }
00671
00672 inline INT
00673 TSI_Result_Available_Time( TOP top, INT result_index )
00674 {
00675 return SI_top_si[(INT) top]->result_available_times[result_index];
00676 }
00677
00678 inline INT
00679 TSI_Load_Access_Time( TOP top )
00680 {
00681 return SI_top_si[(INT) top]->load_access_time;
00682 }
00683
00684 inline INT
00685 TSI_Last_Issue_Cycle( TOP top )
00686 {
00687 return SI_top_si[(INT) top]->last_issue_cycle;
00688 }
00689
00690 inline INT
00691 TSI_Store_Available_Time( TOP top )
00692 {
00693 return SI_top_si[(INT) top]->store_available_time;
00694 }
00695
00696 inline SI_RR TSI_Resource_Requirement( TOP top )
00697 {
00698 return SI_top_si[(INT) top]->rr;
00699 }
00700
00701 #if defined(TARG_SL)
00702 inline SI_RR TSI_Alternative_Resource_Requirement( TOP top )
00703 {
00704 return SI_top_si[(INT) top]->alter_rr;
00705 }
00706 #endif
00707
00708 inline SI_BAD_II_SET TSI_Bad_IIs( TOP top )
00709 {
00710 return SI_top_si[(INT) top]->bad_iis;
00711 }
00712
00713 inline SI_RR TSI_II_Resource_Requirement( TOP top, INT ii )
00714 {
00715 SI* const info = SI_top_si[(INT) top];
00716
00717 if ( ii > info->ii_info_size ) return info->rr;
00718
00719 return info->ii_rr[ii - 1];
00720 }
00721
00722 inline const SI_RESOURCE_ID_SET*
00723 TSI_II_Cycle_Resource_Ids_Used( TOP opcode, INT ii )
00724 {
00725 SI* const info = SI_top_si[(INT)opcode];
00726 if ( ii > info->ii_info_size ) return info->resources_used;
00727
00728 return info->ii_resources_used[ii - 1];
00729 }
00730
00731 inline UINT TSI_Valid_Issue_Slot_Count( TOP top )
00732 {
00733 return SI_top_si[(INT) top]->valid_issue_slot_count;
00734 }
00735
00736 inline SI_ISSUE_SLOT* TSI_Valid_Issue_Slots( TOP top, UINT i )
00737 {
00738 return SI_top_si[(INT) top]->valid_issue_slots[i];
00739 }
00740
00741 inline UINT TSI_Resource_Total_Vector_Size( TOP top )
00742 {
00743 return SI_top_si[(INT) top]->resource_total_vector_size;
00744 }
00745
00746 inline SI_RESOURCE_TOTAL* TSI_Resource_Total_Vector( TOP top )
00747 {
00748 return SI_top_si[(INT) top]->resource_total_vector;
00749 }
00750
00751 inline INT TSI_Write_Write_Interlock( TOP top )
00752 {
00753 return SI_top_si[(INT) top]->write_write_interlock;
00754 }
00755
00756
00757
00758
00759 #if defined (__linux__) && defined(TARG_X8664)
00760
00761 extern const int * SI_ID_count_p;
00762 #define SI_ID_count (*SI_ID_count_p)
00763
00764 extern SI * const * SI_ID_si_p;
00765 #define SI_ID_si SI_ID_si_p
00766
00767 #elif defined(TARG_SL) || defined(TARG_MIPS)
00768 extern INT *SI_ID_count_p;
00769 #define SI_ID_count (*SI_ID_count_p)
00770 extern SI *(*SI_ID_si_p)[];
00771 #define SI_ID_si (*SI_ID_si_p)
00772
00773
00774 #else
00775
00776 extern const INT SI_ID_count;
00777 #ifdef SHARED_BUILD
00778 #pragma weak SI_ID_count
00779 #endif
00780
00781 extern SI* const SI_ID_si[];
00782 #ifdef SHARED_BUILD
00783 #pragma weak SI_ID_si
00784 #endif
00785
00786 #endif
00787
00788 inline INT SI_ID_Count(void)
00789 {
00790 return SI_ID_count;
00791 }
00792
00793 inline const SI_RESOURCE_ID_SET*
00794 SI_ID_II_Cycle_Resource_Ids_Used( SI_ID id, INT ii )
00795 {
00796 SI* const info = SI_ID_si[id];
00797 if ( ii > info->ii_info_size ) return info->resources_used;
00798
00799 return info->ii_resources_used[ii - 1];
00800 }
00801
00802
00803 #ifdef __cplusplus
00804 }
00805 #endif
00806 #endif