00001 #ifndef SEGMENT_H_INCLUDED_
00002 #define SEGMENT_H_INCLUDED_
00003
00004 #include<vector>
00005 #include<set>
00006 #include<iostream>
00007
00008 #include "rose.h"
00009 #include "boost/graph/properties.hpp"
00010
00011 #include "mapped_variable.h"
00012
00013 #include "time.h"
00014 #include "port_call_path.h"
00015 #include "../internal_representation/thread.h"
00016
00017 namespace risc {
00018
00019 namespace sg {
00020
00021 class Segment {
00022
00023 public:
00024
00025
00026
00027 bool is_fake_segment;
00028
00035 bool is_simulation_process_;
00036
00037
00046 int segment_node_id_;
00047
00052 std::string function_name_entrance_;
00053
00058 std::string function_name_exit_;
00059
00068 std::string module_name_;
00069
00075 std::string non_defining_function_call_name_;
00076
00086 std::string pcp_port_name_;
00087
00094 SgNode* pcp_port_;
00095
00096
00103 bool is_entrance_to_channel_method_;
00104
00105
00113 SgFunctionCallExp* port_call_func_exp_;
00114
00126 std::string unique_port_call_name_;
00127
00128
00129
00135 std::string channel_seg_ids_array_name_;
00136
00137
00138
00143 int psg_id_;
00144
00149 int node_id_;
00150
00160 bool is_redacted_;
00161
00162
00163
00164 static int node_counter;
00165
00166 enum ERead {NonRead = 0, Read = 1};
00167 enum EWrite {NonWrite = 0, Write = 1};
00168
00169
00170 typedef std::list<NodeWithPath> Expressions;
00171 boost::default_color_type color;
00172
00173 enum Status {Untouched = 0, Touched = 1};
00174 Status color_for_communication_graph_;
00175 Status helper_for_graph_algorithms_;
00176
00177 Expressions expressions_;
00178
00179 bool debugging_;
00180 bool inlined_segment_;
00181
00182 bool is_channel_segment_;
00183 int wait_offset_;
00184
00185 std::set<Conflict> conflicts_;
00186
00187
00188
00189 Segment(SgNode *boundary_node,
00190 bool inlined_segment,
00191 int psg_id = 0,
00192 bool is_fake_segment_ = false,
00193 bool is_simulation_process = false);
00194
00195 Segment(const Segment &other);
00196
00200 PortCallPath pcp_;
00201
00207 void analyze_segment();
00208
00214 void analyze_expression(SgNode *expression, ERead read, EWrite write, PortCallPath pcp);
00215
00216 friend std::ostream& operator<< (std::ostream &out, const Segment &segment)
00217 {
00218 return out;
00219 }
00220
00225
00226 void add_expression(NodeWithPath nwp);
00227
00232 bool operator==(const Segment &other);
00233
00234
00235
00236
00237
00238 void merge(const Segment &other);
00239
00243 int id_;
00244
00248 SgNode * boundary_node_;
00249
00256 Thread *originating_thread_;
00257
00262 static int id_counter;
00263
00267 boost::default_color_type color_;
00268
00272 std::list<SymbolWithPath> read_variables_;
00273
00277 std::list<SymbolWithPath> write_variables_;
00278
00284 std::list<SymbolWithPath> wait_events_;
00285
00291 std::list<SymbolWithPath> notify_events_;
00292
00296 bool calls_conflict_function_;
00297
00302 Time get_min_waiting_time();
00303
00304
00305 bool deref_pointer_read_;
00306 bool deref_pointer_write_;
00307 bool waits_for_time_;
00308
00309 private:
00315 bool waits_for_time();
00316 };
00317
00318 }
00319
00320 }
00321
00322 #endif
00323
00324