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>&);
00040 virtual void visit(SgNode* astNode);
00041
00042 private:
00046 SgType* variableType;
00047
00051 SgExpression* PrimChnlVarRefExp;
00052
00056 SgExpression* SCChnlVarRefExp;
00057
00061 SgClassDefinition* SCModuleClassDef;
00062
00066 std::map<SgNode*, int>& FuncCallExptoID;
00067 };
00068
00075 int
00076 risc_link(SgProject* project, risc::tools::ParseStatus* parseStatus, const std::string tool_name);
00077
00084 void
00085 risc_buildCompilerCommandLineOptions(SgFile* file,
00086 std::vector<std::string>& argv,
00087 std::vector<std::string>& compilerCmdLine,
00088 risc::tools::ParseStatus* parseStatus,
00089 const std::string tool_name);
00090
00098 int
00099 risc_compileOutputFile(SgFile* file, risc::tools::ParseStatus* parseStatus, const std::string tool_name);
00100
00108 int
00109 risc_compileOutput(SgProject* project, risc::tools::ParseStatus* parseStatus, const std::string tool_name);
00110
00115 void
00116 risc_unparse(risc::Design &design,
00117 risc::tools::ParseStatus* parseStatus,
00118 const std::string tool_name,
00119 UnparseFormatHelp *unparseFormatHelp = NULL,
00120 UnparseDelegate* unparseDelegate = NULL);
00121
00127 void
00128 risc_patch(risc::Design &design,
00129 risc::tools::ParseStatus* parseStatus,
00130 const char *methodPattern,
00131 const char *threadPattern,
00132 const char *cthreadPattern,
00133 const std::string tool_name);
00134
00141 int
00142 risc_compile(risc::Design &design, risc::tools::ParseStatus* parseStatus,
00143 const std::string tool_name);
00144
00151 int
00152 risc_backend(risc::Design &design,
00153 risc::tools::ParseStatus* parseStatus,
00154 const std::string tool_name,
00155 UnparseFormatHelp *unparseFormatHelp = NULL,
00156 UnparseDelegate* unparseDelegate = NULL);
00157
00163 void
00164 instrumentor(risc::Design &design,
00165 risc::sg::SegmentGraph &sg,
00166 risc::sg::DataConflictTable* data_conflict_table,
00167 risc::sg::EventConflictTable* event_conflict_table,
00168 risc::sg::TimeAdvanceTable* time_advance_table,
00169 risc::sg::CombinedDataConflictTable* combined_data_conflict_table,
00170 risc::sg::PredictionTimeAdvanceTable* prediction_time_advance_table,
00171 risc::sg::PredictionEventNotificationTable* prediction_event_notification_table,
00172 risc::tools::ParseStatus* parseStatus);
00173
00174
00179 void instrument_port_calls(risc::sg::SegmentGraph &sg);
00180
00186 void instrument_wait_in_channels(risc::sg::SegmentGraph &sg);
00187
00192 std::string generate_unique_name(std::string var_name);
00193
00197 extern int counter;
00198
00199 }
00200
00201 }
00202
00203 #endif
00204
00205