All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
segment.h
Go to the documentation of this file.
1 #ifndef SEGMENT_H_INCLUDED_
2 #define SEGMENT_H_INCLUDED_
3 
4 #include<vector>
5 #include<set>
6 #include<iostream>
7 
8 #include "rose.h"
9 #include "boost/graph/properties.hpp" // needed for color
10 
11 #include "mapped_variable.h" // needed for Conflict
12 
13 #include "time.h" // needed for Time
14 #include "port_call_path.h"
15 #include "../internal_representation/thread.h"
16 
17 namespace risc {
18 
19 namespace sg {
20 
21 class Segment {
22 
23 public:
24 
30 
35  SgFunctionDeclaration* b_transport_func_;
36 
41  SgFunctionCallExp* b_transport_;
42 
49 
50 
58 
66 
67 
77 
83 
88  std::string function_name_exit_;
89 
98  std::string module_name_;
99 
106 
116  std::string pcp_port_name_;
117 
124  SgNode* pcp_port_;
125 
126  //psg cloning ZC step 1
134 
135  //psg cloning ZC step 5
143  SgFunctionCallExp* port_call_func_exp_;
144 
157  //end
158 
159  //psg cloning ZC step 5
166  //end
167 
168 
173  int psg_id_;
174 
179  int node_id_;
180 
191 
196  static int node_counter;
197 
198  enum ERead {NonRead = 0, Read = 1};
199  enum EWrite {NonWrite = 0, Write = 1};
200 
201  //typedef std::vector<const SgStatement*> Statements;
202  typedef std::list<NodeWithPath> Expressions;
203  boost::default_color_type color;
204 
205  enum Status {Untouched = 0, Touched = 1};
208 
210 
212 
217 
222 
227 
231  std::set<Conflict> conflicts_;
232 
242  Segment(SgNode *boundary_node,
243  bool inlined_segment,
244  int psg_id = 0,
245  bool is_fake_segment_ = false,
246  bool is_simulation_process = false);
247 
248  Segment(const Segment &other);
249 
254 
260  void analyze_segment();
261 
267  void analyze_expression(SgNode *expression, ERead read, EWrite write, PortCallPath pcp);
268 
269  friend std::ostream& operator<< (std::ostream &out, const Segment &segment)
270  {
271  return out;
272  }
273 
278  void add_expression(NodeWithPath nwp);
279 
284  bool operator==(const Segment &other);
285 
286  /*
287  * \brief Merges the other segment in this segment.
288  * No statement will be doubled
289  */
290  void merge(const Segment &other);
291 
295  int id_;
296 
300  SgNode * boundary_node_;
301 
308  Thread *originating_thread_; // (RD, 07/10/18)
309 
314  static int id_counter;
315 
319  boost::default_color_type color_;
320 
324  std::set<SymbolWithPath> read_variables_;
325 
329  std::set<SymbolWithPath> write_variables_;
330 
336  std::set<SymbolWithPath> wait_events_; // (RD, 07/12/18)
337 
343  std::set<SymbolWithPath> notify_events_; // (RD, 07/12/18)
344 
349 
355 
364 
369 
374 
375 private:
381  bool waits_for_time();
382 
388  void generic_payload_analysis_helper(SgVariableSymbol* var_sym, bool is_write, PortCallPath pcp_of_var);
389 
391 };
392 
393 } // end of namespace sg
394 
395 } // end of namespace risc
396 
397 #endif /* SEGMENT_H_INCLUDED_ */
398 
399 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */
Definition: port_call_path.h:64
ERead
Definition: segment.h:198
Status color_for_communication_graph_
Definition: segment.h:206
Thread * originating_thread_
If known, this is the originating thread of the segment. If not known, this is NULL. If multiple threads reach here, this is -1. TODO: extend for all SystemC processes (RD, 07/11/18)
Definition: segment.h:308
friend std::ostream & operator<<(std::ostream &out, const Segment &segment)
Definition: segment.h:269
SgNode * boundary_node_
This is the associated boundary of the segment.
Definition: segment.h:300
int psg_id_
PSG_NODE attribute id of the psg that this node belongs to.
Definition: segment.h:173
Time get_min_waiting_time()
This function determines the minimal waiting time for this segment.
Definition: segment.cpp:848
Definition: thread.h:21
Time min_waiting_time_
Definition: segment.h:390
void generic_payload_analysis_helper(SgVariableSymbol *var_sym, bool is_write, PortCallPath pcp_of_var)
This functions is an internal helper function It adds the mapped gp data to the read/write_variables...
Definition: segment.cpp:1106
bool contains_sc_stop_
If this segment has an sc_stop, then in conflict with every segment.
Definition: segment.h:368
void merge(const Segment &other)
Definition: segment.cpp:149
std::string pcp_port_name_
PSG_NODE attribute if the node is partial function call node, and the non-defining function call in t...
Definition: segment.h:116
static int id_counter
This static counter will be used to generate id&#39;s for the individual segments.
Definition: segment.h:314
std::set< SymbolWithPath > notify_events_
List of all gathered events this segment is notifying TODO: this should be computed separately...
Definition: segment.h:343
int wait_offset_
used in instrumentation
Definition: segment.h:226
Definition: segment.h:198
boost::default_color_type color
Definition: segment.h:203
Definition: segment.h:198
bool is_simulation_process_
PSG_NODE attribute marks if a node is for a simulation process currently, it applies only to the firs...
Definition: segment.h:65
std::string function_name_entrance_
PSG_NODE attribute the qualified name of function that this node is entrance to.
Definition: segment.h:82
Definition: segment.h:205
Definition: segment.h:199
std::string function_name_exit_
PSG_NODE attribute the qualified name of function that this node is exit of.
Definition: segment.h:88
boost::default_color_type color_
This color is used for some boost algorithms.
Definition: segment.h:319
bool waits_for_time_
If this segment waits for time.
Definition: segment.h:373
bool is_b_transport_seg_
TLM2 attribute marks if a segment is in a b_transport function.
Definition: segment.h:29
std::set< SymbolWithPath > read_variables_
Set of all SgVariableSymbol which are read in this segment.
Definition: segment.h:324
Expressions expressions_
Definition: segment.h:209
Definition: port_call_path.h:10
bool is_entrance_to_channel_method_
PSG_NODE attribute If a function is a channel method (implemented in sc_channel) Then is_entrance_to_...
Definition: segment.h:133
SgFunctionCallExp * port_call_func_exp_
PSG_NODE attribute if this node is a partial function call node, and the non defining function call i...
Definition: segment.h:143
void analyze_expression(SgNode *expression, ERead read, EWrite write, PortCallPath pcp)
This function analyzes recursively all read and write accesses in this expression.
Definition: segment.cpp:397
std::string channel_seg_ids_array_name_
PSG_NODE attribute After integration, we use this attribute to identify in which channel segment id a...
Definition: segment.h:165
This class represents timing in discrete event simulation.
Definition: time.h:14
SgFunctionDeclaration * b_transport_func_
TLM2 attribute the function that this segment belongs to.
Definition: segment.h:35
std::string unique_port_call_name_
PSG_NODE attribute the variable name of the channel segment array. After instrumentation, it looks like this: set_upcoming_seg_id(risc_tmp_&quot;unique_port_call_name_&quot;+wait_offset_) extern int risc_tmp_&quot;unique_port_call_name_&quot;[] stored in psg file, loaded back and reconstructed in partial func call nodes this makes the instrumented names in both port call file and top file same.
Definition: segment.h:156
bool deref_pointer_write_
If this segment has a pointer write.
Definition: segment.h:363
static int node_counter
PSG_NODE attribute a static counter that counts the current id of current node.
Definition: segment.h:196
int id_
This is the unique id of the segment.
Definition: segment.h:295
bool is_channel_segment_
if this segemnt belongs to a channel function
Definition: segment.h:221
std::string module_name_
PSG_NODE attribute the qualified name of module that this node belongs to it is not empty only if the...
Definition: segment.h:98
void add_expression(NodeWithPath nwp)
This function add the given node to the vector of expressions.
Definition: segment.cpp:140
std::set< SymbolWithPath > write_variables_
Set of all SgVariableSymbol which are written in this segment.
Definition: segment.h:329
bool is_fake_segment_
PSG_NODE attribute marks if a node is fake, not a true segment node and will be merged.
Definition: segment.h:48
std::set< Conflict > conflicts_
the conflicts in this segment
Definition: segment.h:231
int segment_node_id_
PSG_NODE attribute each segment node in a psg has a unique contiuous id it is used for instrumentatio...
Definition: segment.h:76
bool is_sc_fifo_port_call_
PSG_NODE attribute marks if a node is port call for sc_fifo. if it is, then during instrumentation...
Definition: segment.h:57
PortCallPath pcp_
To identify segments which belong to segments.
Definition: segment.h:253
SgNode * pcp_port_
PSG_NODE attribute reconstructed when a partial function call node is loaded back, using the stored pcp_port_name_. when used, should be converted to sgVariableDefinition.
Definition: segment.h:124
SgFunctionCallExp * b_transport_
TLM2 attribute the b_transport call that this segment contains.
Definition: segment.h:41
bool waits_for_time()
This functions determines if a function waits for time The related flag waits_for_time_ will be set d...
Definition: segment.cpp:990
void analyze_segment()
This function determines which variable are read and written in this segment.
Definition: segment.cpp:220
Segment(SgNode *boundary_node, bool inlined_segment, int psg_id=0, bool is_fake_segment_=false, bool is_simulation_process=false)
Constructor for segment.
Definition: segment.cpp:21
std::set< SymbolWithPath > wait_events_
List of all gathered events this segment is waiting for TODO: this should be computed separately...
Definition: segment.h:336
Definition: segment.h:205
bool debugging_
Definition: segment.h:211
bool operator==(const Segment &other)
If two segments are equal the return value is true.
Definition: segment.cpp:134
EWrite
Definition: segment.h:199
bool is_redacted_
PSG_NODE attribute if a node is removed in the psg file by the provider, when loaded back...
Definition: segment.h:190
std::list< NodeWithPath > Expressions
Definition: segment.h:202
Definition: segment.h:21
Status helper_for_graph_algorithms_
Definition: segment.h:207
bool inlined_segment_
if this segemnt should be merged into others
Definition: segment.h:216
Status
Definition: segment.h:205
Definition: segment.h:199
bool calls_conflict_function_
This segment calls a function with is marked as conflict.
Definition: segment.h:348
int node_id_
PSG_NODE attribute id of node, continuous.
Definition: segment.h:179
bool deref_pointer_read_
If this segment has a pointer read.
Definition: segment.h:359
std::string non_defining_function_call_name_
PSG_NODE attribute if the node is partial function call node, this attribute stores the qualified nam...
Definition: segment.h:105