00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INCLUDED_BB_EDGE_PROFILE_H
00022 #define INCLUDED_BB_EDGE_PROFILE_H
00023
00024 #include <lego.H>
00025 #include "node_table.h"
00026 #include "edge_table.h"
00027 #include "instrument.h"
00028
00029 class BB_Edge_Profile
00030 {
00031 public:
00032 BB_Edge_Profile():_bb_node_table(NULL),_edge_table(NULL),_bbid_start_index(0),_bbid_end_index(0),_bb_profile_table_string(NULL),_edge_profile_table_string(NULL) {}
00033
00034 ~BB_Edge_Profile()
00035 {
00036 delete[] _bb_profile_table_string;
00037 delete[] _edge_profile_table_string;
00038 }
00039
00040 void set_bb_profile_table_string(char *i)
00041 {
00042 _bb_profile_table_string=new char[strlen(i)+1];
00043 strcpy(_bb_profile_table_string,i);
00044 }
00045
00046 void set_edge_profile_table_string(char *i)
00047 {
00048 _edge_profile_table_string=new char[strlen(i)+1];
00049 strcpy(_edge_profile_table_string,i);
00050 }
00051
00052 void doit(legoModule *ModulePtr,int option);
00053 void instrument(legoProc *proc_ptr);
00054 void recursive_instrument(legoProc *proc_ptr,legoRegion *region_ptr);
00055 void insert_probe(legoProc *proc_ptr,legoRegion *region_ptr);
00056 void instrument_exit_op(legoProc *proc_ptr,legoRegion *region_ptr,legoOp *exit_op);
00057
00058 void insert_3_probes(legoProc *proc_ptr,legoRegion *region_ptr,legoOprd *predicate_oprd,int true_path_mapping,int false_path_mapping,legoOp *from_op_ptr);
00059
00060 void open_main_file(int bb_max_entry,int edge_max_entry);
00061 void close_main_file();
00062 void open_header_file();
00063 void close_header_file();
00064
00065 void lego_write(legoModule *module_ptr,char *input_filename);
00066
00067
00068 int bbid_end_has_probe(int region_id);
00069 void bbid_end_insert(int region_id);
00070 int bbid_start_has_probe(int region_id);
00071 void bbid_start_insert(int region_id);
00072 void reset_bbid_start();
00073 void reset_bbid_end();
00074
00075 private:
00076 #define BB_EDGE_HEADER_FILENAME "MY_ADDITIONAL.h"
00077 #define BB_EDGE_MAIN_FILENAME "BB_eDGe_PRoFiLe.c"
00078
00079 #define BB_EDGE_PROFILE_START_PROBE_NAME "_MY_BBiD_STaRT_PRoBe"
00080 #define BB_EDGE_PROFILE_eND_PROBE_NAME "_MY_BBiD_eND_PRoBe"
00081 #define BB_EDGE_PROFILE_1_PROBE_NAME "_MY_1_PRoBe"
00082
00083 FILE *_main_fp;
00084 FILE *_header_fp;
00085 char *_bb_profile_table_string;
00086 char *_edge_profile_table_string;
00087
00088
00089
00090
00091 #define MAX_BB_ENTRY 2000
00092 int _bbid_start[MAX_BB_ENTRY];
00093 int _bbid_end[MAX_BB_ENTRY];
00094 int _bbid_start_index;
00095 int _bbid_end_index;
00096
00097
00098 Instrument _my_instrument;
00099
00100
00101
00102
00103 Node_Table *_bb_node_table;
00104 Edge_Table *_edge_table;
00105 };
00106
00107 #endif // INCLUDED_BB_EDGE_PROFILE_H