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
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 #ifndef profile_com_INCLUDED
00059 #define profile_com_INCLUDED
00060
00061 #include "defs.h"
00062
00063 #if defined(defs_INCLUDED) && ! defined(USE_STANDARD_TYPES)
00064 #undef short // get around bogus type defs.
00065 #undef int
00066 #undef long
00067 #endif // defined(defs_INCLUDED) && !defined(USE_STANDARD_TYPES)
00068
00069 #define ULONG mUINT32
00070
00071 #include "profile_type.h"
00072
00073
00074
00075 #define FB_NIDENT 16
00076
00077 #define INSTR_MAG "\177INS"
00078
00079 #define INSTR_CURRENT 2
00080
00081 struct Fb_Hdr {
00082 char fb_ident[FB_NIDENT];
00083 ULONG fb_version;
00084 ULONG fb_profile_offset;
00085 ULONG fb_pu_hdr_offset;
00086 ULONG fb_pu_hdr_ent_size;
00087 ULONG fb_pu_hdr_num;
00088 ULONG fb_str_table_offset;
00089 ULONG fb_str_table_size;
00090 PROFILE_PHASE phase_num;
00091
00092 Fb_Hdr() {}
00093 Fb_Hdr(Fb_Hdr& x)
00094 {
00095 memcpy((void *)fb_ident,(void *)x.fb_ident, FB_NIDENT);
00096 fb_version = x.fb_version;
00097 fb_profile_offset = x.fb_profile_offset;
00098 fb_pu_hdr_offset = x.fb_pu_hdr_offset;
00099 fb_pu_hdr_ent_size = x.fb_pu_hdr_ent_size;
00100 fb_pu_hdr_num = x.fb_pu_hdr_num;
00101 fb_str_table_offset = x.fb_str_table_offset;
00102 fb_str_table_size = x.fb_str_table_size;
00103 phase_num = x.phase_num;
00104 }
00105 void Print( FILE *fp ) const {
00106 fprintf(fp, "\n********** FILE HEADER **************\n");
00107 fprintf(fp, "fb_ident = %s\n", fb_ident);
00108 fprintf(fp, "fb_version = %u\n",fb_version);
00109 fprintf(fp, "fb_profile_offset = %u\n",fb_profile_offset);
00110 fprintf(fp, "fb_pu_hdr_offset = %u\n",fb_pu_hdr_offset);
00111 fprintf(fp, "fb_pu_hdr_ent_size = %u\n",fb_pu_hdr_ent_size);
00112 fprintf(fp, "fb_pu_hdr_num = %u\n",fb_pu_hdr_num);
00113 fprintf(fp, "fb_str_table_offset = %u\n",fb_str_table_offset);
00114 fprintf(fp, "fb_str_table_size = %u\n",fb_str_table_size);
00115 fprintf(fp, "phase_num = %u\n",phase_num);
00116 };
00117
00118 };
00119
00120 struct Pu_Hdr {
00121 INT32 pu_checksum;
00122 INT32 pu_size;
00123 #if defined(TARG_SL)
00124 UINT32 runtime_fun_address;
00125 #else
00126 UINT64 runtime_fun_address;
00127 #endif
00128 ULONG pu_name_index;
00129 ULONG pu_file_offset;
00130 ULONG pu_inv_offset;
00131 ULONG pu_num_inv_entries;
00132 ULONG pu_br_offset;
00133 ULONG pu_num_br_entries;
00134 ULONG pu_switch_offset;
00135 ULONG pu_switch_target_offset;
00136 ULONG pu_num_switch_entries;
00137 ULONG pu_cgoto_offset;
00138 ULONG pu_cgoto_target_offset;
00139 ULONG pu_num_cgoto_entries;
00140 ULONG pu_loop_offset;
00141 ULONG pu_num_loop_entries;
00142 ULONG pu_scircuit_offset;
00143 ULONG pu_num_scircuit_entries;
00144 ULONG pu_call_offset;
00145 ULONG pu_num_call_entries;
00146 #ifdef KEY
00147 ULONG pu_value_offset;
00148 ULONG pu_num_value_entries;
00149 ULONG pu_value_fp_bin_offset;
00150 ULONG pu_num_value_fp_bin_entries;
00151 #endif
00152
00153 ULONG pu_icall_offset;
00154 ULONG pu_num_icall_entries;
00155 ULONG pu_handle;
00156 ULONG pu_edge_offset;
00157 ULONG pu_num_edge_entries;
00158 ULONG pu_instr_count;
00159 ULONG pu_instr_exec_count;
00160 #ifdef KEY
00161 ULONG pu_values_offset;
00162 ULONG pu_values_fp_bin_offset;
00163 #else // KEY
00164 ULONG pu_value_offset;
00165 #endif
00166 ULONG pu_ld_count;
00167 ULONG pu_stride_offset;
00168 #ifdef KEY
00169
00170
00171 ULONG pad;
00172 #endif
00173
00174 Pu_Hdr() {
00175 pu_size=54321;
00176 pu_handle=11111;
00177 pu_edge_offset=222;
00178 pu_num_edge_entries=0;
00179 pu_instr_count=0;
00180 pu_instr_exec_count=0;
00181 pu_icall_offset=333;
00182 pu_num_icall_entries=0;
00183 #ifdef KEY
00184 pu_values_offset=444;
00185 pu_values_fp_bin_offset=666;
00186 #else
00187 pu_value_offset=444;
00188 #endif
00189 pu_ld_count=0;
00190 pu_stride_offset=555;
00191 #ifdef KEY
00192 pad = 0;
00193 #endif
00194 }
00195
00196 void Print( FILE * fp, int id=-1) const {
00197 fprintf(fp, "\n********** PU Header No %d **************\n", id);
00198 fprintf(fp, "pu_checksum = %d\n", pu_checksum);
00199 fprintf(fp, "pu_size = %d\n", pu_size);
00200 fprintf(fp, "runtime_fun_address= %llu\n", runtime_fun_address);
00201 fprintf(fp, "pu_name_index = %u\n", pu_name_index);
00202 fprintf(fp, "pu_file_offset = %u\n", pu_file_offset);
00203 fprintf(fp, "pu_inv_offset = %u\n", pu_inv_offset);
00204 fprintf(fp, "pu_num_inv_entries = %u\n", pu_num_inv_entries);
00205 fprintf(fp, "pu_br_offset = %u\n", pu_br_offset);
00206 fprintf(fp, "pu_num_br_entries = %u\n", pu_num_br_entries);
00207 fprintf(fp, "pu_switch_offset = %u\n", pu_switch_offset);
00208 fprintf(fp, "pu_switch_target_offset = %u\n", pu_switch_target_offset);
00209 fprintf(fp, "pu_num_switch_entries = %u\n", pu_num_switch_entries);
00210 fprintf(fp, "pu_cgoto_offset = %u\n", pu_cgoto_offset);
00211 fprintf(fp, "pu_cgoto_target_offset = %u\n", pu_cgoto_target_offset);
00212 fprintf(fp, "pu_num_cgoto_entries = %u\n", pu_num_cgoto_entries);
00213 fprintf(fp, "pu_loop_offset = %u\n", pu_loop_offset);
00214 fprintf(fp, "pu_num_loop_entries = %u\n", pu_num_loop_entries);
00215 fprintf(fp, "pu_scircuit_offset = %u\n", pu_scircuit_offset);
00216 fprintf(fp, "pu_num_scircuit_entries = %u\n", pu_num_scircuit_entries);
00217 fprintf(fp, "pu_call_offset = %u\n", pu_call_offset);
00218 fprintf(fp, "pu_num_call_entries = %u\n", pu_num_call_entries);
00219 #ifdef KEY
00220 fprintf(fp, "pu_value_offset = %u\n", pu_value_offset);
00221 fprintf(fp, "pu_num_value_entries = %u\n", pu_num_value_entries);
00222 fprintf(fp, "pu_value_fp_bin_offset = %u\n", pu_value_fp_bin_offset);
00223 fprintf(fp, "pu_num_value_fp_bin_entries = %u\n",
00224 pu_num_value_fp_bin_entries);
00225 #endif
00226 fprintf(fp, "pu_icall_offset = %u\n", pu_icall_offset);
00227 fprintf(fp, "pu_num_icall_entries = %u\n", pu_num_icall_entries);
00228 fprintf(fp, "pu_handle = %u\n", pu_handle);
00229 fprintf(fp, "pu_edge_offset = %u\n", pu_edge_offset);
00230 fprintf(fp, "pu_num_edge_entries = %u\n", pu_num_edge_entries);
00231 fprintf(fp, "pu_instr_count = %u\n", pu_instr_count);
00232 fprintf(fp, "pu_instr_exec_count = %u\n", pu_instr_exec_count);
00233 #ifdef KEY
00234 fprintf(fp, "pu_values_offset = %u\n", pu_values_offset);
00235 fprintf(fp, "pu_values_fp_bin_offset = %u\n", pu_values_fp_bin_offset);
00236 #else
00237 fprintf(fp, "pu_value_offset = %u\n", pu_value_offset);
00238 #endif
00239 fprintf(fp, "pu_ld_count = %u\n", pu_ld_count);
00240 fprintf(fp, "pu_stride_offset = %u\n", pu_stride_offset);
00241 };
00242 };
00243 #endif