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 #ifdef _KEEP_RCS_ID
00044 static const char source_file[] = __FILE__;
00045 static const char rcs_id[] = "$Source: /proj/osprey/CVS/open64/osprey1.0/common/targ_info/access/ti_init.c,v $ $Revision: 1.1.1.1 $";
00046 #endif
00047
00048 #include <alloca.h>
00049 #include <string.h>
00050 #include <ctype.h>
00051
00052 #include "defs.h"
00053 #include "targ_isa_subset.h"
00054 #include "targ_isa_hazards.h"
00055 #include "targ_isa_registers.h"
00056 #include "targ_abi_properties.h"
00057 #include "targ_proc.h"
00058 #include "dso.h"
00059 #include "errors.h"
00060
00061 #include "ti_init.h"
00062
00063 #ifdef __linux__
00064 const char * sanity_check_targ_so_name_p;
00065 #define sanity_check_targ_so_name sanity_check_targ_so_name_p
00066 #endif
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 void
00077 #if defined(TARG_IA64) || defined(TARG_SL) || defined(TARG_MIPS)
00078 TI_Initialize(ABI_PROPERTIES_ABI tabi, ISA_SUBSET tisa, PROCESSOR tproc, char *tpath, char* version)
00079 #else
00080 TI_Initialize(ABI_PROPERTIES_ABI tabi, ISA_SUBSET tisa, PROCESSOR tproc, char *tpath)
00081 #endif
00082 {
00083 static BOOL initialized;
00084
00085 if ( !initialized ) {
00086 INT i;
00087 const char *targ_name = PROCESSOR_Name(tproc);
00088 #if defined(TARG_IA64) || defined(TARG_SL) || defined(TARG_MIPS)
00089 INT targ_name_len = strlen(targ_name) + strlen(version);
00090 #else
00091 INT targ_name_len = strlen(targ_name);
00092 #endif
00093 char *targ_so_name = alloca(targ_name_len + strlen(".so") + 1);
00094
00095 #ifndef TARG_NVISA
00096 for (i = 0; i < targ_name_len; i++) {
00097 targ_so_name[i] = tolower(targ_name[i]);
00098 }
00099 #if defined(TARG_IA64) || defined(TARG_SL) || defined(TARG_MIPS)
00100 if (strlen(version) > 0) strcat(targ_so_name, version);
00101 #endif
00102 strcpy(targ_so_name + targ_name_len, ".so");
00103
00104 load_so(targ_so_name, tpath, FALSE );
00105 #endif
00106
00107 ISA_SUBSET_Value = tisa;
00108 PROCESSOR_Value = tproc;
00109 ABI_PROPERTIES_ABI_Value = tabi;
00110
00111 ABI_PROPERTIES_Initialize();
00112 ISA_HAZARD_Initialize();
00113 ISA_REGISTER_Initialize();
00114
00115 #if 0
00116
00117
00118
00119 FmtAssert (!strcmp(targ_so_name, sanity_check_targ_so_name),
00120 ("TI_Initialize did not load proper information from %s", targ_so_name));
00121 #endif
00122
00123 initialized = TRUE;
00124 }
00125 }
00126
00127 #ifdef __linux__
00128
00129 #include "ti_si_types.h"
00130
00131 SI * const * SI_top_si_p;
00132 SI * const * SI_ID_si_p;
00133 const int * SI_ID_count_p;
00134 SI_ISSUE_SLOT * const * SI_issue_slots_p;
00135 const int * SI_issue_slot_count_p;
00136 SI_RESOURCE * const * SI_resources_p;
00137 const int * SI_resource_count_p;
00138 const SI_RRW * SI_RRW_initializer_p;
00139 const SI_RRW * SI_RRW_overuse_mask_p;
00140
00141 #endif