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
00016 namespace risc {
00017
00018 namespace sg {
00019
00020 class Segment {
00021
00022 public:
00023
00024
00025 std::string module_name;
00026 bool is_fake_segment;
00027 bool is_simulation_process_segment;
00028 int relative_seg_id;
00029 std::string starting_segment_for_function;
00030 std::string leaving_segment_for_function;
00031 std::string fake_segment_function_call_name;
00032
00033 int psg_id;
00034
00035 std::vector<SgVariableSymbol*> wait_event_symbols;
00036
00037 std::vector<SgVariableSymbol*> notify_event_symbols;
00038
00039 int node_id_;
00040
00041 static int node_counter;
00042
00043 enum ERead {NonRead = 0, Read = 1};
00044 enum EWrite {NonWrite = 0, Write = 1};
00045
00046
00047 typedef std::list<NodeWithPath> Expressions;
00048 boost::default_color_type color;
00049
00050 enum Status {Untouched = 0, Touched = 1};
00051 Status color_for_communication_graph_;
00052 Status helper_for_graph_algorithms_;
00053
00054 Expressions expressions_;
00055
00056 bool debugging_;
00057 bool inlined_segment_;
00058
00059 bool is_channel_segment_;
00060 int wait_offset_;
00061
00062 std::set<Conflict> conflicts_;
00063
00064
00065
00066 Segment(SgNode * boundary_node, bool inlined_segment, int psg_id_ = 0, bool is_fake_segment_ = false, bool is_simulation_process_segment_ = false);
00067
00068 Segment(const Segment &other);
00069
00070
00074 PortCallPath pcp_;
00075
00081 void analyze_segment();
00082
00088 void analyze_expression(SgNode *expression, ERead read, EWrite write, PortCallPath pcp);
00089
00090 friend std::ostream& operator<< (std::ostream &out, const Segment &segment)
00091 {
00092 return out;
00093 }
00094
00099
00100 void add_expression(NodeWithPath nwp);
00101
00106 bool operator==(const Segment &other);
00107
00108
00109
00110
00111
00112 void merge(const Segment &other);
00113
00117 int id_;
00118
00122 SgNode * boundary_node_;
00123
00128 static int id_counter;
00129
00133 boost::default_color_type color_;
00134
00138 std::list<SymbolWithPath> read_variables_;
00139
00143 std::list<SymbolWithPath> write_variables_;
00144
00148 bool calls_conflict_function_;
00149
00154 Time get_min_waiting_time();
00155
00156
00157 bool deref_pointer_read_;
00158 bool deref_pointer_write_;
00159 bool waits_for_time_;
00160
00161 private:
00167 bool waits_for_time();
00168 };
00169
00170 }
00171
00172 }
00173
00174 #endif
00175
00176