|
OpenADFortTk (basic)
|
00001 // -*-Mode: C++;-*- 00002 // $Header: /m_home/m_utkej/Argonne/cvs2svn/cvs/OpenADFortTk/src/whirl2sexp/symtab2sexp.cxx,v 1.13 2007-10-08 18:28:34 utke Exp $ 00003 00004 #include "Open64IRInterface/Open64BasicTypes.h" 00005 00006 #include "quad.h" 00007 #include "SexpTags.h" 00008 00009 #include "wn2sexp.h" 00010 #include "symtab2sexp.h" 00011 00012 00013 using namespace whirl2sexp; 00014 using namespace sexp; // for sexp::ostream, etc 00015 00016 00017 //*************************************************************************** 00018 // Translate symbol tables 00019 //*************************************************************************** 00020 00021 void 00022 whirl2sexp::TranslateGlobalSymbolTables(sexp::ostream& sos, int flags) 00023 { 00024 // Cf. symtab_defs.h, Write_Global_Info(), Read_Global_Info() 00025 // 00026 // GLOBAL_SYMTAB_TABLES: There are 13 tables in the global symtab. 00027 // FILE_INFO (File_info) 00028 // ST_TAB (St_Table) [global and local] 00029 // ST_ATTR_TABLE (St_Attr_Table) [global and local] 00030 // PU_TAB (Pu_Table) 00031 // TYPE_TABLE (Ty_Table) 00032 // FLD_TAB (Fld_Table) 00033 // ARB_TAB (Arb_Table) 00034 // TYLIST_TAB (Tylist_Table) 00035 // TCON_TAB (Tcon_Table) 00036 // TCON_STR_TAB (TCON_strtab) 00037 // INITO_TABLE (Inito_Table) [global and local] 00038 // INITV_TAB (Initv_Table) 00039 // BLK_TAB (Blk_Table) 00040 // String table 00041 // STR_TABLE (Str_Table) [source code strings, not string constants] 00042 00043 sos << BegList << Atom(SexpTags::GBL_SYMTAB) << EndLine; 00044 00045 xlate_FILE_INFO(sos); 00046 sos << EndLine; 00047 00048 xlate_ST_TAB(sos, GLOBAL_SYMTAB); 00049 sos << EndLine; 00050 00051 xlate_ST_ATTR_TAB(sos, GLOBAL_SYMTAB); 00052 sos << EndLine; 00053 00054 xlate_PU_TAB(sos); 00055 sos << EndLine; 00056 00057 xlate_TY_TAB(sos); 00058 sos << EndLine; 00059 00060 xlate_FLD_TAB(sos); 00061 sos << EndLine; 00062 00063 xlate_ARB_TAB(sos); 00064 sos << EndLine; 00065 00066 xlate_TYLIST_TAB(sos); 00067 sos << EndLine; 00068 00069 xlate_TCON_TAB(sos); 00070 sos << EndLine; 00071 00072 xlate_TCON_STR_TAB(sos); 00073 sos << EndLine; 00074 00075 xlate_INITO_TAB(sos, GLOBAL_SYMTAB); 00076 sos << EndLine; 00077 00078 xlate_INITV_TAB(sos); 00079 sos << EndLine; 00080 00081 xlate_BLK_TAB(sos); 00082 sos << EndLine; 00083 00084 xlate_STR_TAB(sos); 00085 00086 sos << EndList; 00087 } 00088 00089 00090 void 00091 whirl2sexp::TranslateLocalSymbolTables(sexp::ostream& sos, SYMTAB_IDX stab_lvl, 00092 int flags) 00093 { 00094 // Cf. symtab_defs.h and Read_Local_Info() 00095 // 00096 // LOCAL_SYMTAB_TABLES: There are 5 tables in the local symtab. 00097 // ST_TAB 00098 // ST_ATTR_TAB 00099 // LABEL_TABLE (Label_Table) 00100 // PREG_TABLE (Preg_Table) 00101 // INITO_TAB 00102 00103 sos << BegList << Atom(SexpTags::PU_SYMTAB) << EndLine; 00104 00105 xlate_ST_TAB(sos, stab_lvl); 00106 sos << EndLine; 00107 00108 xlate_ST_ATTR_TAB(sos, stab_lvl); 00109 sos << EndLine; 00110 00111 xlate_LABEL_TAB(sos, stab_lvl); 00112 sos << EndLine; 00113 00114 xlate_PREG_TAB(sos, stab_lvl); 00115 sos << EndLine; 00116 00117 xlate_INITO_TAB(sos, stab_lvl); 00118 00119 sos << EndList; 00120 } 00121 00122 00123 //*************************************************************************** 00124 // Translate individual tables 00125 //*************************************************************************** 00126 00127 // Note: 'For_all' applies 'operator()' to every entry of the 00128 // respective table. 00129 00130 void 00131 whirl2sexp::xlate_FILE_INFO(sexp::ostream& sos) 00132 { 00133 sos << BegList << Atom(SexpTags::FILE_INFO); 00134 00135 // gp_group 00136 UINT gp = (UINT)FILE_INFO_gp_group(File_info); 00137 sos << Atom(gp); 00138 00139 // flags 00140 const char* flg_str = FILE_INFO_FLAGS_To_Str(File_info.flags); 00141 sos << GenSexpFlg(flg_str); 00142 00143 sos << EndList; 00144 } 00145 00146 00147 void 00148 whirl2sexp::xlate_ST_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl) 00149 { 00150 sos << BegList << Atom(SexpTags::ST_TAB) << EndLine; 00151 For_all(St_Table, stab_lvl, xlate_SYMTAB_entry_op<ST>(sos)); 00152 sos << EndList; 00153 } 00154 00155 00156 void 00157 whirl2sexp::xlate_ST_ATTR_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl) 00158 { 00159 sos << BegList << Atom(SexpTags::ST_ATTR_TAB) << EndLine; 00160 For_all(St_Attr_Table, stab_lvl, xlate_SYMTAB_entry_op<ST_ATTR>(sos)); 00161 sos << EndList; 00162 } 00163 00164 00165 void 00166 whirl2sexp::xlate_ST_TAB(sexp::ostream& sos, const SCOPE& scope) 00167 { 00168 sos << BegList << Atom(SexpTags::ST_TAB) << EndLine; 00169 For_all(*scope.st_tab, xlate_SYMTAB_entry_op<ST>(sos)); 00170 sos << EndList; 00171 } 00172 00173 00174 void 00175 whirl2sexp::xlate_PU_TAB(sexp::ostream& sos) 00176 { 00177 sos << BegList << Atom(SexpTags::PU_TAB) << EndLine; 00178 For_all(Pu_Table, xlate_SYMTAB_entry_op<PU>(sos)); 00179 sos << EndList; 00180 } 00181 00182 00183 void 00184 whirl2sexp::xlate_TY_TAB(sexp::ostream& sos) 00185 { 00186 sos << BegList << Atom(SexpTags::TY_TAB) << EndLine; 00187 For_all(Ty_Table, xlate_SYMTAB_entry_op<TY>(sos)); 00188 sos << EndList; 00189 } 00190 00191 00192 void 00193 whirl2sexp::xlate_FLD_TAB(sexp::ostream& sos) 00194 { 00195 sos << BegList << Atom(SexpTags::FLD_TAB) << EndLine; 00196 For_all(Fld_Table, xlate_SYMTAB_entry_op<FLD>(sos)); 00197 sos << EndList; 00198 } 00199 00200 00201 void 00202 whirl2sexp::xlate_ARB_TAB(sexp::ostream& sos) 00203 { 00204 sos << BegList << Atom(SexpTags::ARB_TAB) << EndLine; 00205 For_all(Arb_Table, xlate_SYMTAB_entry_op<ARB>(sos)); 00206 sos << EndList; 00207 } 00208 00209 00210 void 00211 whirl2sexp::xlate_TYLIST_TAB(sexp::ostream& sos) 00212 { 00213 sos << BegList << Atom(SexpTags::TYLIST_TAB) << EndLine; 00214 For_all(Tylist_Table, xlate_SYMTAB_entry_op<TYLIST>(sos)); 00215 sos << EndList; 00216 } 00217 00218 00219 void 00220 whirl2sexp::xlate_TCON_TAB(sexp::ostream& sos) 00221 { 00222 sos << BegList << Atom(SexpTags::TCON_TAB) << EndLine; 00223 For_all(Tcon_Table, xlate_SYMTAB_entry_op<TCON>(sos)); 00224 sos << EndList; 00225 } 00226 00227 00228 void 00229 whirl2sexp::xlate_TCON_STR_TAB(sexp::ostream& sos) 00230 { 00231 sos << BegList << Atom(SexpTags::TCON_STR_TAB) << EndLine; 00232 00233 // We must manually find the string boundaries, knowing 00234 // implementation details. Yuck. 00235 00236 // Details: Each char-array is preceeded by size info. If the 00237 // char-array is less than 0xff bytes, the first byte contains the 00238 // size. Otherwise the first byte is 0xff and the next 4 bytes hold 00239 // the size (UINT32). The index points to the first byte in the 00240 // string! 00241 // E.g.: -xxx0-yyy0 [where - is size info; xxx and yyy are strings] 00242 const char* buf = Index_to_char_array(0); // the whole buffer 00243 UINT32 last_idx = TCON_strtab_size() - 1; 00244 for (UINT32 idx = 0; idx < last_idx; /* */) { 00245 // always at the beginning of a string 00246 if ((unsigned char)buf[idx] == 0xff) { 00247 xlate_SYMTAB_entry_TCON_STR(sos, idx+5); 00248 } 00249 else { 00250 xlate_SYMTAB_entry_TCON_STR(sos, idx+1); 00251 } 00252 idx += strlen(buf+idx) + 1; 00253 sos << sexp::EndLine; 00254 } 00255 00256 sos << EndList; 00257 } 00258 00259 00260 void 00261 whirl2sexp::xlate_INITO_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl) 00262 { 00263 sos << BegList << Atom(SexpTags::INITO_TAB) << EndLine; 00264 For_all(Inito_Table, stab_lvl, xlate_SYMTAB_entry_op<INITO>(sos)); 00265 sos << EndList; 00266 } 00267 00268 00269 void 00270 whirl2sexp::xlate_INITV_TAB(sexp::ostream& sos) 00271 { 00272 sos << BegList << Atom(SexpTags::INITV_TAB) << EndLine; 00273 For_all(Initv_Table, xlate_SYMTAB_entry_op<INITV>(sos)); 00274 sos << EndList; 00275 } 00276 00277 00278 void 00279 whirl2sexp::xlate_BLK_TAB(sexp::ostream& sos) 00280 { 00281 sos << BegList << Atom(SexpTags::BLK_TAB) << EndLine; 00282 For_all(Blk_Table, xlate_SYMTAB_entry_op<BLK>(sos)); 00283 sos << EndList; 00284 } 00285 00286 00287 void 00288 whirl2sexp::xlate_STR_TAB(sexp::ostream& sos) 00289 { 00290 sos << BegList << Atom(SexpTags::STR_TAB) << EndLine; 00291 00292 // We must manually find the string boundaries, knowing 00293 // implementation details. Yuck. 00294 00295 // Details: The first entry in the buffer is NULL and thus every 00296 // string is preceeded by a NULL. The index points to the first 00297 // byte in the string! 00298 // E.g: 0xxx0yyy0zzz0 [where xxx, yyy, and zzz are strings] 00299 const char* buf = Index_To_Str(0); // the whole buffer 00300 STR_IDX last_idx = STR_Table_Size() - 1; 00301 for (STR_IDX idx = 0; idx < last_idx; ++idx) { 00302 if (buf[idx] == '\0') { 00303 xlate_SYMTAB_entry_STR(sos, idx+1); 00304 sos << sexp::EndLine; 00305 } 00306 } 00307 00308 sos << EndList; 00309 } 00310 00311 00312 void 00313 whirl2sexp::xlate_LABEL_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl) 00314 { 00315 sos << BegList << Atom(SexpTags::LABEL_TAB) << EndLine; 00316 // osprey1.0/common/com/symtab_utils.h defines this without 'stab_lvl' arg! 00317 //For_all(Label_Table, stab_lvl, xlate_SYMTAB_entry_op<LABEL>(sos)); 00318 For_all_entries(*Scope_tab[stab_lvl].label_tab, 00319 xlate_SYMTAB_entry_op<LABEL>(sos), 1); 00320 sos << EndList; 00321 } 00322 00323 00324 void 00325 whirl2sexp::xlate_PREG_TAB(sexp::ostream& sos, SYMTAB_IDX stab_lvl) 00326 { 00327 sos << BegList << Atom(SexpTags::PREG_TAB) << EndLine; 00328 // osprey1.0/common/com/symtab_utils.h defines this without 'stab_lvl' arg! 00329 //For_all(Preg_Table, stab_lvl, xlate_SYMTAB_entry_op<PREG>(sos)); 00330 For_all_entries(*Scope_tab[stab_lvl].preg_tab, 00331 xlate_SYMTAB_entry_op<PREG>(sos), 1); 00332 sos << EndList; 00333 } 00334 00335 00336 //*************************************************************************** 00337 // Function objects to translate individual table entries 00338 //*************************************************************************** 00339 00340 void 00341 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, ST* st) 00342 { 00343 using namespace sexp::IOFlags; 00344 00345 sos << BegList << Atom(idx); 00346 00347 // sym_class, storage_class, export_class 00348 ST_CLASS stclass = ST_class(st); 00349 const char* stclass_nm = Class_Name(stclass); 00350 sos << Atom(stclass_nm); 00351 00352 ST_SCLASS stsclass = ST_sclass(st); 00353 const char* stsclass_nm = Sclass_Name(stsclass); 00354 sos << Atom(stsclass_nm); 00355 00356 ST_EXPORT stexport = ST_export(st); 00357 const char* stexport_nm = Export_Name(stexport); 00358 sos << Atom(stexport_nm); 00359 00360 // name_idx/tcon 00361 STR_IDX nmidx = ST_name_idx(st); // or TCON_IDX 00362 sos << BegList << GenSexpSymNm(st) << Atom(nmidx) << EndList; 00363 00364 // type/pu/blk 00365 if (stclass == CLASS_FUNC) { 00366 PU_IDX stpu = ST_pu(st); 00367 sos << Atom(stpu); // FIXME add tag? 00368 } 00369 else if (stclass == CLASS_BLOCK) { 00370 BLK_IDX stblk = ST_blk(st); 00371 sos << Atom(stblk); // FIXME add tag? 00372 } 00373 else { 00374 TY_IDX sttype = ST_type(st); 00375 sos << GenSexpTy(sttype); 00376 } 00377 00378 // base_idx, offset 00379 ST_IDX stbase_idx = ST_base_idx(st); 00380 UINT64 oset = ST_ofst(st); 00381 sos << GenSexpSym(stbase_idx) << Atom(oset); 00382 00383 // flags/flags_ext 00384 const char* flg_str = ST_FLAGS_To_Str(st->flags); 00385 const char* flgext_str = ST_EXT_FLAGS_To_Str(st->flags_ext); 00386 sos << GenSexpFlg(flg_str) << GenSexpFlg(flgext_str); 00387 00388 // st_idx 00389 ST_IDX st_idx = ST_st_idx(st); 00390 sos << GenSexpSym(st_idx); 00391 00392 sos << EndList; 00393 } 00394 00395 00396 void 00397 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, ST_ATTR* sta) 00398 { 00399 sos << BegList << Atom(idx); 00400 00401 // st_idx 00402 ST_IDX st_idx = ST_ATTR_st_idx(*sta); 00403 sos << GenSexpSym(st_idx); 00404 00405 // kind 00406 ST_ATTR_KIND knd = ST_ATTR_kind(*sta); 00407 const char* knd_nm = ST_ATTR_Kind_Name(knd); 00408 sos << Atom(knd_nm); 00409 00410 // reg_id/section_name 00411 PREG_NUM val = ST_ATTR_reg_id(*sta); 00412 sos << Atom(val); 00413 00414 sos << EndList; 00415 } 00416 00417 00418 void 00419 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, PU* pu) 00420 { 00421 sos << BegList << Atom(idx); 00422 00423 // prototype 00424 TY_IDX ty_idx = PU_prototype(*pu); 00425 sos << GenSexpTy(ty_idx); 00426 00427 // lexical_level 00428 UINT lvl = (UINT)PU_lexical_level(*pu); 00429 sos << Atom(lvl); 00430 00431 // gp_group 00432 UINT gp = (UINT)PU_gp_group(*pu); 00433 sos << Atom(gp); 00434 00435 // src_lang 00436 UINT64 srclang = PU_src_lang(*pu); 00437 const char* srclang_str = PU_SRC_LANG_FLAGS_To_Str(srclang); 00438 sos << GenSexpFlg(srclang_str); 00439 00440 // target_idx 00441 TARGET_INFO_IDX targidx = PU_target_idx(*pu); 00442 sos << Atom(targidx); 00443 00444 // flags 00445 const char* flg_str = PU_FLAGS_To_Str(pu->flags); 00446 sos << GenSexpFlg(flg_str); 00447 00448 sos << EndList; 00449 } 00450 00451 00452 void 00453 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, TY* typ) 00454 { 00455 using namespace sexp::IOFlags; 00456 00457 TY& ty = *typ; 00458 00459 sos << BegList << Atom(idx); 00460 00461 // kind 00462 TY_KIND knd = TY_kind(ty); 00463 const char* knd_nm = Kind_Name(knd); 00464 sos << Atom(knd_nm); 00465 00466 // name_idx 00467 STR_IDX nmidx = TY_name_idx(ty); 00468 const char* nm = TY_name(ty); 00469 sos << BegList << Atom(A_DQUOTE, nm) << Atom(nmidx) << EndList; 00470 00471 // mtype, size 00472 TYPE_ID mty = TY_mtype(ty); 00473 UINT64 sz = TY_size(ty); 00474 const char* mty_nm = Mtype_Name(mty); 00475 sos << Atom(mty_nm) << Atom(sz); 00476 00477 // flags 00478 UINT16 flg = TY_flags(ty); 00479 const char* flg_str = TY_FLAGS_To_Str(flg); 00480 sos << GenSexpFlg(flg_str); 00481 00482 // arb/fld/tylist: ARRAY, STRUCT, FUNCTION (respectively) 00483 // etype/pointed/pu_flags: ARRAY, POINTER, FUNCTION (respectively) 00484 sos << BegList; 00485 if (knd == KIND_ARRAY) { 00486 ARB_HANDLE arb = TY_arb(ty); // FIXME add arb tag? 00487 TY_IDX ety = TY_etype(ty); 00488 sos << Atom(arb.Idx()) << GenSexpTy(ety); 00489 } 00490 else if (knd == KIND_STRUCT) { 00491 FLD_HANDLE fld = TY_fld(ty); // FIXME add tag? 00492 sos << Atom(fld.Idx()); 00493 } 00494 else if (knd == KIND_POINTER) { 00495 TY_IDX basety = TY_pointed(ty); 00496 sos << GenSexpTy(basety); 00497 } 00498 else if (knd == KIND_FUNCTION) { 00499 TYLIST_IDX tyl = TY_tylist(ty); 00500 const char* pu_flg_str = TY_PU_FLAGS_To_Str(ty.Pu_flags()); 00501 sos << Atom(tyl) << GenSexpFlg(pu_flg_str); 00502 } 00503 sos << EndList; 00504 00505 sos << EndList; 00506 } 00507 00508 00509 void 00510 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, FLD* fld) 00511 { 00512 using namespace sexp::IOFlags; 00513 00514 FLD_HANDLE fldh(fld, (FLD_IDX)idx); 00515 00516 sos << BegList << Atom(idx); 00517 00518 // name_idx 00519 STR_IDX nmidx = FLD_name_idx(fldh); 00520 const char* nm = FLD_name(fldh); 00521 sos << BegList << Atom(A_DQUOTE, nm) << Atom(nmidx) << EndList; 00522 00523 // type 00524 TY_IDX ty_idx = fld->type; // FLD_type(fldh) is not a simple accessor! 00525 sos << GenSexpTy(ty_idx); 00526 00527 // ofst, bsize, bofst 00528 UINT64 ofst = FLD_ofst(fldh); 00529 UINT8 bsz = FLD_bsize(fldh); 00530 UINT8 bofst = FLD_bofst(fldh); 00531 sos << Atom(ofst) << Atom(bsz) << Atom(bofst); 00532 00533 // flags 00534 UINT16 flg = FLD_flags(fldh); 00535 const char* flg_str = FLD_FLAGS_To_Str(flg); 00536 sos << GenSexpFlg(flg_str); 00537 00538 // st 00539 ST_IDX st_idx = FLD_st(fldh); 00540 sos << GenSexpSym(st_idx); 00541 00542 sos << EndList; 00543 } 00544 00545 00546 void 00547 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, ARB* arb) 00548 { 00549 using namespace sexp::IOFlags; 00550 00551 ARB_HANDLE arbh(arb, (ARB_IDX)idx); 00552 00553 sos << BegList << Atom(idx); 00554 00555 // flags, dimension, co_dimension 00556 UINT16 flg = ARB_flags(arbh); 00557 const char* flg_str = ARB_FLAGS_To_Str(flg); 00558 UINT16 dim = ARB_dimension(arbh); 00559 UINT16 codim = ARB_co_dimension(arbh); 00560 sos << GenSexpFlg(flg_str) << Atom(dim) << Atom(codim); 00561 00562 // lbnd_val/(lbnd_var, lbnd_unused) 00563 if (ARB_const_lbnd(arbh)) { 00564 INT64 val = ARB_lbnd_val(arbh); 00565 sos << BegList << Atom("const") << Atom(val) << EndList; 00566 } 00567 else { 00568 ST_IDX st_idx = ARB_lbnd_var(arbh); 00569 sos << GenSexpSym(st_idx); 00570 } 00571 00572 // ubnd_val/(ubnd_var, ubnd_unused) 00573 if (ARB_const_ubnd(arbh)) { 00574 INT64 val = ARB_ubnd_val(arbh); 00575 sos << BegList << Atom("const") << Atom(val) << EndList; 00576 } 00577 else { 00578 ST_IDX st_idx = ARB_ubnd_var(arbh); 00579 sos << GenSexpSym(st_idx); 00580 } 00581 00582 // stride_val/(stride_var, stride_unused) 00583 if (ARB_const_stride(arbh)) { 00584 INT64 val = ARB_stride_val(arbh); 00585 sos << BegList << Atom("const") << Atom(val) << EndList; 00586 } 00587 else { 00588 ST_IDX st_idx = ARB_stride_var(arbh); 00589 sos << GenSexpSym(st_idx); 00590 } 00591 00592 sos << EndList; 00593 } 00594 00595 00596 void 00597 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, TYLIST* tyl) 00598 { 00599 sos << BegList << Atom(idx); 00600 00601 // ty_idx 00602 TY_IDX ty_idx = TYLIST_type(*tyl); 00603 sos << GenSexpTy(ty_idx); 00604 00605 sos << EndList; 00606 } 00607 00608 00609 void 00610 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, TCON* tcon) 00611 { 00612 // see osprey1.0/common/com/targ_const.h 00613 using namespace sexp::IOFlags; 00614 00615 sos << BegList << Atom(idx); 00616 00617 FortTk::uint128_t qd; // 16 byte value, a tcon has two of these 00618 00619 // ty 00620 TYPE_ID mty = TCON_ty(*tcon); 00621 const char* mty_nm = Mtype_Name(mty); 00622 sos << Atom(mty_nm); 00623 00624 // flags 00625 UINT32 flg = tcon->flags; 00626 const char* flg_str = TCONFlags_To_Str(flg); 00627 sos << GenSexpFlg(flg_str); 00628 00629 // vals [quad] (FIXME: abstract these values from the union) 00630 FortTk::assign(qd, tcon->vals.qval); 00631 sos << BegList << Atom(A_HEX, qd.hi) << Atom(A_HEX, qd.lo) << EndList; 00632 00633 // cmplxval [quad] 00634 FortTk::assign(qd, tcon->cmplxval.qival); 00635 sos << BegList << Atom(A_HEX, qd.hi) << Atom(A_HEX, qd.lo) << EndList; 00636 00637 sos << EndList; 00638 } 00639 00640 00641 void 00642 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, INITO* inito) 00643 { 00644 // see osprey1.0/common/com/irbdata_defs.h 00645 sos << BegList << Atom(idx); 00646 00647 // st_idx 00648 sos << GenSexpSym(inito->st_idx); 00649 00650 // val 00651 sos << Atom(inito->val); 00652 00653 sos << EndList; 00654 } 00655 00656 00657 void 00658 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, INITV* initv) 00659 { 00660 // see osprey1.0/common/com/irbdata_defs.h 00661 sos << BegList << Atom(idx); 00662 00663 // next 00664 sos << Atom(initv->next); 00665 00666 // kind 00667 const char* initvknd_nm = InitvKind_Name(initv->kind); 00668 sos << Atom(initvknd_nm); 00669 00670 // repeat1 00671 sos << Atom(initv->repeat1); 00672 00673 // st/lab/lab1/mtype/tc/blk/pad 00674 sos << Atom(initv->St()); 00675 00676 // ofst/st2/repeat2/unused 00677 sos << Atom(initv->Ofst()); 00678 00679 sos << EndList; 00680 } 00681 00682 00683 void 00684 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, BLK* blk) 00685 { 00686 sos << BegList << Atom(idx); 00687 00688 // size 00689 sos << Atom(blk->Size()); 00690 00691 // align 00692 sos << Atom(blk->Align()); 00693 00694 // flags 00695 const char* flgext_str = BLK_FLAGS_To_Str(blk->Flags()); 00696 sos << GenSexpFlg(flgext_str); 00697 00698 // section_idx 00699 sos << Atom(blk->Section_idx()); 00700 00701 // scninfo_idx 00702 sos << Atom(blk->Scninfo_idx()); 00703 00704 sos << EndList; 00705 } 00706 00707 00708 void 00709 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, LABEL* lbl) 00710 { 00711 using namespace sexp::IOFlags; 00712 00713 sos << BegList << Atom(idx); 00714 00715 // name_idx 00716 STR_IDX nmidx = LABEL_name_idx(*lbl); 00717 const char* nm = LABEL_name(*lbl); 00718 sos << BegList << Atom(A_DQUOTE, nm) << Atom(nmidx) << EndList; 00719 00720 // kind 00721 LABEL_KIND knd = LABEL_kind(*lbl); 00722 const char* knd_nm = LABEL_Kind_Name(knd); 00723 sos << Atom(knd_nm); 00724 00725 // flags 00726 UINT32 flg = (UINT32)lbl->flags; 00727 const char* flg_str = LABEL_FLAGS_To_Str(flg); 00728 sos << GenSexpFlg(flg_str); 00729 00730 sos << EndList; 00731 } 00732 00733 00734 void 00735 whirl2sexp::xlate_SYMTAB_entry(sexp::ostream& sos, UINT32 idx, PREG* preg) 00736 { 00737 using namespace sexp::IOFlags; 00738 00739 sos << BegList << Atom(idx); 00740 00741 // name_idx 00742 STR_IDX nmidx = PREG_name_idx(*preg); 00743 const char* nm = PREG_name(*preg); 00744 sos << BegList << Atom(A_DQUOTE, nm) << Atom(nmidx) << EndList; 00745 00746 sos << EndList; 00747 } 00748 00749 00750 void 00751 whirl2sexp::xlate_SYMTAB_entry_TCON_STR(sexp::ostream& sos, UINT32 idx) 00752 { 00753 using namespace sexp::IOFlags; 00754 00755 sos << BegList << Atom(idx); 00756 00757 // char_array 00758 const char* str = Index_to_char_array(idx); 00759 sos << Atom(A_DQUOTE, str); 00760 00761 sos << EndList; 00762 } 00763 00764 00765 void 00766 whirl2sexp::xlate_SYMTAB_entry_STR(sexp::ostream& sos, UINT32 idx) 00767 { 00768 using namespace sexp::IOFlags; 00769 00770 sos << BegList << Atom(idx); 00771 00772 // string 00773 const char* str = Index_To_Str(idx); 00774 sos << Atom(A_DQUOTE, str); 00775 00776 sos << EndList; 00777 } 00778 00779 00780 //*************************************************************************** 00781