00001 #ifndef SEGMENT_H_INCLUDED_ 00002 #define SEGMENT_H_INCLUDED_ 00003 00004 #include<string> 00005 #include<vector> 00006 #include<set> 00007 #include<iostream> 00008 00009 #include "rose.h" 00010 00011 namespace risc { 00012 00013 namespace sg { 00014 00015 class Segment { 00016 00017 public: 00018 //typedef std::vector<const SgStatement*> Statements; 00019 typedef std::vector<SgNode*> Expressions; 00020 boost::default_color_type color; 00021 00022 enum Status {Untouched = 0, Touched = 1}; 00023 Status color_for_communication_graph_; 00024 Status helper_for_graph_algorithms_; 00025 00026 Expressions expressions_; 00027 00028 bool debugging_; 00029 std::set<SgNode*> conflicts_; 00030 00031 Segment(SgNode const * const boundary_node); 00032 00033 Segment(const Segment &other); 00034 00040 void analyze_segment(); 00041 00047 void analyze_expression(SgNode *expression, bool left_of_assignment, 00048 bool read_write, bool member_access); 00049 00050 friend std::ostream& operator<< (std::ostream &out, const Segment &segment) 00051 { 00052 return out; 00053 } 00054 00059 void add_expression(SgNode* node); 00060 00065 bool operator==(const Segment &other); 00066 00067 /* 00068 * \brief Merges the other segment in this segment. 00069 * No statement will be doubled 00070 */ 00071 void merge(const Segment &other); 00072 00076 int id_; 00077 00081 SgNode const * const boundary_node_; 00082 00087 static int id_counter; 00088 00092 boost::default_color_type color_; 00093 00097 std::set<SgVariableSymbol*> read_variables_; 00098 00102 std::set<SgVariableSymbol*> write_variables_; 00103 00108 bool in_conflict_with_all_other_segments; 00109 00110 // /** 00111 // * \brief 00112 // */ 00113 // std::set<SgVariableSymbol*> read_references_; 00114 // 00115 // std::set<SgVariableSymbol*> write_references_; 00116 }; 00117 00118 00119 00120 } // end of namespace sg 00121 00122 } // end of namespace risc 00123 00124 #endif /* SEGMENT_H_INCLUDED_ */ 00125 00126 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */