Go to the documentation of this file.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 #ifndef pu_info_INCLUDED
00037 #define pu_info_INCLUDED
00038
00039 #include <elf.h>
00040
00041 #include "dwarf_DST_mem.h"
00042
00043 #ifndef _symtab_INCLUDED
00044 #include "symtab.h"
00045 #endif
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 #define PU_HEADER_VERSION 1
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 #define WT_SYMTAB 0x0
00076 #define WT_TREE 0x1
00077 #define WT_DEPGRAPH 0x2
00078 #define WT_PREFETCH 0x3
00079 #define WT_REGIONS 0x4
00080 #define WT_FEEDBACK 0x5
00081 #define WT_FREQ 0x6
00082 #define WT_AC_INTERNAL 0x7
00083 #define WT_ALIAS_CLASS 0x8
00084
00085 #define WT_SUBSECTIONS 0x9
00086 #define WT_PROC_SYM -1
00087
00088
00089
00090
00091 #define PU_HAS_GLOBALS 0x1
00092
00093 #define PU_HAS_NESTED_PU 0x2
00094 #define PU_IS_COMPILER_GENERATED 0x4
00095 #define PU_IS_DRA_CLONE 0x8
00096 #define PU_PREGS_RENUMBERED 0x10
00097
00098
00099
00100
00101
00102
00103 #define PU_INTERNAL_MASK 0xf0000000
00104 #define PU_DELETED 0x10000000
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 typedef struct pu_info {
00123 struct pu_info *next;
00124 struct pu_info *child;
00125 mINT32 state;
00126
00127 ST_IDX proc_sym;
00128 mINT32 flags;
00129 DST_IDX pu_dst;
00130 DST_IDX cu_dst;
00131
00132
00133
00134 struct {
00135 Elf64_Word offset;
00136 union {
00137 Elf64_Word size;
00138 void *ptr;
00139 } u;
00140 } subsect[WT_SUBSECTIONS];
00141
00142
00143 struct wn_map_tab *maptab;
00144 } PU_Info;
00145
00146
00147 #define PU_Info_proc_sym(pu) (pu)->proc_sym
00148 #define PU_Info_proc_id(pu) (pu)->proc_sym
00149
00150 #ifdef __cplusplus
00151
00152 inline PU &
00153 PU_Info_pu(PU_Info *ppui)
00154 {
00155 return Pu_Table[ST_pu(St_Table[PU_Info_proc_sym(ppui)])];
00156 }
00157 #endif
00158
00159 #define PU_Info_subsect_offset(pu,scn) (pu)->subsect[scn].offset
00160 #define PU_Info_subsect_size(pu,scn) (pu)->subsect[scn].u.size
00161 #define PU_Info_subsect_ptr(pu,scn) (pu)->subsect[scn].u.ptr
00162 #define PU_Info_flags(pu) (pu)->flags
00163 #define PU_Info_pu_dst(pu) (pu)->pu_dst
00164 #define PU_Info_cu_dst(pu) (pu)->cu_dst
00165 #define PU_Info_cu_dst(pu) (pu)->cu_dst
00166 #define PU_Info_maptab(pu) (pu)->maptab
00167 #define PU_Info_next(pu) (pu)->next
00168 #define PU_Info_child(pu) (pu)->child
00169
00170 #define Set_PU_Info_flags(pu,flag_value) (pu)->flags |= (flag_value)
00171 #define Clear_PU_Info_flags(pu,flag_value) (pu)->flags &= ~(flag_value)
00172 #define Is_Set_PU_Info_flags(pu,flag_value) ((pu)->flags & (flag_value))
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185 typedef enum subsect_state {
00186 Subsect_Missing = 0,
00187 Subsect_Exists = 1,
00188 Subsect_InMem = 2,
00189 Subsect_Written = 3
00190 } Subsect_State;
00191
00192 #define PU_Info_state(pu, ndx) \
00193 (Subsect_State)(((pu)->state >> (((ndx) + 1) << 1)) & 0x3)
00194 #define Set_PU_Info_state(pu, ndx, st) (pu)->state = (pu)->state & \
00195 ~(0x3 << (((ndx) + 1) << 1)) | (st << (((ndx) + 1) << 1))
00196
00197
00198
00199
00200
00201
00202 #define PU_Info_symtab_ptr(pu) \
00203 (LOCAL_SYMTAB_HEADER_TABLE *) PU_Info_subsect_ptr((pu), WT_SYMTAB)
00204 #define PU_Info_tree_ptr(pu) \
00205 (WN *)PU_Info_subsect_ptr((pu), WT_TREE)
00206 #define PU_Info_depgraph_ptr(pu) \
00207 (void *)PU_Info_subsect_ptr((pu), WT_DEPGRAPH)
00208 #define PU_Info_regions_ptr(pu) \
00209 (struct region_id *)PU_Info_subsect_ptr((pu), WT_REGIONS)
00210 #define PU_Info_feedback_ptr(pu) \
00211 (void *)PU_Info_subsect_ptr((pu), WT_FEEDBACK)
00212 #define PU_Info_frequencies_ptr(pu) \
00213 (INT32 *) PU_Info_subsect_ptr((pu), WT_FREQ)
00214 #define PU_Info_alias_class_ptr(pu) \
00215 (INT32 *) PU_Info_subsect_ptr((pu), WT_ALIAS_CLASS)
00216 #define PU_Info_ac_internal_ptr(pu) \
00217 (void *) PU_Info_subsect_ptr((pu), WT_AC_INTERNAL)
00218
00219 #define Set_PU_Info_tree_ptr(pu,x) \
00220 PU_Info_subsect_ptr((pu), WT_TREE) = (void *)(x)
00221 #define Set_PU_Info_symtab_ptr(pu,x) \
00222 PU_Info_subsect_ptr((pu), WT_SYMTAB) = (void *)(x)
00223 #define Set_PU_Info_depgraph_ptr(pu,x) \
00224 PU_Info_subsect_ptr((pu), WT_DEPGRAPH) = (void *)(x)
00225 #define Set_PU_Info_regions_ptr(pu,x) \
00226 PU_Info_subsect_ptr((pu), WT_REGIONS) = (void *)(x)
00227 #define Set_PU_Info_feedback_ptr(pu,x) \
00228 PU_Info_subsect_ptr((pu), WT_FEEDBACK) = (void *)(x)
00229 #define Set_PU_Info_frequencies_ptr(pu,x) \
00230 PU_Info_subsect_ptr((pu), WT_FREQ) = (void *) (x)
00231 #define Set_PU_Info_alias_class_ptr(pu,x) \
00232 PU_Info_subsect_ptr((pu), WT_ALIAS_CLASS) = (void *) (x)
00233 #define Set_PU_Info_ac_internal_ptr(pu,x) \
00234 PU_Info_subsect_ptr((pu), WT_AC_INTERNAL) = (void *) (x)
00235
00236 #define Set_PU_Info_pu_dst(pu, x) \
00237 PU_Info_pu_dst(pu) = x;
00238 #define Set_PU_Info_cu_dst(pu, x) \
00239 PU_Info_cu_dst(pu) = x;
00240
00241
00242 #ifdef __cplusplus
00243 extern "C" {
00244 #endif
00245
00246 extern void PU_Info_init (PU_Info *pu);
00247 extern INT Sizeof_PU_Infos (PU_Info *pu_tree);
00248 extern INT Write_PU_Infos (PU_Info *pu_tree, char *base);
00249 extern PU_Info *Read_PU_Infos (char *base, INT32 size, INT32 *p_num_PUs);
00250
00251 extern PU_Info *Current_PU_Info;
00252
00253 extern void Save_Local_Symtab (SYMTAB_IDX level, PU_Info *pu);
00254 extern void Restore_Local_Symtab (PU_Info *pu);
00255
00256 #ifdef __cplusplus
00257 }
00258 #endif
00259
00260 #ifdef __cplusplus
00261
00262 inline PU &
00263 Current_PU_Info_pu()
00264 {
00265 return PU_Info_pu(Current_PU_Info);
00266 }
00267 #endif
00268
00269 #ifdef FIL
00270 extern PU_Info *Last_PU;
00271 #endif
00272 #endif