00001 #ifndef OOO_INSTRUMENTATION_H_INCLUDED_
00002 #define OOO_INSTRUMENTATION_H_INCLUDED_
00003
00004 #include <iostream>
00005 #include <cstdlib>
00006
00007 #include "rose.h"
00008 #include "../segment_graph/combined_data_conflict_table.h"
00009 #include "../segment_graph/prediction_time_advance_table.h"
00010 #include "../segment_graph/prediction_event_notification_table.h"
00011
00012 namespace risc {
00013
00014 class Design;
00015
00016 namespace sg {
00017
00018 class DataConflictTable;
00019 class EventConflictTable;
00020 class SegmentGraph;
00021 class TimeAdvanceTable;
00022 }
00023
00024 namespace tools {
00025
00026 class ParseStatus;
00027 }
00028
00029 namespace inst {
00030
00035 class InstrumentationTraversal: public AstSimpleProcessing
00036 {
00037 public:
00038 InstrumentationTraversal(SgType*, SgExpression*, SgExpression*,
00039 SgClassDefinition*, std::map<SgNode*, int>&, std::string );
00040 virtual void visit(SgNode* astNode);
00041 bool _psg_off_instrumented;
00042 SgFunctionDeclaration* first_func_decl_that_contains_wait;
00043 std::string design_file_name;
00044
00045 private:
00049 SgType* variableType;
00050
00054 SgExpression* PrimChnlVarRefExp;
00055
00059 SgExpression* SCChnlVarRefExp;
00060
00064 SgClassDefinition* SCModuleClassDef;
00065
00069 std::map<SgNode*, int>& FuncCallExptoID;
00070 };
00071
00078 int
00079 risc_link(SgProject* project, risc::tools::ParseStatus* parseStatus, const std::string tool_name);
00080
00087 void
00088 risc_buildCompilerCommandLineOptions(SgFile* file,
00089 std::vector<std::string>& argv,
00090 std::vector<std::string>& compilerCmdLine,
00091 risc::tools::ParseStatus* parseStatus,
00092 const std::string tool_name);
00093
00101 int
00102 risc_compileOutputFile(SgFile* file, risc::tools::ParseStatus* parseStatus, const std::string tool_name);
00103
00111 int
00112 risc_compileOutput(SgProject* project, risc::tools::ParseStatus* parseStatus, const std::string tool_name);
00113
00118 void
00119 risc_unparse(risc::Design &design,
00120 risc::tools::ParseStatus* parseStatus,
00121 const std::string tool_name,
00122 UnparseFormatHelp *unparseFormatHelp = NULL,
00123 UnparseDelegate* unparseDelegate = NULL);
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00147 int
00148 risc_compile(risc::Design &design, risc::tools::ParseStatus* parseStatus,
00149 const std::string tool_name);
00150
00157 int
00158 risc_backend(risc::Design &design,
00159 risc::tools::ParseStatus* parseStatus,
00160 const std::string tool_name,
00161 UnparseFormatHelp *unparseFormatHelp = NULL,
00162 UnparseDelegate* unparseDelegate = NULL);
00163
00169 void
00170 instrumentor(risc::Design &design,
00171 risc::sg::SegmentGraph &sg,
00172 risc::sg::DataConflictTable* data_conflict_table,
00173 risc::sg::EventConflictTable* event_conflict_table,
00174 risc::sg::TimeAdvanceTable* time_advance_table,
00175 risc::sg::CombinedDataConflictTable* combined_data_conflict_table,
00176 risc::sg::PredictionTimeAdvanceTable* prediction_time_advance_table,
00177 risc::sg::PredictionEventNotificationTable* prediction_event_notification_table,
00178 risc::tools::ParseStatus* parseStatus,
00179 std::string design_file_name,
00180 std::vector< std::vector<int> > &psg_seg_id_array,
00181 std::vector<std::string> &file_names,
00182 std::vector< std::vector<int> > &channel_seg_id_array,
00183 std::vector<std::string> &channel_seg_id_array_names
00184 );
00185
00190 void instrument_functions_without_definitions(risc::sg::SegmentGraph &sg);
00191
00192
00197 void instrument_port_calls(risc::sg::SegmentGraph &sg);
00198
00204 void instrument_wait_in_channels(risc::sg::SegmentGraph &sg);
00205
00210 std::string generate_unique_name(std::string var_name);
00211
00215 extern int counter;
00216
00217 }
00218
00219 }
00220
00221 #endif
00222
00223