00001 #ifndef CONFLICT_TABLE_H_INCLUDED_
00002 #define CONFLICT_TABLE_H_INCLUDED_
00003
00004 #include<utility>
00005
00006 #include "rose.h"
00007
00008 #include "segment_graph.h"
00009 #include "mapped_variable.h"
00010
00011 namespace risc {
00012
00013 class PathInstanceMapper;
00014
00015 namespace sg {
00016
00017 class ConflictTable {
00018
00019 public:
00020
00024 ConflictTable(
00025 SegmentGraph &segment_graph,
00026 PathInstanceMapper *path_instance_mapper,
00027 bool debugging = false);
00028
00032 ~ConflictTable();
00033
00039 VertexDescriptor *vertex_lookup_;
00040
00045 int size_of_conflict_table_;
00046
00052 int max_instances_;
00053
00059 int number_of_segments_;
00060
00065 int **instance_id_to_index_lookup_;
00066
00070 bool **conflict_table_;
00071
00076 void print_conflict_table(std::string filename);
00077
00082 void print_lookup_table(std::string filename);
00083
00089 int segment_and_instance_id_to_index(int segment_id, int instance_id);
00090
00097 std::pair<int, int> index_to_segment_and_instance_id(int index);
00098
00104 bool has_conflict(int segment_id_1, int instance_id_1, int segment_id_2,
00105 int instance_id_2);
00106
00112 void print_instance_id_to_index_lookup_table();
00113
00118 void set_conflict(int segment_id_1, int instance_id_1,
00119 int segment_id_2, int instance_id_2);
00120
00126 virtual void determine_conflict_table();
00127
00133 VertexDescriptor segment_id_to_vertex_descriptor(int id);
00134
00142 MappedVariableList
00143 get_mapped_variable_statically(SgVariableSymbol *variable, int instance_id);
00144
00150 MappedVariableList
00151 get_mapped_variable_dynamically(SgVariableSymbol *variable, int instance_id);
00152
00158 int get_max_instances(int segment_id);
00159
00160
00161 PathInstanceMapper *path_instance_mapper_;
00162
00163 SegmentGraph &segment_graph_;
00164
00165
00166 struct ConflictInformation {
00167 std::set<Conflict> conflict_variables_;
00168 };
00169
00170 ConflictInformation **conflict_info_;
00171
00172 bool debugging_;
00173 };
00174
00175 };
00176
00177 };
00178
00179 #endif
00180
00181