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<map>
7 #include<iostream>
8 
9 #include "rose.h"
10 #include "boost/graph/properties.hpp" // needed for color
11 
12 #include "mapped_variable.h" // needed for Conflict
13 
14 #include "time.h" // needed for Time
15 #include "port_call_path.h"
16 #include "../internal_representation/thread.h"
17 
18 namespace risc {
19 
20 namespace sg {
21 
22 class Segment {
23 
24 public:
25 
31 
36  SgFunctionDeclaration* b_transport_func_;
37 
42  SgFunctionCallExp* b_transport_;
43 
50 
51 
59 
67 
68 
78 
84 
89  std::string function_name_exit_;
90 
99  std::string module_name_;
100 
107 
117  std::string pcp_port_name_;
118 
125  SgNode* pcp_port_;
126 
127  //psg cloning ZC step 1
135 
136  //psg cloning ZC step 5
144  SgFunctionCallExp* port_call_func_exp_;
145 
158  //end
159 
160  //psg cloning ZC step 5
167  //end
168 
169 
174  int psg_id_;
175 
180  int node_id_;
181 
192 
197  static int node_counter;
198 
199  enum ERead {NonRead = 0, Read = 1};
200  enum EWrite {NonWrite = 0, Write = 1};
201 
202  //typedef std::vector<const SgStatement*> Statements;
203  typedef std::list<NodeWithPath> Expressions;
204  boost::default_color_type color;
205 
206  enum Status {Untouched = 0, Touched = 1};
209 
211 
213 
218 
223 
228 
232  std::set<Conflict> conflicts_;
233 
243  Segment(SgNode *boundary_node,
244  bool inlined_segment,
245  int psg_id = 0,
246  bool is_fake_segment_ = false,
247  bool is_simulation_process = false);
248 
249  Segment(const Segment &other);
250 
255 
261  void analyze_segment();
262 
268  void analyze_expression(SgNode *expression, ERead read, EWrite write, PortCallPath pcp);
269 
270  friend std::ostream& operator<< (std::ostream &out, const Segment &segment)
271  {
272  return out;
273  }
274 
279  void add_expression(NodeWithPath nwp);
280 
285  bool operator==(const Segment &other);
286 
287  /*
288  * \brief Merges the other segment in this segment.
289  * No statement will be doubled
290  */
291  void merge(const Segment &other);
292 
296  int id_;
297 
301  SgNode * boundary_node_;
302 
309  Thread *originating_thread_; // (RD, 07/10/18)
310 
315  static int id_counter;
316 
320  boost::default_color_type color_;
321 
325  std::set<SymbolWithPath> read_variables_;
326 
330  std::set<SymbolWithPath> write_variables_;
331 
337  std::set<SymbolWithPath> wait_events_; // (RD, 07/12/18)
338 
344  std::set<SymbolWithPath> notify_events_; // (RD, 07/12/18)
345 
349  std::map<SgVariableSymbol*, Time> events_notification_time_; // (RD, 07/12/18)
350 
355 
361 
370 
375 
380 
381 private:
387  bool waits_for_time();
388 
394  void generic_payload_analysis_helper(SgVariableSymbol* var_sym, bool is_write, PortCallPath pcp_of_var);
395 
397 };
398 
399 } // end of namespace sg
400 
401 } // end of namespace risc
402 
403 #endif /* SEGMENT_H_INCLUDED_ */
404 
405 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */
Definition: port_call_path.h:64
ERead
Definition: segment.h:199
Status color_for_communication_graph_
Definition: segment.h:207
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:309
friend std::ostream & operator<<(std::ostream &out, const Segment &segment)
Definition: segment.h:270
SgNode * boundary_node_
This is the associated boundary of the segment.
Definition: segment.h:301
int psg_id_
PSG_NODE attribute id of the psg that this node belongs to.
Definition: segment.h:174
Time get_min_waiting_time()
This function determines the minimal waiting time for this segment.
Definition: segment.cpp:892
Definition: thread.h:21
Time min_waiting_time_
Definition: segment.h:396
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:1176
bool contains_sc_stop_
If this segment has an sc_stop, then in conflict with every segment.
Definition: segment.h:374
void merge(const Segment &other)
Definition: segment.cpp:150
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:117
static int id_counter
This static counter will be used to generate id&#39;s for the individual segments.
Definition: segment.h:315
std::set< SymbolWithPath > notify_events_
List of all gathered events this segment is notifying TODO: this should be computed separately...
Definition: segment.h:344
int wait_offset_
used in instrumentation
Definition: segment.h:227
Definition: segment.h:199
boost::default_color_type color
Definition: segment.h:204
Definition: segment.h:199
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:66
std::string function_name_entrance_
PSG_NODE attribute the qualified name of function that this node is entrance to.
Definition: segment.h:83
Definition: segment.h:206
Definition: segment.h:200
std::string function_name_exit_
PSG_NODE attribute the qualified name of function that this node is exit of.
Definition: segment.h:89
boost::default_color_type color_
This color is used for some boost algorithms.
Definition: segment.h:320
bool waits_for_time_
If this segment waits for time.
Definition: segment.h:379
bool is_b_transport_seg_
TLM2 attribute marks if a segment is in a b_transport function.
Definition: segment.h:30
std::set< SymbolWithPath > read_variables_
Set of all SgVariableSymbol which are read in this segment.
Definition: segment.h:325
Expressions expressions_
Definition: segment.h:210
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:134
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:144
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:405
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:166
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:36
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:157
bool deref_pointer_write_
If this segment has a pointer write.
Definition: segment.h:369
static int node_counter
PSG_NODE attribute a static counter that counts the current id of current node.
Definition: segment.h:197
int id_
This is the unique id of the segment.
Definition: segment.h:296
bool is_channel_segment_
if this segemnt belongs to a channel function
Definition: segment.h:222
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:99
void add_expression(NodeWithPath nwp)
This function add the given node to the vector of expressions.
Definition: segment.cpp:141
std::set< SymbolWithPath > write_variables_
Set of all SgVariableSymbol which are written in this segment.
Definition: segment.h:330
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:49
std::set< Conflict > conflicts_
the conflicts in this segment
Definition: segment.h:232
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:77
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:58
PortCallPath pcp_
To identify segments which belong to segments.
Definition: segment.h:254
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:125
SgFunctionCallExp * b_transport_
TLM2 attribute the b_transport call that this segment contains.
Definition: segment.h:42
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:1058
void analyze_segment()
This function determines which variable are read and written in this segment.
Definition: segment.cpp:228
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:337
Definition: segment.h:206
bool debugging_
Definition: segment.h:212
bool operator==(const Segment &other)
If two segments are equal the return value is true.
Definition: segment.cpp:135
EWrite
Definition: segment.h:200
bool is_redacted_
PSG_NODE attribute if a node is removed in the psg file by the provider, when loaded back...
Definition: segment.h:191
std::list< NodeWithPath > Expressions
Definition: segment.h:203
std::map< SgVariableSymbol *, Time > events_notification_time_
Show when events will be notified.
Definition: segment.h:349
Definition: segment.h:22
Status helper_for_graph_algorithms_
Definition: segment.h:208
bool inlined_segment_
if this segemnt should be merged into others
Definition: segment.h:217
Status
Definition: segment.h:206
Definition: segment.h:200
bool calls_conflict_function_
This segment calls a function with is marked as conflict.
Definition: segment.h:354
int node_id_
PSG_NODE attribute id of node, continuous.
Definition: segment.h:180
bool deref_pointer_read_
If this segment has a pointer read.
Definition: segment.h:365
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:106