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 #define __STDC_LIMIT_MACROS
00038 #include <stdint.h>
00039 #include <alloca.h>
00040 #include "wn.h"
00041 #include "cxx_memory.h"
00042 #include "pu_info.h"
00043 #include "ipc_symtab_merge.h"
00044 #include "ipa_option.h"
00045 #include "ipa_cg.h"
00046 #include "ipo_defs.h"
00047 #include "region_util.h"
00048 #include "wn_util.h"
00049 #include "ipa_builtins.h"
00050
00051
00052 std::vector<IPA_BUILTIN*> IPA_builtins_list;
00053
00054
00055 ST *IPA_builtin_ctype_b = NULL;
00056 ST *IPA_builtin_ctype_tolower = NULL;
00057 ST *IPA_builtin_ctype_toupper = NULL;
00058
00059 static MEM_POOL IPA_Builtins_Mem_Pool;
00060
00061
00062
00063 static PU_Info*
00064 IPA_Start_Function (TY_IDX func_ty_idx, char *func_name, int num_args)
00065 {
00066
00067
00068 ST *func_st = New_ST(GLOBAL_SYMTAB);
00069
00070 PU_IDX pu_idx;
00071 PU& pu = New_PU (pu_idx);
00072 PU_Init (pu, func_ty_idx, GLOBAL_SYMTAB+1);
00073 ST_Init (func_st, Save_Str(func_name), CLASS_FUNC, SCLASS_TEXT,
00074 EXPORT_PREEMPTIBLE, TY_IDX(pu_idx));
00075 Set_ST_pu (func_st, pu_idx);
00076 Set_PU_c_lang(pu);
00077 Clear_PU_uplevel(pu);
00078
00079 WN *entry_wn, *body, *wn;
00080 body = WN_CreateBlock();
00081 entry_wn = WN_CreateEntry ( num_args, func_st, body, NULL, NULL );
00082
00083 PU_Info *pu_info;
00084
00085 pu_info = TYPE_MEM_POOL_ALLOC(PU_Info, Malloc_Mem_Pool);
00086 PU_Info_init(pu_info);
00087
00088 Set_PU_Info_tree_ptr (pu_info, entry_wn);
00089
00090 PU_Info_maptab (pu_info) = WN_MAP_TAB_Create(MEM_pu_nz_pool_ptr);
00091 PU_Info_proc_sym (pu_info) = ST_st_idx(func_st);
00092
00093
00094
00095
00096
00097 PU_Info_pu_dst (pu_info) = DST_INVALID_IDX;
00098 PU_Info_cu_dst (pu_info) = DST_INVALID_IDX;
00099
00100 Set_PU_Info_state(pu_info, WT_SYMTAB, Subsect_InMem);
00101 Set_PU_Info_state(pu_info, WT_TREE, Subsect_InMem);
00102 Set_PU_Info_state(pu_info, WT_PROC_SYM, Subsect_InMem);
00103
00104 Set_PU_Info_flags(pu_info, PU_IS_COMPILER_GENERATED);
00105
00106 return pu_info;
00107 }
00108
00109
00110
00111 static void
00112 IPA_Add_Builtin_IPA_NODE (PU_Info *pu_info, INTRINSIC intrinsic)
00113 {
00114 ST *func_st = &St_Table[PU_Info_proc_sym (pu_info)];
00115
00116
00117
00118 IPA_NODE *ipa_node = IPA_Call_Graph->Add_New_Node (func_st, -1, -1, -1);
00119 NODE_INDEX cg_node = ipa_node->Node_Index ();
00120 ipa_node->Set_Scope(Scope_tab);
00121 ipa_node->Set_Builtin();
00122 ipa_node->Set_Builtin_PU_Info(pu_info);
00123
00124
00125 UINT32 aux_idx;
00126 AUX_PU& aux_pu = Aux_Pu_Table.New_entry (aux_idx);
00127 Set_AUX_PU_node (aux_pu, cg_node);
00128
00129
00130
00131
00132 IPA_BUILTIN *ipa_builtin = CXX_NEW(IPA_BUILTIN(pu_info, intrinsic),
00133 &IPA_Builtins_Mem_Pool);
00134 IPA_builtins_list.push_back(ipa_builtin);
00135 }
00136
00137
00138
00139
00140 static TY_IDX
00141 IPA_Create_Func_Type_3 (TY_IDX ret_ty_idx, TY_IDX arg0_ty_idx,
00142 TY_IDX arg1_ty_idx, TY_IDX arg2_ty_idx)
00143 {
00144
00145
00146 TY_IDX func_ty_idx;
00147 INT32 num_args;
00148 TY &func_ty = New_TY (func_ty_idx);
00149 TY_Init (func_ty, 0, KIND_FUNCTION, MTYPE_UNKNOWN, STR_IDX_ZERO);
00150 Set_TY_align (func_ty_idx, 1);
00151 TYLIST tylist_idx;
00152
00153
00154
00155
00156
00157 Set_TYLIST_type (New_TYLIST (tylist_idx), ret_ty_idx);
00158 Set_TY_tylist (func_ty, tylist_idx);
00159
00160 Set_TYLIST_type (New_TYLIST (tylist_idx), arg0_ty_idx);
00161 Set_TYLIST_type (New_TYLIST (tylist_idx), arg1_ty_idx);
00162 Set_TYLIST_type (New_TYLIST (tylist_idx), arg2_ty_idx);
00163
00164 Set_TY_has_prototype(func_ty_idx);
00165 Set_TYLIST_type (Tylist_Table [tylist_idx], 0);
00166
00167 return func_ty_idx;
00168 }
00169
00170
00171
00172
00173
00174
00175
00176
00177 unsigned short int path__ctype_b[] = {
00178 2, 2, 2, 2, 2, 2, 2, 2, 2, 8195, 8194, 8194, 8194, 8194, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 24577, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 55304, 55304, 55304, 55304, 55304, 55304, 55304, 55304, 55304, 55304, 49156, 49156, 49156, 49156, 49156, 49156, 49156, 54536, 54536, 54536, 54536, 54536, 54536, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 50440, 49156, 49156, 49156, 49156, 49156, 49156, 54792, 54792, 54792, 54792, 54792, 54792, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 50696, 49156, 49156, 49156, 49156, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 8195, 0, 8194, 0, 8194, 0, 8194, 0, 8194, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 24577, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 55304, 0, 55304, 0, 55304, 0, 55304, 0, 55304, 0, 55304, 0, 55304, 0, 55304, 0, 55304, 0, 55304, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156, 0, 49156};
00179
00180 int path__ctype_tolower[] = {
00181 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 0, 134217726, 0, 0, 0, 0, 0, 7, 1, 6, 1, 1, 24, 0, 32, 134217726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134217726, 0, 0, 0, 0, 7, 1, 6, 1, 1, 24, 0, 32, 0, 134217726, 0, 0, 0, 0, 0, 0, 0, 0, 134217726, 134217726, 0, 0, 0, 0, 7, 1, 6, 1, 1, 24, 0, 32, 134217726, 134217726, 0, 0, 0, 0, 0, 0, 0, 67043328, 0, 0, 0, 0, 0, 0, 6, 1, 6, 0, 1, 24, 28, 0, 67043328, 0, 0, 0, 0, 0, 0, 0, 0, 67043328, 126, 126, 0, 0, 0, 0, 7, 1, 7, 0, 3, 24, 28, 0, 67043328, 126, 126, 0, 0, 0, 0, 0, 15872, 1, 0, 0, 0, 0, 0, 0};
00182
00183 int path__ctype_toupper[] = {
00184 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, -1};
00185
00186
00187 static ST *
00188 Insert_ctype_b(void) {
00189
00190 INT n = sizeof(path__ctype_b)/sizeof(*path__ctype_b);
00191 TY_IDX ty_idx;
00192 TY &ty = New_TY(ty_idx);
00193 TY_Init(ty, n*sizeof(*path__ctype_b), KIND_ARRAY, MTYPE_M,
00194 Save_Str("path__ctype_barray"));
00195 Set_TY_etype(ty, MTYPE_To_TY(MTYPE_U2));
00196 Set_TY_align (ty_idx, TY_align(TY_etype(ty)));
00197 ARB_HANDLE arb = New_ARB ();
00198 ARB_Init (arb, 0, 0, 0);
00199 Set_TY_arb (ty, arb);
00200 Set_ARB_first_dimen (arb);
00201 Set_ARB_last_dimen (arb);
00202 Set_ARB_dimension (arb, 1);
00203 Set_ARB_const_stride(arb);
00204 Set_ARB_stride_val(arb, 1);
00205 Set_ARB_const_lbnd (arb);
00206 Set_ARB_lbnd_val (arb, 0);
00207 Set_ARB_const_ubnd (arb);
00208 Set_ARB_ubnd_val (arb, n);
00209 ST *st = New_ST(1);
00210 ST_Init(st, Save_Str("path__ctype_b"), CLASS_VAR, SCLASS_FSTATIC, EXPORT_LOCAL, ty_idx);
00211 Set_ST_is_initialized(st);
00212 INITO_IDX inito = New_INITO(st);
00213 INITV_IDX inv = New_INITV();
00214 INITV_Init_Integer(inv, MTYPE_U2, path__ctype_b[0]);
00215 Set_INITO_val(inito, inv);
00216 INITV_IDX last_inv = inv;
00217 for (INT i = 1; i < n; i++) {
00218 inv = New_INITV();
00219 INITV_Init_Integer(inv, MTYPE_U2, path__ctype_b[i]);
00220 Set_INITV_next(last_inv, inv);
00221 last_inv = inv;
00222 }
00223
00224
00225 TY_IDX ty_idx2 = Make_Pointer_Type(ty_idx);
00226 ST *st2 = New_ST(1);
00227 ST_Init(st2, Save_Str("path__ctype_b_ptr"), CLASS_VAR, SCLASS_FSTATIC, EXPORT_LOCAL, ty_idx2);
00228 Set_ST_is_initialized(st2);
00229 inito = New_INITO(st2);
00230 inv = New_INITV();
00231 INITV_Init_Symoff(inv, st, 0);
00232 Set_INITO_val(inito, inv);
00233 return st2;
00234 }
00235
00236 static ST *
00237 Insert_ctype_tolower(void) {
00238
00239 INT n = sizeof(path__ctype_tolower)/sizeof(*path__ctype_tolower);
00240 TY_IDX ty_idx;
00241 TY &ty = New_TY(ty_idx);
00242 TY_Init(ty, n*sizeof(*path__ctype_tolower), KIND_ARRAY, MTYPE_M,
00243 Save_Str("path__ctype_tolowerarray"));
00244 Set_TY_etype(ty, MTYPE_To_TY(MTYPE_I4));
00245 Set_TY_align (ty_idx, TY_align(TY_etype(ty)));
00246 ARB_HANDLE arb = New_ARB ();
00247 ARB_Init (arb, 0, 0, 0);
00248 Set_TY_arb (ty, arb);
00249 Set_ARB_first_dimen (arb);
00250 Set_ARB_last_dimen (arb);
00251 Set_ARB_dimension (arb, 1);
00252 Set_ARB_const_stride(arb);
00253 Set_ARB_stride_val(arb, 1);
00254 Set_ARB_const_lbnd (arb);
00255 Set_ARB_lbnd_val (arb, 0);
00256 Set_ARB_const_ubnd (arb);
00257 Set_ARB_ubnd_val (arb, n);
00258 ST *st = New_ST(1);
00259 ST_Init(st, Save_Str("path__ctype_tolower"), CLASS_VAR, SCLASS_FSTATIC, EXPORT_LOCAL, ty_idx);
00260 Set_ST_is_initialized(st);
00261 INITO_IDX inito = New_INITO(st);
00262 INITV_IDX inv = New_INITV();
00263 INITV_Init_Integer(inv, MTYPE_I4, path__ctype_tolower[0]);
00264 Set_INITO_val(inito, inv);
00265 INITV_IDX last_inv = inv;
00266 for (INT i = 1; i < n; i++) {
00267 inv = New_INITV();
00268 INITV_Init_Integer(inv, MTYPE_I4, path__ctype_tolower[i]);
00269 Set_INITV_next(last_inv, inv);
00270 last_inv = inv;
00271 }
00272
00273
00274 TY_IDX ty_idx2 = Make_Pointer_Type(ty_idx);
00275 ST *st2 = New_ST(1);
00276 ST_Init(st2, Save_Str("path__ctype_tolower_ptr"), CLASS_VAR, SCLASS_FSTATIC, EXPORT_LOCAL, ty_idx2);
00277 Set_ST_is_initialized(st2);
00278 inito = New_INITO(st2);
00279 inv = New_INITV();
00280 INITV_Init_Symoff(inv, st, 0);
00281 Set_INITO_val(inito, inv);
00282 return st2;
00283 }
00284
00285 static ST *
00286 Insert_ctype_toupper(void) {
00287
00288 INT n = sizeof(path__ctype_toupper)/sizeof(*path__ctype_toupper);
00289 TY_IDX ty_idx;
00290 TY &ty = New_TY(ty_idx);
00291 TY_Init(ty, n*sizeof(*path__ctype_toupper), KIND_ARRAY, MTYPE_M,
00292 Save_Str("path__ctype_toupperarray"));
00293 Set_TY_etype(ty, MTYPE_To_TY(MTYPE_I4));
00294 Set_TY_align (ty_idx, TY_align(TY_etype(ty)));
00295 ARB_HANDLE arb = New_ARB ();
00296 ARB_Init (arb, 0, 0, 0);
00297 Set_TY_arb (ty, arb);
00298 Set_ARB_first_dimen (arb);
00299 Set_ARB_last_dimen (arb);
00300 Set_ARB_dimension (arb, 1);
00301 Set_ARB_const_stride(arb);
00302 Set_ARB_stride_val(arb, 1);
00303 Set_ARB_const_lbnd (arb);
00304 Set_ARB_lbnd_val (arb, 0);
00305 Set_ARB_const_ubnd (arb);
00306 Set_ARB_ubnd_val (arb, n);
00307 ST *st = New_ST(1);
00308 ST_Init(st, Save_Str("path__ctype_toupper"), CLASS_VAR, SCLASS_FSTATIC, EXPORT_LOCAL, ty_idx);
00309 Set_ST_is_initialized(st);
00310 INITO_IDX inito = New_INITO(st);
00311 INITV_IDX inv = New_INITV();
00312 INITV_Init_Integer(inv, MTYPE_I4, path__ctype_toupper[0]);
00313 Set_INITO_val(inito, inv);
00314 INITV_IDX last_inv = inv;
00315 for (INT i = 1; i < n; i++) {
00316 inv = New_INITV();
00317 INITV_Init_Integer(inv, MTYPE_I4, path__ctype_toupper[i]);
00318 Set_INITV_next(last_inv, inv);
00319 last_inv = inv;
00320 }
00321
00322
00323 TY_IDX ty_idx2 = Make_Pointer_Type(ty_idx);
00324 ST *st2 = New_ST(1);
00325 ST_Init(st2, Save_Str("path__ctype_toupper_ptr"), CLASS_VAR, SCLASS_FSTATIC, EXPORT_LOCAL, ty_idx2);
00326 Set_ST_is_initialized(st2);
00327 inito = New_INITO(st2);
00328 inv = New_INITV();
00329 INITV_Init_Symoff(inv, st, 0);
00330 Set_INITO_val(inito, inv);
00331 return st2;
00332 }
00333
00334
00335 static void
00336 IPA_Create_Ctype_Arrays()
00337 {
00338 IPA_builtin_ctype_b = Insert_ctype_b();
00339 IPA_builtin_ctype_tolower = Insert_ctype_tolower();
00340 IPA_builtin_ctype_toupper = Insert_ctype_toupper();
00341 }
00342
00343
00344 void
00345 IPA_Create_Builtins ()
00346 {
00347
00348 MEM_POOL* save_pu_pool_ptr = MEM_pu_pool_ptr;
00349 MEM_POOL* save_wn_pool_ptr = WN_mem_pool_ptr;
00350
00351
00352 MEM_POOL_Initialize(&IPA_Builtins_Mem_Pool, "IPA builtins pool", 0);
00353 MEM_pu_pool_ptr = &IPA_Builtins_Mem_Pool;
00354 WN_mem_pool_ptr = &IPA_Builtins_Mem_Pool;
00355
00356
00357
00358
00359 IPA_Create_Ctype_Arrays();
00360
00361
00362 MEM_pu_pool_ptr = save_pu_pool_ptr;
00363 WN_mem_pool_ptr = save_wn_pool_ptr;
00364 }
00365
00366
00367
00368 void
00369 IPA_Rename_Builtins (IPA_NODE *node)
00370 {
00371 if (!node || !node->PU_Info())
00372 return;
00373
00374
00375 IPA_NODE_CONTEXT context(node);
00376
00377 for (WN_ITER* wni = WN_WALK_SCFIter(node->Whirl_Tree(FALSE));
00378 wni != NULL;
00379 wni = WN_WALK_SCFNext(wni)) {
00380
00381 if (WN_operator(WN_ITER_wn(wni)) == OPR_BLOCK) {
00382 WN *wn;
00383 WN *block = WN_ITER_wn(wni);
00384 for (wn = WN_first(block); wn != NULL; wn = WN_next(wn)) {
00385 #if 0 // Currently there are no IPA builtins.
00386 if (WN_operator(wn) == OPR_INTRINSIC_CALL) {
00387 std::vector<IPA_BUILTIN*>::iterator it;
00388 for (it = IPA_builtins_list.begin();
00389 it != IPA_builtins_list.end();
00390 it++) {
00391 IPA_BUILTIN *ipa_builtin = *it;
00392
00393 if (WN_intrinsic(wn) == ipa_builtin->Get_Intrinsic()) {
00394 WN *call_wn = WN_Create (OPR_CALL, MTYPE_V, MTYPE_V, 3);
00395 WN_st_idx(call_wn) = PU_Info_proc_sym(ipa_builtin->Get_PU_Info());
00396
00397 WN_kid(call_wn, 0) = WN_kid0(wn);
00398 WN_kid(call_wn, 1) = WN_kid1(wn);
00399 WN_kid(call_wn, 2) = WN_kid2(wn);
00400
00401
00402 WN_INSERT_BlockAfter(block, wn, call_wn);
00403 WN_EXTRACT_FromBlock(block, wn);
00404
00405 wn = call_wn;
00406 break;
00407 }
00408 }
00409 } else
00410 #endif
00411
00412
00413
00414 if (IPA_Enable_Ctype &&
00415 WN_operator(wn) == OPR_CALL) {
00416 WN *new_wn = NULL;
00417 char *name = &Str_Table[ST_name_idx(WN_st(wn))];
00418 if (strcmp(name,"__ctype_b_loc") == 0) {
00419 new_wn = WN_Lda(Pointer_Mtype, 0, IPA_builtin_ctype_b, 0);
00420 } else if (strcmp(name,"__ctype_tolower_loc") == 0) {
00421 new_wn = WN_Lda(Pointer_Mtype, 0, IPA_builtin_ctype_tolower, 0);
00422 } else if (strcmp(name,"__ctype_toupper_loc") == 0) {
00423 new_wn = WN_Lda(Pointer_Mtype, 0, IPA_builtin_ctype_toupper, 0);
00424 }
00425
00426 if (new_wn) {
00427 WN *old_wn = wn;
00428 wn = WN_next(wn);
00429 FmtAssert(WN_operator(wn) == OPR_STID ||
00430 WN_operator(wn) == OPR_ISTORE,
00431 ("IPA_Rename_Builtins: STID for return val not found"));
00432 WN *ret_val = WN_kid0(wn);
00433 FmtAssert(WN_operator(ret_val) == OPR_LDID &&
00434 WN_offset(ret_val) == -1,
00435 ("IPA_Rename_Builtins: LDID for return val not found"));
00436 WN_kid0(wn) = new_wn;
00437 WN_EXTRACT_FromBlock(block, old_wn);
00438 }
00439 }
00440 }
00441 }
00442 }
00443 }