00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __info_edge_H
00030 #define __info_edge_H
00031 #include <iostream>
00032 #include <string>
00037 using namespace std;
00038 namespace DDG{
00039 class INFO_NODE;
00040 class INFO_EDGE;
00041 class DAG;
00042 class LOOP;
00043
00044
00045
00050 typedef enum {
00051 flowdep_reg=1,
00052 antidep_reg,
00053 outputdep_reg,
00054 inputdep_reg,
00055 flowdep_mem,
00056 antidep_mem,
00057 outputdep_mem,
00058 inputdep_mem,
00059 spilldep_mem,
00060 other_mem,
00061 serial,
00062 killerdep,
00063 reusedep,
00064 } edge_type;
00068 std::string edge_type_to_string(const edge_type);
00069
00073 edge_type string_to_edge_type(const std::string);
00074
00084 class INFO_EDGE
00085 {
00086 friend class DDG::DAG;
00087 friend class DDG::LOOP;
00088 edge_type kind;
00089 int duration;
00090 int distance;
00091 int regtype_id;
00092 double val_duration;
00093 double sigma() const
00094 {return val_duration;}
00095 void set_sigma(double val)
00096 {val_duration=val;}
00097
00098 public:
00104 INFO_EDGE() ;
00105
00109 INFO_EDGE(edge_type et) ;
00110
00112 INFO_EDGE(int dur, int dis, edge_type et);
00113
00117 INFO_EDGE(int dur, edge_type et);
00118
00119
00120 INFO_EDGE(const INFO_EDGE &ie);
00121
00123
00127 bool is_flow() const
00128 {if (kind==flowdep_reg || kind==flowdep_mem) return true; else return false;}
00129
00130
00131
00133 edge_type etype() const
00134 {return kind;}
00135
00137 int delta() const
00138 {return duration;}
00139
00141 int lambda() const
00142 {return distance;}
00144 bool check();
00146 int get_register_type_id() const {return regtype_id;}
00148 bool is_flow_reg(int regtypeid) const;
00150 bool is_flow_reg() const;
00152 bool is_dep_reg() const;
00154
00157
00159 void set_etype( const edge_type& et )
00160 {
00161 kind = et;
00162 }
00163
00165 bool set_register_type_id(int regtypeid);
00166
00168 void set_delta(int val)
00169 {duration=val; val_duration=(double) val;}
00170
00172 void set_lambda(int lambda)
00173 {distance=lambda;}
00174
00176
00182 friend ostream& operator<<(ostream &os, INFO_EDGE x) ;
00183
00187 friend istream& operator>>(istream &is, INFO_EDGE & x);
00188
00189
00191 };
00192
00193
00197 bool operator==(const INFO_EDGE, const INFO_EDGE);
00198 }
00199 #endif