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 namespace risc { 00014 00015 namespace sg { 00016 00017 class Segment { 00018 00019 public: 00020 //typedef std::vector<const SgStatement*> Statements; 00021 typedef std::vector<SgNode*> Expressions; 00022 boost::default_color_type color; 00023 00024 enum Status {Untouched = 0, Touched = 1}; 00025 Status color_for_communication_graph_; 00026 Status helper_for_graph_algorithms_; 00027 00028 Expressions expressions_; 00029 00030 bool debugging_; 00031 bool inlined_segment_; 00032 00033 std::set<Conflict> conflicts_; 00034 00035 Segment(SgNode const * const boundary_node, bool inlined_segment); 00036 00037 Segment(const Segment &other); 00038 00044 void analyze_segment(); 00045 00051 void analyze_expression(SgNode *expression, bool left_of_assignment, 00052 bool read_write, bool member_access, bool function_parameter, 00053 bool is_precached_function, SgVariableSymbol *outer_variable); 00054 00055 friend std::ostream& operator<< (std::ostream &out, const Segment &segment) 00056 { 00057 return out; 00058 } 00059 00064 void add_expression(SgNode* node); 00065 00070 bool operator==(const Segment &other); 00071 00072 /* 00073 * \brief Merges the other segment in this segment. 00074 * No statement will be doubled 00075 */ 00076 void merge(const Segment &other); 00077 00081 int id_; 00082 00086 SgNode const * const boundary_node_; 00087 00092 static int id_counter; 00093 00097 boost::default_color_type color_; 00098 00102 std::set<SgVariableSymbol*> read_variables_; 00103 00107 std::set<SgVariableSymbol*> write_variables_; 00108 00113 bool in_conflict_with_all_other_segments; 00114 }; 00115 00116 } // end of namespace sg 00117 00118 } // end of namespace risc 00119 00120 #endif /* SEGMENT_H_INCLUDED_ */ 00121 00122 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */