18 namespace whirl2xaif {
62 #define NOT_BITFIELD_OR_IS_FIRST_OF_BITFIELD(f) \
63 (!FLD_is_bit_field(f) || (FLD_is_bit_field(f) && (FLD_bofst(f) == 0) || FLD_bofst(f) > 16))
112 std::ostringstream xos_abdstr;
117 GetTmpVarTransInfo(xos_abd, arbnd, wn);
120 return xos_abdstr.str();
168 #define FLD_INFO_ALLOC_CHUNK 16
204 fld_info[info_idx].next = &fld_info[info_idx+1];
227 if (fld_size > max_size)
261 if (fld_size > noffset -
FLD_ofst(this_fld))
262 fld_size = noffset -
FLD_ofst(this_fld) ;
299 FORTTK_ASSERT(offs1 == desired_offset && offs2 == desired_offset,
300 "Unexpected offset");
335 if (best_path == path1)
373 printf (
" Construct: fld %s, struct %s, desired %s , des off %d \n",
378 if (desired_offset < fld_offset ||
379 desired_offset >= (fld_offset +
TY_size(fld_ty))) {
386 printf (
" found NULL\n");
391 printf (
" found char substring\n");
421 printf (
" is_array = %d, fld_ty %s \n",is_array_elt,
TY_name(fld_ty));
427 ((desired_offset - fld_offset)/
TY_size(fld_ty)) *
TY_size(fld_ty);
436 printf (
" recurse \n");
440 desired_offset - (fld_offset+ofst_in_fld));
443 if (fld_path2 !=
NULL) {
445 fld_path = fld_path2;
448 fld_path->
arr_elt = is_array_elt;
450 fld_path->
next = fld_path2;
461 if (desired_offset != fld_offset+ofst_in_fld ||
465 printf (
" account - miss\n");
471 printf (
" account - match\n");
474 fld_path->
arr_elt = is_array_elt;
486 BOOL common_or_equivalence,
487 BOOL alt_return_name)
493 const char *fld_name =
NULL;
495 if (common_or_equivalence && !alt_return_name) {
500 if (fld_name ==
NULL || *fld_name ==
'\0') { fld_name =
"anon-fld"; }
511 const char *equiv_name,
512 const char *fld_name,
517 xos <<
"EQUIVALENCE(" << equiv_name;
518 xos <<
"(" <<
Num2Str(fld_ofst,
"%lld") <<
"),";
519 xos << fld_name <<
")";
528 BOOL *common_block_equivalenced)
541 common_block_equivalenced);
546 const char* tmpvar =
StrCat(
"tmp",
Num2Str(equiv_var_idx,
"%d"));
551 *common_block_equivalenced =
TRUE;
594 &common_block_equivalenced);
725 const char* type_str;
727 type_str =
"CHARACTER";
729 type_str =
"LOGICAL";
741 type_str =
"INTEGER";
753 type_str =
"COMPLEX";
757 type_str =
"memory block";
765 const char* size_str;
773 size_str =
Num2Str(size,
"%lld");
776 size_str =
".mblock.";
779 "Unexpected type size " <<
TY_size(ty));
784 const char* str =
StrCat(type_str, size_str);
809 xos <<
"CHARACTER*(*)";
817 INT32 array_dim = dim - co_dim;
827 <<
xml::Attr(
"name",
"ArrayElementType");
840 while (array_dim > 0) {
843 << xml::Attr(
"name",
"ArrayDimensionAttr") <<
xml::Attr(
"dim", dim);
857 array_dim = dim - co_dim;
903 xos <<
"CHARACTER*(*)";
911 INT32 array_dim = dim-co_dim;
931 while (array_dim > 0) {
945 array_dim = dim - co_dim;
977 xos <<
"(" <<
TY_name(ty) <<
")" <<
"TYPE";
979 #if 0 // see Open64 stab_attr.cxx; if needed simulate thru PUXlationContext
980 if (!TY_is_translated_to_c(ty)) {
981 TY2F_Translate_Structure(xos, ty);
982 Set_TY_is_translated_to_c(ty);
999 #if 0 // see Open64 stab_attr.cxx; if needed simulate thru PUXlationContext
1000 if (!TY_is_translated_to_c(ty)) {
1001 TY2F_Translate_Structure(xos, ty);
1002 Set_TY_is_translated_to_c(ty);
1017 Prepend_Token_String(xos,
",POINTER ::");
1024 Prepend_Token_String(xos,
",POINTER ::");
1039 xos << std::endl <<
"! <Void Type>";
1053 std::cout <<
"TEMP WARNING" << std::endl;
1069 if (name !=
NULL && *name !=
'\0') { xos <<
" name = " <<
name; }
1126 if (fld_path !=
NULL) {
1130 fld_path = fld_path->
next;
1131 fld_path->
next = free_list;
1158 if (fld_path2 ==
NULL)
1159 fld_path2 = fld_path;
1160 else if (fld_path !=
NULL)
1174 BOOL member_of_common,
1183 while (fld_path !=
NULL) {
1185 const char* str =
TY2F_Fld_Name(f, member_of_common, alt_ret_name);
1187 str =
StrCat(
"deref_", str);
1191 member_of_common =
FALSE;
1201 fld_path = fld_path->
next;
1202 if (fld_path !=
NULL) {
1204 alt_ret_name =
FALSE;
1223 while (fld_path !=
NULL) {
1225 fld_path = fld_path->
next ;
1236 while (path !=
NULL) {
1248 while (fld_path !=
NULL) {
1260 printf (
" tree 0x%p",fld_path->
arr_wn);
1263 fld_path = fld_path->
next ;
1278 const char* str =
NULL;
1329 FORTTK_DIE(
"whirl2xaif::TranslateTYToSymType: no logic to handle type of kind " <<
TY_kind(ty));
1365 FORTTK_DIE(
"whirl2xaif::TranslateTYToMType: no logic to handle type of kind " <<
TY_kind(ty_r));
1373 const char* str =
NULL;
1389 case 1: str =
"vector";
break;
1390 case 2: str =
"matrix";
break;
1391 case 3: str =
"three_tensor";
break;
1392 case 4: str =
"four_tensor";
break;
1393 case 5: str =
"five_tensor";
break;
1394 case 6: str =
"six_tensor";
break;
1395 case 7: str =
"seven_tensor";
break;
1397 FORTTK_DIE(
"Invalid array dimension: " << dim);