00001 #ifndef CONFLICT_TABLE_H_INCLUDED_
00002 #define CONFLICT_TABLE_H_INCLUDED_
00003
00004 #include<utility>
00005
00006 #include "../internal_representation/path_instance_mapper.h"
00007 #include "segment_graph.h"
00008
00009 namespace risc {
00010
00011 namespace sg {
00012
00013 class ConflictTable {
00014 public:
00015
00019 ConflictTable(
00020 SegmentGraph &segment_graph,
00021 PathInstanceMapper &path_instance_mapper,
00022 bool debugging = false);
00023
00027 ~ConflictTable();
00028
00034 VertexDescriptor *vertex_lookup_;
00035
00040 int size_of_conflict_table_;
00041
00047 int max_instances_;
00048
00054 int number_of_segments_;
00055
00060 int **instance_id_to_index_lookup_;
00061
00065 bool **conflict_table_;
00066
00071 void print_conflict_table(std::string filename);
00072
00077 void print_lookup_table(std::string filename);
00078
00084 int segment_and_instance_id_to_index(int segment_id, int instance_id);
00085
00092 std::pair<int, int> index_to_segment_and_instance_id(int index);
00093
00099 bool has_conflict(int segment_id_1, int instance_id_1, int segment_id_2,
00100 int instance_id_2);
00101
00107 void print_instance_id_to_index_lookup_table();
00108
00113 void set_conflict(int segment_id_1, int instance_id_1,
00114 int segment_id_2, int instance_id_2);
00115
00120 void set_conflict_cause(int segment_id_1, int instance_id_1,
00121 int segment_id_2, int instance_id_2, SgNode *cause = NULL);
00122
00128 virtual void determine_conflict_table();
00129
00130
00136 VertexDescriptor segment_id_to_vertex_descriptor(int id);
00137
00138 PathInstanceMapper &path_instance_mapper_;
00139 SegmentGraph &segment_graph_;
00140
00141
00142 struct ConflictInformation {
00143 std::set<SgNode*> conflict_variables_;
00144 };
00145
00146 ConflictInformation **conflict_info_;
00147
00148 bool debugging_;
00149 };
00150
00151 };
00152
00153 };
00154
00155 #endif
00156
00157