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" // needed for color 00010 00011 #include "mapped_variable.h" // needed for Conflict 00012 00013 #include "time.h" // needed for Time 00014 00015 namespace risc { 00016 00017 namespace sg { 00018 00019 class Segment { 00020 00021 public: 00022 enum ERead {NonRead = 0, Read = 1}; 00023 enum EWrite {NonWrite = 0, Write = 1}; 00024 00025 //typedef std::vector<const SgStatement*> Statements; 00026 typedef std::vector<SgNode*> Expressions; 00027 boost::default_color_type color; 00028 00029 enum Status {Untouched = 0, Touched = 1}; 00030 Status color_for_communication_graph_; 00031 Status helper_for_graph_algorithms_; 00032 00033 Expressions expressions_; 00034 00035 bool debugging_; 00036 bool inlined_segment_; 00037 00038 bool is_channel_segment_; 00039 int wait_offset_; 00040 00041 std::set<Conflict> conflicts_; 00042 00043 Segment(SgNode const * const boundary_node, bool inlined_segment); 00044 00045 Segment(const Segment &other); 00046 00052 void analyze_segment(); 00053 00059 void analyze_expression(SgNode *expression, ERead read, EWrite write); 00060 00061 friend std::ostream& operator<< (std::ostream &out, const Segment &segment) 00062 { 00063 return out; 00064 } 00065 00070 void add_expression(SgNode* node); 00071 00076 bool operator==(const Segment &other); 00077 00078 /* 00079 * \brief Merges the other segment in this segment. 00080 * No statement will be doubled 00081 */ 00082 void merge(const Segment &other); 00083 00087 int id_; 00088 00092 SgNode const * const boundary_node_; 00093 00098 static int id_counter; 00099 00103 boost::default_color_type color_; 00104 00108 std::list<SgVariableSymbol*> read_variables_; 00109 00113 std::list<SgVariableSymbol*> write_variables_; 00114 00118 bool calls_conflict_function_; 00119 00124 Time get_min_waiting_time(); 00125 00126 00127 bool deref_pointer_read_; 00128 bool deref_pointer_write_; 00129 bool waits_for_time_; 00130 00131 private: 00137 bool waits_for_time(); 00138 }; 00139 00140 } // end of namespace sg 00141 00142 } // end of namespace risc 00143 00144 #endif /* SEGMENT_H_INCLUDED_ */ 00145 00146 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */