71 #if (defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS)) && !defined(FRONT_END_MFEF77)
75 #ifdef KEEP_WHIRLSTATS
76 INT32 whirl_num_allocated=0;
77 INT32 whirl_bytes_allocated=0;
78 INT32 whirl_num_deallocated=0;
79 INT32 whirl_bytes_deallocated=0;
83 fprintf(stderr,
"Num allocated = %d\nbytes allocated = %d\n",whirl_num_allocated,whirl_bytes_allocated);
84 fprintf(stderr,
"Num deallocated = %d\nbytes deallocated = %d\n",whirl_num_deallocated,whirl_bytes_deallocated);
127 #define WTYPE_base_type(w) WINFO[w].base_type
128 #define WTYPE_comp_type(w) WINFO[w].comp_type
129 #define WTYPE_size(w) WINFO[w].size
131 #if (defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS)) && !defined(FRONT_END_MFEF77)
139 static UINT64 masks [] = { 0, 0xff, 0xffff, 0, 0xffffffffULL,
140 0, 0, 0, 0xffffffffffffffffULL };
144 fe_combine_address_offset (
WN_OFFSET * offset,
WN * addr )
150 if ( FE_Address_Opt ==
FALSE )
259 #define WN_FREE_LIST_Empty(list) (*(list) == NULL)
269 use_free_list =
FALSE;
319 if (size ==
sizeof(
WN)+2*
sizeof(
WN *))
321 else if (size ==
sizeof(
WN))
361 free_stmt_list = free_expr_list =
NULL;
373 #define MAX_CLEANUP_FNS 8
380 WN_FREE_LIST *free_list;
387 #ifdef KEEP_WHIRLSTATS
388 whirl_num_deallocated++;
389 whirl_bytes_deallocated +=
WN_Size(wn);
428 while (node !=
NULL) {
456 (
"attempting to register too many WN_Delete cleanup functions"));
475 if (i >= num_delete_cleanup_fns)
489 #define New_Map_Id() ((WN_MAP_ID) (-1))
505 (
sizeof(
WN *) * (
max(0,kid_count-2))) +
506 next_prev_ptrs * (
sizeof(
mUINT64) + (2 *
sizeof(
WN *))));
507 WN_FREE_LIST *free_list;
512 #ifdef KEEP_WHIRLSTATS
513 whirl_num_allocated++;
514 whirl_bytes_allocated +=
size;
519 (
"Illegal number of kids for WN_Create"));
528 memset(wn,
'\0', size);
536 memset(wn,
'\0', size);
541 if (next_prev_ptrs) {
691 if (loop_info !=
NULL) nkids++;
696 (
"Bad loop_info in WN_CreateDO"));
776 if (element !=
NULL) {
808 last_region_id =
MAX(last_region_id,
id);
908 (
"Bad addr in WN_CreateAgoto"));
930 (
"Bad exp in WN_CreateTruebr"));
943 (
"Bad exp in WN_CreateFalsebr"));
977 if (loop_info !=
NULL) nkids++;
979 (
"Bad loop_info in WN_CreateDO"));
996 (
"Bad value in WN_CreateCompgoto"));
998 (
"Bad block in WN_CreateCompgoto"));
1000 (
"Bad deflt in WN_CreateCompgoto"));
1008 if (deflt)
WN_kid(wn,2) = deflt;
1021 (
"Bad value in WN_CreateSwitch"));
1023 (
"Bad block in WN_CreateSwitch"));
1025 (
"Bad deflt in WN_CreateSwitch"));
1058 (
"Bad value in WN_CreateXgoto"));
1060 (
"Bad block in WN_CreateXgoto"));
1082 (
"Bad addr in WN_CreateIstore"));
1084 (
"Bad value in WN_CreateIstore"));
1086 (
"Bad return type in WN_CreateIstore"));
1088 (
"Bad opcode in WN_CreateIstore"));
1090 #if (defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS)) && !defined(FRONT_END_MFEF77)
1092 addr = fe_combine_address_offset ( &offset, addr );
1095 if (field_id == 0) {
1103 if ( FE_Cvtl_Opt ) {
1127 mask = masks [ty_size];
1175 (
"Bad addr in WN_CreatePstore"));
1177 (
"Bad value in WN_CreatePstore"));
1179 (
"Bad return type in WN_CreatePstore"));
1181 (
"Bad opcode in WN_CreatePstore"));
1183 #if (defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS)) && !defined(FRONT_END_MFEF77)
1185 addr = fe_combine_address_offset ( &offset, addr );
1188 if (field_id == 0) {
1196 if ( FE_Cvtl_Opt ) {
1219 mask = masks [ty_size];
1262 (
"Bad opcode in WN_CreateIstorex"));
1264 (
"Bad value in WN_CreateIstorex"));
1266 (
"Bad address 1 in WN_CreateIstorex"));
1268 (
"Bad address 2 in WN_CreateIstorex"));
1283 (
"Bad address 1 in WN_CreatePrefetchx"));
1285 (
"Bad address 2 in WN_CreatePrefetchx"));
1294 WN *value,
WN *addr,
WN *num_bytes)
1303 (
"Bad addr in WN_CreateMstore"));
1305 (
"Bad value in WN_CreateMstore"));
1307 (
"Bad num_bytes in WN_CreateMstore"));
1309 #if (defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS)) && !defined(FRONT_END_MFEF77)
1311 addr = fe_combine_address_offset ( &offset, addr );
1318 WN_kid(wn,2) = num_bytes;
1339 (
"Bad value in WN_CreateStid"));
1341 (
"Bad return type in WN_CreateStid"));
1343 (
"Bad opcode in WN_CreateStid"));
1349 (
"Preg offset 0 in WN_CreateStid"));
1352 #if (defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS)) && !defined(FRONT_END_MFEF77)
1355 if (field_id == 0) {
1387 mask = masks [ty_size];
1422 (
"Bad value in WN_CreatePStid"));
1424 (
"Bad return type in WN_CreatePStid"));
1426 (
"Bad opcode in WN_CreatePStid"));
1432 (
"Preg offset 0 in WN_CreatePStid"));
1435 #if (defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS)) && !defined(FRONT_END_MFEF77)
1438 if (field_id == 0) {
1470 mask = masks [ty_size];
1502 (
"Bad addr in WN_CreatePrefetch"));
1514 Is_True(kid_count >= 1,(
"Bad kid_count in WN_CreateIo"));
1588 (
"Bad exp in WN_CreateEval"));
1620 (
"ASM_CONSTRAINT-specific CreatePragma can't be used for "
1668 (
"Bad kid0 in WN_CreateExp1"));
1691 (
"Bad kid0 in WN_CreateExp2"));
1693 (
"Bad kid1 in WN_CreateExp2"));
1711 WN *kid0,
WN *kid1,
WN *kid2)
1717 (
"Bad kid0 in WN_CreateExp3"));
1719 (
"Bad kid1 in WN_CreateExp3"));
1721 (
"Bad kid2 in WN_CreateExp3"));
1776 (
"Bad addr in WN_CreateIload"));
1779 (
"Bad opcode in WN_CreateIload"));
1781 #if (defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS)) && !defined(FRONT_END_MFEF77)
1783 addr = fe_combine_address_offset ( &offset, addr );
1814 (
"Bad opcode in WN_CreateIloadx"));
1816 (
"Bad address1 in WN_CreateIloadx"));
1818 (
"Bad address2 in WN_CreateIloadx"));
1836 (
"Bad addr in WN_CreateMload"));
1838 #if (defined(FRONT_END_C) || defined(FRONT_END_CPLUSPLUS)) && !defined(FRONT_END_MFEF77)
1840 addr = fe_combine_address_offset ( &offset, addr );
1862 (
"Bad opcode in WN_CreateLdid"));
1869 (
"Preg offset 0 in WN_CreateLdid"));
1890 (
"Bad addr in WN_CreateLda"));
1892 (
"Bad opcode in WN_CreateLda"));
1910 (
"Bad addr in WN_CreateIlda"));
1912 (
"Bad opcode in WN_CreateIlda"));
1939 (
"Bad opcode in WN_CreateConst"));
1952 (
"Bad opcode in WN_CreateIntconst"));
1967 WN *block,
WN *value)
1973 (
"Bad value in WN_CreateComma"));
1975 (
"Bad block in WN_CreateComma"));
1988 WN *value,
WN *block)
1994 (
"Bad value in WN_CreateComma"));
1996 (
"Bad block in WN_CreateComma"));
2109 switch (maptab->
_kind[i]) {
2165 switch (src->
_kind[i]) {
2167 if (old_map_id < src->_map_size[category][i]) {
2173 if (old_map_id < src->_map_size[category][i]) {
2180 if (old_map_id < src->_map_size[category][i]) {
2187 Is_True(
FALSE, (
"IPA_WN_Move_Maps_PU: unknown map kind"));
2199 *StartAddress = (
void *)&(
WN_prev(wn));
2203 *StartAddress = (
void *) wn;
2214 if (induction !=
NULL) nkids++;
2215 if (trip !=
NULL) nkids++;
2217 (
"trip must be null if induction is null in WN_CreateLoopInfo"));
2267 WN_kid(wn,0) = condition;
2313 for (i=0; i<
n; i++) {
2314 WN_kid(call,i) = kids[i];
2332 if ( parm_node !=
NULL ) {
2335 (
"Bad parm_node in WN_CreateParm"));
2337 (
"rtype and parm_node's rtype are different in WN_CreateParm"));
2343 (
"non-VOID type in WN_CreateParm with null parm_node") );
2468 return WN_Iload(desc, offset, align, ldid);
2514 double val = pow( 2.0, n);
2522 Is_True(((0<=n) && (n <= 63)), (
"invalid power of 2"));
2578 Is_True(
FALSE, (
"expected Uninitialized Variable const type"));
2582 #define NBITMASK(x) ((1ll<<(x))-1)
2592 rotate= rotate %
size;
2600 n = n | (t << (size - rotate));
2603 else if (rotate < 0)
2610 n = n | (t >> (size - rotate));
2646 Is_True (ty != 0, (
"WN_lda(): NULL ty"));
2746 (
"WN_Int_Type_Conversion: bad from_type: %d\n", from_type) );
2749 if ( from_type == to_type )
2755 switch ( to_type ) {
2757 switch ( from_type ) {
2771 switch ( from_type ) {
2785 switch ( from_type ) {
2795 return WN_Cvt( from_type, to_type, wn );
2798 switch ( from_type ) {
2805 return WN_Cvt( from_type, to_type, wn );
2811 switch ( from_type ) {
2825 switch ( from_type ) {
2839 switch ( from_type ) {
2849 return WN_Cvt( from_type, to_type, wn );
2852 switch ( from_type ) {
2859 return WN_Cvt( from_type, to_type, wn );
2866 (
"WN_Int_Type_Conversion: bad to_type: %d\n", to_type) );
2888 (
"WN_Float_Type_Conversion: unexpected from_type: %d\n",from_type));
2892 (
"WN_Float_Type_Conversion: unexpected to_type: %d\n", to_type) );
2895 if ( from_type == to_type )
2898 return WN_Cvt( from_type, to_type, wn );
2917 BOOL from_flt,to_flt;
2920 if ( from_type == to_type )
2934 (
"WN_Type_Conversion: unexpected from_type: %d\n", from_type) );
2946 (
"WN_Type_Conversion: unexpected to_type: %d\n", to_type) );
2955 return WN_Cvt( from_type, to_type, wn );
2961 return WN_Cvt( from_type, to_type, wn );
2966 WN *tmp_wn =
WN_Cvt( from_type, tmp_to_type, wn );
2974 else if ( to_flt ) {
2978 return WN_Cvt( from_type, to_type, wn );
2986 return WN_Cvt( tmp_to_type, to_type, tmp_wn );
3276 for (
INT32 i = n + 1; i <= 2 *
n; i++) {
3289 for (
INT32 i = 0; i <
n; i++) {