00001 #include "elf_stuff.h" /* for all Elf stuff */ 00002 #include <sys/elf_whirl.h> /* for WHIRL sections */ 00003 #include "defs.h" /* for wn_core.h */ 00004 #include "errors.h" 00005 #include "opcode.h" /* for wn_core.h */ 00006 #include "mempool.h" /* for MEM_POOL (for maps) */ 00007 #include "strtab.h" /* for strtab */ 00008 #include "symtab.h" /* for symtab */ 00009 #include "const.h" /* for constab */ 00010 #include "targ_const.h" /* for tcon */ 00011 #include "config_targ.h" /* for Target_ABI */ 00012 #include "config_debug.h" /* for ir_version_check */ 00013 #include "config_elf_targ.h" 00014 #include "irbdata.h" /* for init_data */ 00015 #include "wn_core.h" /* for WN */ 00016 #include "wn.h" /* for max_region_id */ 00017 #include "wn_map.h" /* for WN maps */ 00018 #define USE_DST_INTERNALS 00019 #include "dwarf_DST_mem.h" /* for dst */ 00020 #include "pu_info.h" 00021 #include "ir_elf.h" 00022 #include "ir_bwrite.h" 00023 #include "ir_bcom.h" 00024 #include "ir_bread.h" 00025 00026 #include "isr.h" 00027 00028 #define ERROR_RETURN -1 00029 00030 class ISR_NODE* isr_cg; 00031 00032 // Read the ISR call graph. pu_nums is the total PU number in the 00033 // *.I file. Returns -1 if fails, else the size of the section. 00034 // The function is only call when -ipisr is turned on. 00035 INT 00036 Read_isr_cg (ISR_NODE* cg, INT pu_num) 00037 { 00038 register INT size; 00039 char *base; 00040 mINT32 *ptr; 00041 void *handle = local_fhandle; 00042 00043 Set_Error_Phase ( "Reading WHIRL file" ); 00044 00045 OFFSET_AND_SIZE shdr = get_section (handle, SHT_MIPS_WHIRL, WT_CALLGRAPH); 00046 if (shdr.offset == 0) return ERROR_RETURN; 00047 00048 base = (char*)handle + shdr.offset; 00049 size = shdr.size; 00050 ptr = (mINT32*)base; 00051 00052 for (INT i = 0; i < pu_num; i++) { 00053 mINT32 idx; 00054 cg[i].Set_Idx(i); 00055 while ((idx = *ptr++) != -1) // -1 marks the end of the caller list of a PU 00056 cg[i].Add_Parent(idx); 00057 } 00058 00059 return size; 00060 } 00061 00062 void Merge_Parents_Regset(ISR_NODE& node) 00063 { 00064 ISA_REGISTER_CLASS rc; 00065 00066 FOR_ALL_ISA_REGISTER_CLASS(rc) 00067 { 00068 REGISTER_SET set = REGISTER_SET_EMPTY_SET; 00069 BOOL first = 1; 00070 00071 for (ISR_PARENT_ITER iter(node); !iter.End(); iter.Next()) 00072 { 00073 mINT32 id = iter.Idx(); 00074 ISR_NODE par = isr_cg[id]; 00075 00076 if (!par.Processed()) continue; 00077 00078 if (first) { 00079 set = par.Regset(rc); 00080 first = 0; 00081 } else { 00082 set = REGISTER_SET_Intersection(set, par.Regset(rc)); 00083 } 00084 } 00085 00086 node.Set_Regset(rc, set); 00087 } 00088 }
1.5.6